summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbin/syncqt.pl64
-rw-r--r--config.tests/qpa/eglfs-egldevice/eglfs-egldevice.cpp53
-rw-r--r--config.tests/qpa/eglfs-egldevice/eglfs-egldevice.pro12
-rw-r--r--config.tests/qpa/eglfs-mali-2/eglfs-mali-2.cpp44
-rw-r--r--config.tests/qpa/eglfs-mali-2/eglfs-mali-2.pro5
-rw-r--r--config.tests/qpa/gbm/gbm.cpp44
-rw-r--r--config.tests/qpa/gbm/gbm.pro4
-rw-r--r--config.tests/qpa/kms/kms.cpp7
-rw-r--r--config.tests/qpa/kms/kms.pro2
-rw-r--r--config.tests/unix/gstreamer/gstreamer.cpp1
-rwxr-xr-xconfigure115
-rw-r--r--dist/changes-5.5.1140
-rw-r--r--doc/global/externalsites/qt-webpages.qdoc8
-rw-r--r--doc/global/externalsites/qtcreator.qdoc42
-rw-r--r--doc/global/fileextensions.qdocconf2
-rw-r--r--examples/embedded/digiflip/digiflip.cpp2
-rw-r--r--examples/gui/openglwindow/main.cpp10
-rw-r--r--examples/network/doc/src/torrent.qdoc33
-rw-r--r--examples/network/torrent/filemanager.cpp12
-rw-r--r--examples/network/torrent/metainfo.cpp2
-rw-r--r--examples/opengl/contextinfo/widget.cpp2
-rw-r--r--examples/qtconcurrent/wordcount/main.cpp8
-rw-r--r--examples/sql/masterdetail/dialog.cpp2
-rw-r--r--examples/sql/querymodel/customsqlmodel.cpp2
-rw-r--r--examples/widgets/desktop/systray/doc/images/systemtray-editor.pngbin0 -> 18147 bytes
-rw-r--r--examples/widgets/desktop/systray/doc/images/systemtray-example.pngbin0 -> 47588 bytes
-rw-r--r--examples/widgets/desktop/systray/doc/src/systray.qdoc183
-rw-r--r--examples/widgets/dialogs/classwizard/classwizard.cpp38
-rw-r--r--examples/widgets/doc/src/codeeditor.qdoc2
-rw-r--r--examples/widgets/doc/src/syntaxhighlighter.qdoc2
-rw-r--r--examples/widgets/draganddrop/draggableicons/main.cpp3
-rw-r--r--examples/widgets/draganddrop/draggabletext/draggabletext.pro6
-rw-r--r--examples/widgets/draganddrop/draggabletext/draglabel.cpp49
-rw-r--r--examples/widgets/draganddrop/draggabletext/draglabel.h58
-rw-r--r--examples/widgets/draganddrop/draggabletext/dragwidget.cpp45
-rw-r--r--examples/widgets/draganddrop/dropsite/droparea.cpp6
-rw-r--r--examples/widgets/draganddrop/dropsite/dropsitewindow.cpp27
-rw-r--r--examples/widgets/draganddrop/fridgemagnets/dragwidget.cpp19
-rw-r--r--examples/widgets/draganddrop/fridgemagnets/main.cpp2
-rw-r--r--examples/widgets/draganddrop/puzzle/main.cpp2
-rw-r--r--examples/widgets/draganddrop/puzzle/mainwindow.cpp47
-rw-r--r--examples/widgets/draganddrop/puzzle/mainwindow.h3
-rw-r--r--examples/widgets/draganddrop/puzzle/pieceslist.cpp10
-rw-r--r--examples/widgets/draganddrop/puzzle/pieceslist.h2
-rw-r--r--examples/widgets/draganddrop/puzzle/puzzlewidget.cpp26
-rw-r--r--examples/widgets/draganddrop/puzzle/puzzlewidget.h1
-rw-r--r--examples/widgets/gestures/imagegestures/imagewidget.cpp11
-rw-r--r--examples/widgets/gestures/imagegestures/imagewidget.h1
-rw-r--r--examples/widgets/gestures/imagegestures/mainwidget.h2
-rw-r--r--examples/widgets/graphicsview/boxes/scene.cpp4
-rw-r--r--examples/widgets/itemviews/chart/mainwindow.cpp2
-rw-r--r--examples/widgets/itemviews/editabletreemodel/treemodel.cpp2
-rw-r--r--examples/widgets/itemviews/frozencolumn/main.cpp6
-rw-r--r--examples/widgets/itemviews/interview/model.cpp2
-rw-r--r--examples/widgets/itemviews/simpledommodel/dommodel.cpp2
-rw-r--r--examples/widgets/itemviews/simpletreemodel/treemodel.cpp2
-rw-r--r--examples/widgets/tools/regexp/regexpdialog.cpp4
-rw-r--r--examples/widgets/tools/regularexpression/regularexpressiondialog.cpp4
-rw-r--r--examples/widgets/tools/settingseditor/variantdelegate.cpp4
-rw-r--r--examples/widgets/tutorials/addressbook/part7/addressbook.cpp16
-rw-r--r--examples/widgets/tutorials/modelview/5_edit/mymodel.cpp2
-rw-r--r--examples/widgets/widgets/calculator/calculator.cpp2
-rw-r--r--examples/widgets/widgets/stylesheet/mainwindow.cpp2
-rw-r--r--examples/xml/htmlinfo/main.cpp2
-rw-r--r--examples/xml/saxbookmarks/xbelgenerator.cpp4
-rw-r--r--mkspecs/aix-g++-64/qmake.conf3
-rw-r--r--mkspecs/aix-g++/qmake.conf3
-rw-r--r--mkspecs/aix-xlc-64/qmake.conf3
-rw-r--r--mkspecs/aix-xlc/qmake.conf3
-rw-r--r--mkspecs/common/armcc.conf44
-rw-r--r--mkspecs/common/clang-mac.conf1
-rw-r--r--mkspecs/common/gcc-base-mac.conf8
-rw-r--r--mkspecs/common/ios/clang.conf2
-rw-r--r--mkspecs/common/linux.conf4
-rw-r--r--mkspecs/common/mac.conf4
-rw-r--r--mkspecs/common/msvc-desktop.conf3
-rw-r--r--mkspecs/common/qcc-base-qnx-armle-v7.conf3
-rw-r--r--mkspecs/common/qcc-base-qnx-x86.conf3
-rw-r--r--mkspecs/common/qcc-base-qnx.conf2
-rw-r--r--mkspecs/common/unix.conf1
-rw-r--r--mkspecs/common/wince/qmake.conf3
-rw-r--r--mkspecs/common/winrt_winphone/qmake.conf3
-rw-r--r--mkspecs/cygwin-g++/qmake.conf5
-rw-r--r--mkspecs/darwin-g++/qmake.conf3
-rw-r--r--mkspecs/devices/linux-jetson-tk1-pro-g++/qmake.conf38
-rw-r--r--mkspecs/devices/linux-jetson-tk1-pro-g++/qplatformdefs.h34
-rw-r--r--mkspecs/features/default_post.prf4
-rw-r--r--mkspecs/features/gcov.prf1
-rw-r--r--mkspecs/features/mac/objective_c.prf27
-rw-r--r--mkspecs/features/mac/sdk.prf2
-rw-r--r--mkspecs/features/moc.prf2
-rw-r--r--mkspecs/features/qt.prf19
-rw-r--r--mkspecs/features/resolve_target.prf6
-rw-r--r--mkspecs/features/spec_pre.prf2
-rw-r--r--mkspecs/features/unix/hide_symbols.prf1
-rw-r--r--mkspecs/features/warn_off.prf1
-rw-r--r--mkspecs/features/warn_on.prf1
-rw-r--r--mkspecs/features/winrt/font_deployment.prf62
-rw-r--r--mkspecs/freebsd-g++/qmake.conf3
-rw-r--r--mkspecs/freebsd-g++46/qmake.conf3
-rw-r--r--mkspecs/freebsd-icc/qmake.conf3
-rw-r--r--mkspecs/haiku-g++/qmake.conf4
-rw-r--r--mkspecs/hpux-acc-64/qmake.conf3
-rw-r--r--mkspecs/hpux-acc-o64/qmake.conf3
-rw-r--r--mkspecs/hpux-acc/qmake.conf3
-rw-r--r--mkspecs/hpux-g++-64/qmake.conf3
-rw-r--r--mkspecs/hpux-g++/qmake.conf3
-rw-r--r--mkspecs/hpuxi-acc-32/qmake.conf3
-rw-r--r--mkspecs/hpuxi-acc-64/qmake.conf3
-rw-r--r--mkspecs/hpuxi-g++-64/qmake.conf3
-rw-r--r--mkspecs/hurd-g++/qmake.conf3
-rw-r--r--mkspecs/irix-cc-64/qmake.conf3
-rw-r--r--mkspecs/irix-cc/qmake.conf3
-rw-r--r--mkspecs/irix-g++-64/qmake.conf3
-rw-r--r--mkspecs/irix-g++/qmake.conf3
-rw-r--r--mkspecs/linux-cxx/qmake.conf3
-rw-r--r--mkspecs/linux-g++-32/qmake.conf4
-rw-r--r--mkspecs/linux-g++-64/qmake.conf3
-rw-r--r--mkspecs/linux-g++/qplatformdefs.h6
-rw-r--r--mkspecs/linux-kcc/qmake.conf3
-rw-r--r--mkspecs/linux-pgcc/qmake.conf3
-rw-r--r--mkspecs/lynxos-g++/qmake.conf3
-rw-r--r--mkspecs/macx-clang-32/qmake.conf1
-rw-r--r--mkspecs/macx-g++-32/qmake.conf1
-rw-r--r--mkspecs/macx-icc/qmake.conf8
-rw-r--r--mkspecs/macx-ios-clang/features/default_post.prf1
-rw-r--r--mkspecs/macx-xcode/default.xcscheme7
-rw-r--r--mkspecs/netbsd-g++/qmake.conf3
-rw-r--r--mkspecs/openbsd-g++/qmake.conf3
-rw-r--r--mkspecs/sco-g++/qmake.conf3
-rw-r--r--mkspecs/solaris-cc-64/qmake.conf3
-rw-r--r--mkspecs/solaris-cc/qmake.conf3
-rw-r--r--mkspecs/solaris-g++-64/qmake.conf3
-rw-r--r--mkspecs/solaris-g++/qmake.conf3
-rw-r--r--mkspecs/tru64-cxx/qmake.conf3
-rw-r--r--mkspecs/tru64-g++/qmake.conf3
-rw-r--r--mkspecs/unixware-cc/qmake.conf3
-rw-r--r--mkspecs/unixware-g++/qmake.conf3
-rw-r--r--mkspecs/unsupported/freebsd-clang/qmake.conf4
-rw-r--r--mkspecs/unsupported/linux-armcc/qmake.conf29
-rw-r--r--mkspecs/unsupported/linux-host-g++/qmake.conf3
-rw-r--r--mkspecs/unsupported/qnx-X11-g++/qmake.conf2
-rw-r--r--mkspecs/unsupported/vxworks-ppc-dcc/qmake.conf3
-rw-r--r--mkspecs/unsupported/vxworks-ppc-g++/qmake.conf3
-rw-r--r--mkspecs/unsupported/vxworks-simpentium-dcc/qmake.conf3
-rw-r--r--mkspecs/unsupported/vxworks-simpentium-g++/qmake.conf3
-rw-r--r--mkspecs/win32-g++/qmake.conf3
-rw-r--r--mkspecs/win32-g++/qplatformdefs.h1
-rw-r--r--mkspecs/win32-icc/qmake.conf3
-rw-r--r--qmake/doc/src/qmake-manual.qdoc5
-rw-r--r--qmake/generators/mac/pbuilder_pbx.cpp38
-rw-r--r--qmake/generators/makefile.cpp169
-rw-r--r--qmake/generators/makefile.h7
-rw-r--r--qmake/generators/projectgenerator.cpp2
-rw-r--r--qmake/generators/unix/unixmake.cpp440
-rw-r--r--qmake/generators/unix/unixmake.h3
-rw-r--r--qmake/generators/unix/unixmake2.cpp106
-rw-r--r--qmake/generators/win32/mingw_make.cpp110
-rw-r--r--qmake/generators/win32/mingw_make.h3
-rw-r--r--qmake/generators/win32/msvc_nmake.cpp24
-rw-r--r--qmake/generators/win32/msvc_nmake.h1
-rw-r--r--qmake/generators/win32/msvc_objectmodel.cpp2
-rw-r--r--qmake/generators/win32/msvc_vcproj.cpp25
-rw-r--r--qmake/generators/win32/winmakefile.cpp298
-rw-r--r--qmake/generators/win32/winmakefile.h6
-rw-r--r--qmake/meta.cpp16
-rw-r--r--qmake/meta.h12
-rw-r--r--qmake/option.cpp4
-rw-r--r--qmake/option.h2
-rw-r--r--[-rwxr-xr-x]src/3rdparty/angle/include/KHR/khrplatform.h0
-rw-r--r--[-rwxr-xr-x]src/3rdparty/angle/src/libANGLE/renderer/d3d/SurfaceD3D.cpp0
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp15
-rw-r--r--src/3rdparty/angle/src/libGLESv2/entry_points_egl_ext.cpp2
-rw-r--r--src/3rdparty/forkfd/forkfd.c6
-rw-r--r--src/3rdparty/forkfd/forkfd.h4
-rw-r--r--src/angle/patches/0008-ANGLE-Fix-Windows-Store-D3D-Trim-and-Level-9-require.patch57
-rw-r--r--src/angle/src/common/common.pri2
-rw-r--r--src/corelib/arch/qatomic_ia64.h8
-rw-r--r--src/corelib/codecs/qutfcodec_p.h2
-rw-r--r--src/corelib/doc/qtcore.qdocconf3
-rw-r--r--src/corelib/doc/snippets/code/doc_src_containers.cpp6
-rw-r--r--src/corelib/doc/snippets/code/src_corelib_tools_qhash.cpp6
-rw-r--r--src/corelib/doc/snippets/code/src_corelib_tools_qlinkedlist.cpp6
-rw-r--r--src/corelib/doc/snippets/code/src_corelib_tools_qmap.cpp6
-rw-r--r--src/corelib/doc/snippets/qstring/main.cpp4
-rw-r--r--src/corelib/doc/snippets/qstringlist/main.cpp2
-rw-r--r--src/corelib/doc/src/eventsandfilters.qdoc2
-rw-r--r--src/corelib/doc/src/objectmodel/metaobjects.qdoc2
-rw-r--r--src/corelib/doc/src/objectmodel/properties.qdoc2
-rw-r--r--src/corelib/doc/src/statemachine.qdoc2
-rw-r--r--src/corelib/global/qcompilerdetection.h5
-rw-r--r--src/corelib/global/qglobal.cpp4
-rw-r--r--src/corelib/global/qglobal.h2
-rw-r--r--src/corelib/global/qhooks_p.h11
-rw-r--r--src/corelib/global/qnamespace.qdoc17
-rw-r--r--src/corelib/io/qdebug.cpp56
-rw-r--r--src/corelib/io/qdebug.h16
-rw-r--r--src/corelib/io/qdir.cpp2
-rw-r--r--src/corelib/io/qfilesystemengine.cpp2
-rw-r--r--src/corelib/io/qfilesystementry.cpp3
-rw-r--r--src/corelib/io/qfilesystemwatcher.cpp6
-rw-r--r--src/corelib/io/qfilesystemwatcher_win.cpp2
-rw-r--r--src/corelib/io/qfsfileengine_p.h1
-rw-r--r--src/corelib/io/qiodevice.cpp6
-rw-r--r--src/corelib/io/qlockfile_unix.cpp37
-rw-r--r--src/corelib/io/qprocess.cpp12
-rw-r--r--src/corelib/io/qresource.cpp6
-rw-r--r--src/corelib/io/qsettings.cpp9
-rw-r--r--src/corelib/io/qsettings_mac.cpp6
-rw-r--r--src/corelib/io/qstandardpaths_win.cpp2
-rw-r--r--src/corelib/io/qtemporarydir.cpp4
-rw-r--r--src/corelib/io/qtextstream.cpp2
-rw-r--r--src/corelib/io/qtldurl.cpp15
-rw-r--r--src/corelib/io/qurl.cpp2
-rw-r--r--src/corelib/io/qwindowspipereader.cpp2
-rw-r--r--src/corelib/io/qwindowspipewriter.cpp54
-rw-r--r--src/corelib/json/qjsondocument.cpp2
-rw-r--r--src/corelib/json/qjsonvalue.cpp10
-rw-r--r--src/corelib/json/qjsonwriter.cpp4
-rw-r--r--src/corelib/kernel/qcore_unix_p.h14
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp12
-rw-r--r--src/corelib/kernel/qcoreapplication_p.h2
-rw-r--r--src/corelib/kernel/qeventdispatcher_win.cpp112
-rw-r--r--src/corelib/kernel/qeventdispatcher_win_p.h11
-rw-r--r--src/corelib/kernel/qmetaobject.cpp23
-rw-r--r--src/corelib/kernel/qobject.cpp4
-rw-r--r--src/corelib/kernel/qsharedmemory_systemv.cpp2
-rw-r--r--src/corelib/kernel/qsocketnotifier.cpp36
-rw-r--r--src/corelib/kernel/qsystemsemaphore_systemv.cpp2
-rw-r--r--src/corelib/kernel/qtimer.cpp9
-rw-r--r--src/corelib/kernel/qvariant.cpp2
-rw-r--r--src/corelib/mimetypes/qmimedatabase.cpp1
-rw-r--r--src/corelib/mimetypes/qmimedatabase.h1
-rw-r--r--src/corelib/mimetypes/qmimedatabase_p.h1
-rw-r--r--src/corelib/mimetypes/qmimemagicrule.cpp68
-rw-r--r--src/corelib/mimetypes/qmimemagicrule_p.h3
-rw-r--r--src/corelib/mimetypes/qmimeprovider.cpp1
-rw-r--r--src/corelib/mimetypes/qmimeprovider_p.h1
-rw-r--r--src/corelib/mimetypes/qmimetype.cpp1
-rw-r--r--src/corelib/mimetypes/qmimetype.h2
-rw-r--r--src/corelib/mimetypes/qmimetypeparser.cpp40
-rw-r--r--src/corelib/mimetypes/qmimetypeparser_p.h2
-rw-r--r--src/corelib/plugin/qelfparser_p.cpp2
-rw-r--r--src/corelib/plugin/qplugin.qdoc2
-rw-r--r--src/corelib/plugin/qpluginloader.cpp6
-rw-r--r--src/corelib/statemachine/qhistorystate.cpp13
-rw-r--r--src/corelib/statemachine/qstatemachine.cpp6
-rw-r--r--src/corelib/statemachine/qstatemachine_p.h12
-rw-r--r--src/corelib/thread/qfuturewatcher.cpp24
-rw-r--r--src/corelib/thread/qmutex.cpp15
-rw-r--r--src/corelib/thread/qthread_p.h2
-rw-r--r--src/corelib/thread/qthread_unix.cpp2
-rw-r--r--src/corelib/thread/qthread_win.cpp2
-rw-r--r--src/corelib/thread/qthreadstorage.cpp6
-rw-r--r--[-rwxr-xr-x]src/corelib/tools/qalgorithms.qdoc0
-rw-r--r--src/corelib/tools/qbitarray.h2
-rw-r--r--src/corelib/tools/qbytearray.cpp4
-rw-r--r--src/corelib/tools/qcommandlineparser.cpp4
-rw-r--r--src/corelib/tools/qdatetime.cpp1
-rw-r--r--src/corelib/tools/qhash.h7
-rw-r--r--src/corelib/tools/qlinkedlist.cpp78
-rw-r--r--src/corelib/tools/qlinkedlist.h32
-rw-r--r--src/corelib/tools/qlist.h7
-rw-r--r--src/corelib/tools/qlocale.cpp12
-rw-r--r--src/corelib/tools/qmap.h15
-rw-r--r--src/corelib/tools/qqueue.h2
-rw-r--r--src/corelib/tools/qregularexpression.cpp10
-rw-r--r--src/corelib/tools/qset.h29
-rw-r--r--src/corelib/tools/qset.qdoc78
-rw-r--r--src/corelib/tools/qsimd_p.h7
-rw-r--r--src/corelib/tools/qstack.h2
-rw-r--r--src/corelib/tools/qstring.cpp2
-rw-r--r--src/corelib/tools/qstring.h8
-rw-r--r--src/corelib/tools/qstringalgorithms_p.h2
-rw-r--r--src/corelib/tools/qversionnumber.cpp2
-rw-r--r--src/corelib/xml/qxmlstream.cpp3
-rw-r--r--src/dbus/dbus_minimal_p.h11
-rw-r--r--src/dbus/doc/src/qtdbus-module.qdoc2
-rw-r--r--src/dbus/qdbusinternalfilters.cpp3
-rw-r--r--src/dbus/qdbusmessage.cpp4
-rw-r--r--src/gui/doc/qtgui.qdocconf3
-rw-r--r--src/gui/doc/snippets/qfontdatabase/main.cpp2
-rw-r--r--src/gui/image/qimage.cpp2
-rw-r--r--src/gui/image/qimagereader.cpp2
-rw-r--r--src/gui/image/qjpeghandler.cpp1
-rw-r--r--src/gui/image/qpixmapcache.cpp2
-rw-r--r--src/gui/image/qppmhandler.cpp3
-rw-r--r--src/gui/kernel/qcursor.cpp10
-rw-r--r--src/gui/kernel/qcursor_p.h3
-rw-r--r--src/gui/kernel/qevent.cpp10
-rw-r--r--src/gui/kernel/qguiapplication.cpp17
-rw-r--r--src/gui/kernel/qkeysequence.cpp2
-rw-r--r--src/gui/kernel/qkeysequence.h3
-rw-r--r--src/gui/kernel/qpaintdevicewindow_p.h11
-rw-r--r--src/gui/kernel/qplatformtheme.cpp4
-rw-r--r--src/gui/kernel/qshapedpixmapdndwindow.cpp4
-rw-r--r--src/gui/kernel/qshapedpixmapdndwindow_p.h2
-rw-r--r--src/gui/kernel/qshortcutmap.cpp59
-rw-r--r--src/gui/kernel/qshortcutmap_p.h5
-rw-r--r--src/gui/kernel/qsimpledrag.cpp29
-rw-r--r--src/gui/kernel/qsimpledrag_p.h2
-rw-r--r--src/gui/kernel/qwindow.cpp6
-rw-r--r--src/gui/kernel/qwindowsysteminterface.cpp179
-rw-r--r--src/gui/kernel/qwindowsysteminterface.h18
-rw-r--r--src/gui/math3d/qmatrix4x4.cpp2
-rw-r--r--src/gui/opengl/qopenglframebufferobject.cpp17
-rw-r--r--src/gui/painting/qcosmeticstroker.cpp3
-rw-r--r--src/gui/painting/qpdf.cpp2
-rw-r--r--src/gui/painting/qpdfwriter.cpp3
-rw-r--r--src/gui/painting/qrgba64_p.h11
-rw-r--r--src/gui/painting/qtextureglyphcache.cpp4
-rw-r--r--src/gui/text/qtextengine_p.h3
-rw-r--r--src/network/access/qhttpnetworkconnection.cpp11
-rw-r--r--src/network/access/qhttpnetworkconnectionchannel.cpp29
-rw-r--r--src/network/access/qhttpnetworkconnectionchannel_p.h1
-rw-r--r--src/network/access/qhttpnetworkreply.cpp11
-rw-r--r--src/network/access/qhttpnetworkreply_p.h6
-rw-r--r--src/network/access/qhttpthreaddelegate.cpp1
-rw-r--r--src/network/access/qnetworkaccessmanager.cpp72
-rw-r--r--src/network/access/qnetworkaccessmanager_p.h14
-rw-r--r--src/network/access/qnetworkreplyhttpimpl.cpp19
-rw-r--r--src/network/access/qnetworkreplyhttpimpl_p.h2
-rw-r--r--src/network/access/qnetworkreplyimpl.cpp15
-rw-r--r--src/network/access/qnetworkreplyimpl_p.h2
-rw-r--r--src/network/doc/qtnetwork.qdocconf2
-rw-r--r--src/network/kernel/qauthenticator.cpp43
-rw-r--r--src/network/kernel/qnetworkproxy.cpp4
-rw-r--r--src/network/kernel/qnetworkproxy_generic.cpp2
-rw-r--r--src/network/socket/qabstractsocket.cpp21
-rw-r--r--src/network/socket/qhttpsocketengine.cpp2
-rw-r--r--src/network/socket/qlocalserver_unix.cpp24
-rw-r--r--src/network/socket/qlocalsocket_unix.cpp7
-rw-r--r--src/network/socket/qnativesocketengine_unix.cpp2
-rw-r--r--src/network/socket/qnativesocketengine_win.cpp37
-rw-r--r--src/network/socket/qnativesocketengine_winrt.cpp89
-rw-r--r--src/network/socket/qnativesocketengine_winrt_p.h4
-rw-r--r--src/network/ssl/qsslellipticcurve.cpp7
-rw-r--r--src/network/ssl/qsslpresharedkeyauthenticator.cpp2
-rw-r--r--src/network/ssl/qsslpresharedkeyauthenticator_p.h11
-rw-r--r--src/network/ssl/qsslsocket.cpp2
-rw-r--r--src/network/ssl/qsslsocket_openssl.cpp4
-rw-r--r--src/opengl/doc/qtopengl.qdocconf2
-rw-r--r--src/platformsupport/accessibility/qaccessiblebridgeutils_p.h11
-rw-r--r--src/platformsupport/cfsocketnotifier/qcfsocketnotifier.cpp129
-rw-r--r--src/platformsupport/cfsocketnotifier/qcfsocketnotifier_p.h14
-rw-r--r--src/platformsupport/dbusmenu/qdbusmenuadaptor_p.h11
-rw-r--r--src/platformsupport/dbusmenu/qdbusmenutypes.cpp2
-rw-r--r--src/platformsupport/dbusmenu/qdbusmenutypes_p.h11
-rw-r--r--src/platformsupport/dbusmenu/qdbusplatformmenu.cpp6
-rw-r--r--src/platformsupport/dbusmenu/qdbusplatformmenu_p.h12
-rw-r--r--src/platformsupport/dbustray/qdbustraytypes_p.h11
-rw-r--r--src/platformsupport/dbustray/qstatusnotifieritemadaptor_p.h11
-rw-r--r--src/platformsupport/dbustray/qxdgnotificationproxy_p.h11
-rw-r--r--src/platformsupport/devicediscovery/qdevicediscovery_static.cpp4
-rw-r--r--src/platformsupport/devicediscovery/qdevicediscovery_udev.cpp2
-rw-r--r--src/platformsupport/eglconvenience/qeglconvenience_p.h1
-rw-r--r--src/platformsupport/eglconvenience/qeglpbuffer.cpp6
-rw-r--r--src/platformsupport/eglconvenience/qeglpbuffer_p.h4
-rw-r--r--src/platformsupport/eglconvenience/qeglplatformcontext.cpp17
-rw-r--r--src/platformsupport/eglconvenience/qeglplatformcontext_p.h11
-rw-r--r--src/platformsupport/eventdispatchers/qeventdispatcher_cf.mm12
-rw-r--r--src/platformsupport/eventdispatchers/qeventdispatcher_cf_p.h30
-rw-r--r--src/platformsupport/fbconvenience/qfbvthandler.cpp117
-rw-r--r--src/platformsupport/fbconvenience/qfbvthandler_p.h9
-rw-r--r--src/platformsupport/fontdatabases/basic/qbasicfontdatabase.cpp2
-rw-r--r--src/platformsupport/input/evdevmouse/qevdevmousehandler.cpp2
-rw-r--r--src/platformsupport/input/tslib/qtslib_p.h11
-rw-r--r--src/platformsupport/linuxaccessibility/atspiadaptor.cpp4
-rw-r--r--src/platformsupport/themes/genericunix/qgenericunixthemes.cpp7
-rw-r--r--src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp4
-rw-r--r--src/plugins/generic/tuiotouch/qtuiohandler.cpp2
-rw-r--r--src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp106
-rw-r--r--src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.h8
-rw-r--r--src/plugins/platforms/android/androidjniinput.cpp4
-rw-r--r--src/plugins/platforms/android/androidjnimain.cpp2
-rw-r--r--src/plugins/platforms/android/qandroidassetsfileenginehandler.cpp8
-rw-r--r--src/plugins/platforms/android/qandroidinputcontext.cpp6
-rw-r--r--src/plugins/platforms/android/qandroidplatformfontdatabase.cpp6
-rw-r--r--src/plugins/platforms/cocoa/qcocoacursor.mm2
-rw-r--r--src/plugins/platforms/cocoa/qcocoahelpers.mm2
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenu.mm41
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.h1
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm18
-rw-r--r--src/plugins/platforms/cocoa/qnsview.h2
-rw-r--r--src/plugins/platforms/cocoa/qnsview.mm60
-rw-r--r--src/plugins/platforms/directfb/qdirectfbblitter.cpp2
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/deviceintegration.pro3
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsdevice.cpp11
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsscreen.cpp24
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsscreen.h3
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/eglfs_kms_egldevice.json3
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/eglfs_kms_egldevice.pro21
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp464
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.h137
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicemain.cpp (renamed from mkspecs/unsupported/linux-armcc/qplatformdefs.h)65
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/qeglfsmaliintegration.cpp6
-rw-r--r--src/plugins/platforms/eglfs/qeglfscontext.cpp3
-rw-r--r--src/plugins/platforms/eglfs/qeglfsdeviceintegration.cpp21
-rw-r--r--src/plugins/platforms/eglfs/qeglfsdeviceintegration.h5
-rw-r--r--src/plugins/platforms/eglfs/qeglfsintegration.cpp15
-rw-r--r--src/plugins/platforms/eglfs/qeglfswindow.cpp34
-rw-r--r--src/plugins/platforms/eglfs/qeglfswindow.h2
-rw-r--r--src/plugins/platforms/ios/qioseventdispatcher.h1
-rw-r--r--src/plugins/platforms/ios/qioseventdispatcher.mm21
-rw-r--r--src/plugins/platforms/ios/qiosmenu.h4
-rw-r--r--src/plugins/platforms/ios/qiosmenu.mm39
-rw-r--r--src/plugins/platforms/ios/qiostextresponder.mm187
-rw-r--r--src/plugins/platforms/ios/qiostheme.mm2
-rw-r--r--src/plugins/platforms/ios/qiosviewcontroller.mm9
-rw-r--r--src/plugins/platforms/offscreen/qoffscreencommon.cpp4
-rw-r--r--src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.cpp2
-rw-r--r--src/plugins/platforms/windows/openglblacklists/default.json14
-rw-r--r--src/plugins/platforms/windows/qwindowseglcontext.cpp2
-rw-r--r--src/plugins/platforms/windows/qwindowseglcontext.h2
-rw-r--r--src/plugins/platforms/windows/qwindowsguieventdispatcher.cpp4
-rw-r--r--src/plugins/platforms/windows/qwindowsmime.cpp6
-rw-r--r--src/plugins/platforms/windows/qwindowsopengltester.cpp4
-rw-r--r--src/plugins/platforms/winrt/qwinrtmessagedialoghelper.cpp78
-rw-r--r--src/plugins/platforms/winrt/qwinrttheme.cpp4
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.cpp2
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.h2
-rw-r--r--src/plugins/platforms/xcb/qxcbcursor.cpp45
-rw-r--r--src/plugins/platforms/xcb/qxcbcursor.h2
-rw-r--r--src/plugins/platforms/xcb/qxcbdrag.cpp43
-rw-r--r--src/plugins/platforms/xcb/qxcbdrag.h2
-rw-r--r--src/plugins/platforms/xcb/qxcbscreen.cpp11
-rw-r--r--src/plugins/platforms/xcb/qxcbscreen.h3
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.cpp20
-rw-r--r--src/printsupport/dialogs/qprintdialog_unix.cpp2
-rw-r--r--src/printsupport/doc/qtprintsupport.qdocconf2
-rw-r--r--src/printsupport/kernel/qpaintengine_alpha.cpp10
-rw-r--r--src/printsupport/kernel/qprintengine_win.cpp27
-rw-r--r--src/sql/doc/qtsql.qdocconf2
-rw-r--r--src/sql/drivers/mysql/qsql_mysql.cpp29
-rw-r--r--src/sql/drivers/oci/qsql_oci.cpp2
-rw-r--r--src/sql/drivers/sqlite/qsql_sqlite.cpp2
-rw-r--r--src/testlib/doc/snippets/code/src_qtestlib_qtestcase.cpp2
-rw-r--r--src/testlib/qtestblacklist.cpp6
-rw-r--r--src/testlib/qtestcase.cpp15
-rw-r--r--src/testlib/qtestkeyboard.h6
-rw-r--r--src/testlib/qtestlog.cpp17
-rw-r--r--src/testlib/qtestlog_p.h5
-rw-r--r--src/testlib/qxmltestlogger.cpp9
-rw-r--r--src/testlib/qxmltestlogger_p.h3
-rw-r--r--src/testlib/testlib.pro2
-rw-r--r--src/tools/qdoc/codemarker.cpp7
-rw-r--r--src/tools/qdoc/codemarker.h2
-rw-r--r--src/tools/qdoc/config.cpp6
-rw-r--r--src/tools/qdoc/cppcodemarker.cpp20
-rw-r--r--src/tools/qdoc/cppcodeparser.cpp2
-rw-r--r--src/tools/qdoc/doc/examples/examples.qdoc6
-rw-r--r--src/tools/qdoc/doc/qdoc-manual-contextcmds.qdoc2
-rw-r--r--src/tools/qdoc/doc/qdoc-manual-qdocconf.qdoc6
-rw-r--r--src/tools/qdoc/doc/qdoc-manual-topiccmds.qdoc6
-rw-r--r--src/tools/qdoc/doc/qdoc-minimum-qdocconf.qdoc2
-rw-r--r--src/tools/qdoc/generator.cpp6
-rw-r--r--src/tools/qdoc/htmlgenerator.cpp22
-rw-r--r--src/tools/qdoc/node.h2
-rw-r--r--src/tools/qdoc/puredocparser.cpp2
-rw-r--r--src/tools/qdoc/qdocdatabase.cpp14
-rw-r--r--src/tools/qdoc/qdocindexfiles.cpp108
-rw-r--r--src/tools/qdoc/qdocindexfiles.h3
-rw-r--r--src/tools/qdoc/qmlvisitor.cpp2
-rw-r--r--src/tools/uic/qclass_lib_map.h8
-rw-r--r--src/widgets/accessible/accessible.pri12
-rw-r--r--src/widgets/accessible/complexwidgets.cpp2
-rw-r--r--src/widgets/accessible/complexwidgets_p.h (renamed from src/widgets/accessible/complexwidgets.h)11
-rw-r--r--src/widgets/accessible/itemviews.cpp2
-rw-r--r--src/widgets/accessible/itemviews_p.h (renamed from src/widgets/accessible/itemviews.h)11
-rw-r--r--src/widgets/accessible/qaccessiblemenu.cpp2
-rw-r--r--src/widgets/accessible/qaccessiblemenu_p.h (renamed from src/widgets/accessible/qaccessiblemenu.h)11
-rw-r--r--src/widgets/accessible/qaccessiblewidgetfactory.cpp12
-rw-r--r--src/widgets/accessible/qaccessiblewidgetfactory_p.h11
-rw-r--r--src/widgets/accessible/qaccessiblewidgets.cpp2
-rw-r--r--src/widgets/accessible/qaccessiblewidgets_p.h (renamed from src/widgets/accessible/qaccessiblewidgets.h)11
-rw-r--r--src/widgets/accessible/rangecontrols.cpp4
-rw-r--r--src/widgets/accessible/rangecontrols_p.h (renamed from src/widgets/accessible/rangecontrols.h)11
-rw-r--r--src/widgets/accessible/simplewidgets.cpp2
-rw-r--r--src/widgets/accessible/simplewidgets_p.h (renamed from src/widgets/accessible/simplewidgets.h)11
-rw-r--r--src/widgets/dialogs/qcolordialog.cpp8
-rw-r--r--src/widgets/dialogs/qdialog.cpp7
-rw-r--r--src/widgets/dialogs/qfiledialog.cpp24
-rw-r--r--src/widgets/dialogs/qfilesystemmodel.cpp2
-rw-r--r--src/widgets/dialogs/qmessagebox.cpp7
-rw-r--r--src/widgets/dialogs/qprogressdialog.cpp3
-rw-r--r--src/widgets/dialogs/qwizard.cpp2
-rw-r--r--src/widgets/doc/images/filedialogurls.pngbin29132 -> 26724 bytes
-rw-r--r--src/widgets/doc/qtwidgets.qdocconf2
-rw-r--r--src/widgets/doc/snippets/filedialogurls.cpp4
-rw-r--r--src/widgets/doc/src/qtwidgets-examples.qdoc2
-rw-r--r--src/widgets/doc/src/widgets-and-layouts/layout.qdoc2
-rw-r--r--src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc2
-rw-r--r--src/widgets/itemviews/qabstractitemdelegate.cpp12
-rw-r--r--src/widgets/itemviews/qlistview.cpp6
-rw-r--r--src/widgets/itemviews/qtableview.cpp2
-rw-r--r--src/widgets/itemviews/qtablewidget.cpp12
-rw-r--r--src/widgets/itemviews/qtreewidget.cpp2
-rw-r--r--src/widgets/kernel/qgesturemanager.cpp5
-rw-r--r--src/widgets/kernel/qgesturemanager_p.h2
-rw-r--r--src/widgets/kernel/qopenglwidget.cpp25
-rw-r--r--src/widgets/kernel/qwhatsthis.cpp2
-rw-r--r--src/widgets/kernel/qwidget.cpp10
-rw-r--r--src/widgets/kernel/qwidgetsvariant.cpp2
-rw-r--r--src/widgets/styles/qmacstyle_mac.mm2
-rw-r--r--src/widgets/util/qcompleter.cpp6
-rw-r--r--src/widgets/util/qscroller.cpp6
-rw-r--r--src/widgets/util/qsystemtrayicon.cpp2
-rw-r--r--src/widgets/widgets/qabstractbutton.cpp8
-rw-r--r--src/widgets/widgets/qcalendarwidget.cpp5
-rw-r--r--src/widgets/widgets/qcombobox.cpp15
-rw-r--r--src/widgets/widgets/qdatetimeedit.cpp2
-rw-r--r--src/widgets/widgets/qeffects.cpp2
-rw-r--r--src/widgets/widgets/qmenu.cpp45
-rw-r--r--src/widgets/widgets/qmenubar.cpp12
-rw-r--r--src/xml/doc/qtxml.qdocconf2
-rw-r--r--src/xml/doc/snippets/rsslisting/handler.cpp2
-rw-r--r--src/xml/doc/snippets/simpleparse/main.cpp2
-rw-r--r--src/xml/sax/qxml.cpp2
-rw-r--r--tests/auto/corelib/global/qnumeric/tst_qnumeric.cpp4
-rw-r--r--tests/auto/corelib/io/qdir/tst_qdir.cpp69
-rw-r--r--tests/auto/corelib/io/qfile/BLACKLIST5
-rw-r--r--tests/auto/corelib/io/qfile/tst_qfile.cpp286
-rw-r--r--tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp98
-rw-r--r--tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp13
-rw-r--r--tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp1
-rw-r--r--tests/auto/corelib/io/qprocess/BLACKLIST3
-rw-r--r--tests/auto/corelib/io/qprocess/fileWriterProcess/main.cpp14
-rw-r--r--tests/auto/corelib/io/qprocess/testDetached/main.cpp3
-rw-r--r--tests/auto/corelib/io/qprocess/testExitCodes/main.cpp4
-rw-r--r--tests/auto/corelib/io/qprocess/tst_qprocess.cpp475
-rw-r--r--tests/auto/corelib/io/qsavefile/tst_qsavefile.cpp22
-rw-r--r--tests/auto/corelib/io/qsettings/tst_qsettings.cpp2
-rw-r--r--tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp9
-rw-r--r--tests/auto/corelib/io/qstorageinfo/tst_qstorageinfo.cpp4
-rw-r--r--tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp1
-rw-r--r--tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp2
-rw-r--r--tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp5
-rw-r--r--tests/auto/corelib/kernel/qmetaproperty/tst_qmetaproperty.cpp57
-rw-r--r--tests/auto/corelib/kernel/qobject/tst_qobject.cpp4
-rw-r--r--tests/auto/corelib/kernel/qsocketnotifier/tst_qsocketnotifier.cpp73
-rw-r--r--tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp24
-rw-r--r--tests/auto/corelib/mimetypes/qmimedatabase/invalid-magic1.xml9
-rw-r--r--tests/auto/corelib/mimetypes/qmimedatabase/invalid-magic2.xml9
-rw-r--r--tests/auto/corelib/mimetypes/qmimedatabase/invalid-magic3.xml9
-rw-r--r--tests/auto/corelib/mimetypes/qmimedatabase/testdata.qrc3
-rw-r--r--tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp93
-rw-r--r--tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.h6
-rw-r--r--tests/auto/corelib/thread/qfuturewatcher/tst_qfuturewatcher.cpp13
-rw-r--r--[-rwxr-xr-x]tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp0
-rw-r--r--tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp1
-rw-r--r--tests/auto/corelib/tools/qlinkedlist/tst_qlinkedlist.cpp16
-rw-r--r--tests/auto/corelib/tools/qset/tst_qset.cpp16
-rw-r--r--tests/auto/corelib/tools/qsharedpointer/externaltests.cpp1
-rw-r--r--tests/auto/corelib/tools/qstring/tst_qstring.cpp16
-rw-r--r--tests/auto/corelib/tools/qversionnumber/qversionnumber.pro3
-rw-r--r--tests/auto/dbus/qdbusmarshall/tst_qdbusmarshall.cpp6
-rw-r--r--tests/auto/gui/image/qimagereader/tst_qimagereader.cpp2
-rw-r--r--tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp10
-rw-r--r--tests/auto/gui/kernel/kernel.pro2
-rw-r--r--tests/auto/gui/kernel/noqteventloop/noqteventloop.pro8
-rw-r--r--tests/auto/gui/kernel/noqteventloop/tst_noqteventloop.cpp271
-rw-r--r--tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp16
-rw-r--r--tests/auto/gui/painting/qpainter/tst_qpainter.cpp3
-rw-r--r--tests/auto/gui/painting/qpdfwriter/tst_qpdfwriter.cpp6
-rw-r--r--tests/auto/gui/text/qfontmetrics/tst_qfontmetrics.cpp12
-rw-r--r--tests/auto/gui/util/qdesktopservices/tst_qdesktopservices.cpp5
-rw-r--r--tests/auto/network/access/qabstractnetworkcache/tst_qabstractnetworkcache.cpp3
-rw-r--r--tests/auto/network/access/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp54
-rw-r--r--tests/auto/network/access/qnetworkaccessmanager/tst_qnetworkaccessmanager.cpp31
-rw-r--r--tests/auto/network/access/qnetworkdiskcache/tst_qnetworkdiskcache.cpp2
-rw-r--r--tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp7
-rw-r--r--tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp67
-rw-r--r--tests/auto/other/languagechange/tst_languagechange.cpp2
-rw-r--r--tests/auto/other/qaccessibilitylinux/qaccessibilitylinux.pro3
-rw-r--r--tests/auto/other/qaccessibilitylinux/tst_qaccessibilitylinux.cpp34
-rw-r--r--tests/auto/other/qprocess_and_guieventloop/tst_qprocess_and_guieventloop.cpp7
-rw-r--r--tests/auto/testlib/selftests/expected_crashes_3.txt1
-rw-r--r--tests/auto/testlib/selftests/tst_selftests.cpp26
-rw-r--r--tests/auto/tools/uic/tst_uic.cpp1
-rw-r--r--tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp8
-rw-r--r--tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp19
-rw-r--r--tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp6
-rw-r--r--tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp24
-rw-r--r--tests/auto/widgets/itemviews/qtablewidget/tst_qtablewidget.cpp19
-rw-r--r--tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp46
-rw-r--r--tests/auto/widgets/util/qundogroup/tst_qundogroup.cpp8
-rw-r--r--tests/auto/widgets/util/qundostack/tst_qundostack.cpp8
-rw-r--r--tools/configure/Makefile.mingw2
-rw-r--r--tools/configure/configureapp.cpp36
-rw-r--r--tools/configure/configureapp.h2
-rwxr-xr-xutil/unicode/writingSystems.sh2
591 files changed, 6469 insertions, 3533 deletions
diff --git a/bin/syncqt.pl b/bin/syncqt.pl
index 3b3e127e86..13cf78a4ab 100755
--- a/bin/syncqt.pl
+++ b/bin/syncqt.pl
@@ -1149,9 +1149,12 @@ if($check_includes) {
$header = 0 if($header eq $_);
}
if($header) {
+ # We need both $public_header and $private_header because QPA headers count as neither
my $public_header = $header;
+ my $private_header = 0;
if($public_header =~ /_p.h$/ || $public_header =~ /_pch.h$/) {
$public_header = 0;
+ $private_header = $header =~ /_p.h$/ && $subdir !~ /3rdparty/
} elsif (isQpaHeader($public_header)) {
$public_header = 0;
} else {
@@ -1169,43 +1172,50 @@ if($check_includes) {
}
my $iheader = $subdir . "/" . $header;
- if($public_header) {
- if(open(F, "<$iheader")) {
- my $qt_begin_namespace_found = 0;
- my $qt_end_namespace_found = 0;
- my $qt_namespace_suffix = "";
- my $line;
- my $stop_processing = 0;
- while($line = <F>) {
- chomp $line;
- my $output_line = 1;
- if($line =~ /^ *\# *pragma (qt_no_included_check|qt_sync_stop_processing)/) {
- $stop_processing = 1;
- last;
- } elsif($line =~ /^ *\# *include/) {
- my $include = $line;
- if($line =~ /<.*>/) {
- $include =~ s,.*<(.*)>.*,$1,;
- } elsif($line =~ /".*"/) {
- $include =~ s,.*"(.*)".*,$1,;
- } else {
- $include = 0;
- }
- if($include) {
+ if (open(F, "<$iheader")) {
+ my $qt_begin_namespace_found = 0;
+ my $qt_end_namespace_found = 0;
+ my $qt_namespace_suffix = "";
+ my $line;
+ my $stop_processing = 0;
+ my $we_mean_it = 0;
+ while ($line = <F>) {
+ chomp $line;
+ my $output_line = 1;
+ if ($line =~ /^ *\# *pragma (qt_no_included_check|qt_sync_stop_processing)/) {
+ $stop_processing = 1;
+ last;
+ } elsif ($line =~ /^ *\# *include/) {
+ my $include = $line;
+ if ($line =~ /<.*>/) {
+ $include =~ s,.*<(.*)>.*,$1,;
+ } elsif ($line =~ /".*"/) {
+ $include =~ s,.*"(.*)".*,$1,;
+ } else {
+ $include = 0;
+ }
+ if ($include) {
+ if ($public_header) {
for my $trylib (keys(%modules)) {
if(-e "$out_basedir/include/$trylib/$include") {
print "$lib: WARNING: $iheader includes $include when it should include $trylib/$include\n";
}
}
}
- } elsif ($header_skip_qt_begin_namespace_test == 0 and $line =~ /^QT_BEGIN_NAMESPACE(_[A-Z_]+)?\s*$/) {
+ }
+ } elsif (!$private_header) {
+ if ($header_skip_qt_begin_namespace_test == 0 and $line =~ /^QT_BEGIN_NAMESPACE(_[A-Z_]+)?\s*$/) {
$qt_namespace_suffix = defined($1) ? $1 : "";
$qt_begin_namespace_found = 1;
} elsif ($header_skip_qt_begin_namespace_test == 0 and $line =~ /^QT_END_NAMESPACE$qt_namespace_suffix\s*$/) {
$qt_end_namespace_found = 1;
}
+ } elsif ($line =~ "^// We mean it.") {
+ ++$we_mean_it;
}
+ }
+ if ($public_header) {
if ($header_skip_qt_begin_namespace_test == 0 and $stop_processing == 0) {
if ($qt_begin_namespace_found == 0) {
print "$lib: WARNING: $iheader does not include QT_BEGIN_NAMESPACE\n";
@@ -1215,9 +1225,11 @@ if($check_includes) {
print "$lib: WARNING: $iheader has QT_BEGIN_NAMESPACE$qt_namespace_suffix but no QT_END_NAMESPACE$qt_namespace_suffix\n";
}
}
-
- close(F);
+ } elsif ($private_header) {
+ print "$lib: WARNING: $iheader does not have the \"We mean it.\" warning\n" if (!$we_mean_it);
}
+
+ close(F);
}
}
}
diff --git a/config.tests/qpa/eglfs-egldevice/eglfs-egldevice.cpp b/config.tests/qpa/eglfs-egldevice/eglfs-egldevice.cpp
new file mode 100644
index 0000000000..06809b2624
--- /dev/null
+++ b/config.tests/qpa/eglfs-egldevice/eglfs-egldevice.cpp
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the config.tests of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// Test both EGLDevice/Output/Stream and DRM as we only use them in combination.
+//
+// Other KMS/DRM tests relying on pkgconfig for libdrm are not suitable since
+// some systems do not use pkgconfig for the graphics stuff.
+
+#include <stdlib.h>
+#include <stdint.h>
+#include <EGL/egl.h>
+#include <EGL/eglext.h>
+#include <xf86drm.h>
+#include <xf86drmMode.h>
+
+int main(int, char **)
+{
+ EGLDeviceEXT device = 0;
+ EGLStreamKHR stream = 0;
+ EGLOutputLayerEXT layer = 0;
+ drmModeCrtcPtr currentMode = drmModeGetCrtc(0, 0);
+ return EGL_DRM_CRTC_EXT;
+}
diff --git a/config.tests/qpa/eglfs-egldevice/eglfs-egldevice.pro b/config.tests/qpa/eglfs-egldevice/eglfs-egldevice.pro
new file mode 100644
index 0000000000..87214abc7a
--- /dev/null
+++ b/config.tests/qpa/eglfs-egldevice/eglfs-egldevice.pro
@@ -0,0 +1,12 @@
+SOURCES = eglfs-egldevice.cpp
+
+for(p, QMAKE_LIBDIR_EGL) {
+ exists($$p):LIBS += -L$$p
+}
+
+INCLUDEPATH += $$QMAKE_INCDIR_EGL
+LIBS += $$QMAKE_LIBS_EGL
+
+LIBS += -ldrm
+
+CONFIG -= qt
diff --git a/config.tests/qpa/eglfs-mali-2/eglfs-mali-2.cpp b/config.tests/qpa/eglfs-mali-2/eglfs-mali-2.cpp
new file mode 100644
index 0000000000..1914d6452b
--- /dev/null
+++ b/config.tests/qpa/eglfs-mali-2/eglfs-mali-2.cpp
@@ -0,0 +1,44 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the config.tests of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <EGL/egl.h>
+#include <GLES2/gl2.h>
+
+int main(int, char **)
+{
+ EGLDisplay dpy = 0;
+ EGLContext ctx = 0;
+ mali_native_window *w = 0;
+ eglDestroyContext(dpy, ctx);
+ return 0;
+}
diff --git a/config.tests/qpa/eglfs-mali-2/eglfs-mali-2.pro b/config.tests/qpa/eglfs-mali-2/eglfs-mali-2.pro
new file mode 100644
index 0000000000..85bcf6484a
--- /dev/null
+++ b/config.tests/qpa/eglfs-mali-2/eglfs-mali-2.pro
@@ -0,0 +1,5 @@
+SOURCES = eglfs-mali-2.cpp
+
+CONFIG -= qt
+
+LIBS += -lEGL -lGLESv2
diff --git a/config.tests/qpa/gbm/gbm.cpp b/config.tests/qpa/gbm/gbm.cpp
new file mode 100644
index 0000000000..d4f211163d
--- /dev/null
+++ b/config.tests/qpa/gbm/gbm.cpp
@@ -0,0 +1,44 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the config.tests of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <stdlib.h>
+#include <stdint.h>
+extern "C" {
+#include <gbm.h>
+}
+
+int main(int, char **)
+{
+ gbm_surface *surface = 0;
+ return 0;
+}
diff --git a/config.tests/qpa/gbm/gbm.pro b/config.tests/qpa/gbm/gbm.pro
new file mode 100644
index 0000000000..19177062a8
--- /dev/null
+++ b/config.tests/qpa/gbm/gbm.pro
@@ -0,0 +1,4 @@
+SOURCES = gbm.cpp
+CONFIG += link_pkgconfig
+PKGCONFIG += gbm
+CONFIG -= qt
diff --git a/config.tests/qpa/kms/kms.cpp b/config.tests/qpa/kms/kms.cpp
index 64c11158c5..ac0c281386 100644
--- a/config.tests/qpa/kms/kms.cpp
+++ b/config.tests/qpa/kms/kms.cpp
@@ -32,17 +32,14 @@
****************************************************************************/
#include <stdlib.h>
+#include <stdint.h>
extern "C" {
-#include <gbm.h>
#include <xf86drmMode.h>
#include <xf86drm.h>
}
-#include <EGL/egl.h>
-#include <GLES2/gl2.h>
int main(int, char **)
{
- // Check for gbm_surface which is quite a recent addition.
- gbm_surface *surface = 0;
+ drmModeCrtcPtr currentMode = drmModeGetCrtc(0, 0);
return 0;
}
diff --git a/config.tests/qpa/kms/kms.pro b/config.tests/qpa/kms/kms.pro
index 618063dbb9..1fb73677e7 100644
--- a/config.tests/qpa/kms/kms.pro
+++ b/config.tests/qpa/kms/kms.pro
@@ -1,4 +1,4 @@
SOURCES = kms.cpp
CONFIG += link_pkgconfig
-PKGCONFIG += libdrm libudev egl gbm glesv2
+PKGCONFIG += libdrm libudev
CONFIG -= qt
diff --git a/config.tests/unix/gstreamer/gstreamer.cpp b/config.tests/unix/gstreamer/gstreamer.cpp
index cc61498787..ae8200f093 100644
--- a/config.tests/unix/gstreamer/gstreamer.cpp
+++ b/config.tests/unix/gstreamer/gstreamer.cpp
@@ -37,6 +37,5 @@
int main(int, char**)
{
- gst_is_initialized();
return 0;
}
diff --git a/configure b/configure
index 1ee33b22f9..24fa60f41a 100755
--- a/configure
+++ b/configure
@@ -318,7 +318,7 @@ macSDKify()
val=$(echo $sdk_val $(echo $val | cut -s -d ' ' -f 2-))
echo "$var=$val"
;;
- QMAKE_CFLAGS=*|QMAKE_CXXFLAGS=*|QMAKE_OBJECTIVE_CFLAGS=*)
+ QMAKE_CFLAGS=*|QMAKE_CXXFLAGS=*)
echo "$line -isysroot $sysroot $version_min_flag"
;;
QMAKE_LFLAGS=*)
@@ -682,9 +682,11 @@ CFG_XCB_XLIB=auto
CFG_XCB_GLX=no
CFG_EGLFS=auto
CFG_EGLFS_BRCM=no
+CFG_EGLFS_EGLDEVICE=no
CFG_EGLFS_MALI=no
CFG_EGLFS_VIV=no
CFG_DIRECTFB=auto
+CFG_GBM=auto
CFG_LINUXFB=auto
CFG_KMS=auto
CFG_MIRCLIENT=auto
@@ -1811,6 +1813,13 @@ while [ "$#" -gt 0 ]; do
UNKNOWN_OPT=yes
fi
;;
+ gbm)
+ if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
+ CFG_GBM="$VAL"
+ else
+ UNKNOWN_OPT=yes
+ fi
+ ;;
linuxfb)
if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
CFG_LINUXFB="$VAL"
@@ -1970,7 +1979,8 @@ while [ "$#" -gt 0 ]; do
if [ "$VAL" = "no" ] || [ "$VAL" = "linked" ] || [ "$VAL" = "runtime" ]; then
CFG_DBUS="$VAL"
elif [ "$VAL" = "yes" ]; then
- CFG_DBUS="runtime"
+ # keep as auto, we'll auto-detect whether to go linked or runtime later
+ CFG_DBUS=auto
else
UNKNOWN_OPT=yes
fi
@@ -1982,6 +1992,13 @@ while [ "$#" -gt 0 ]; do
UNKNOWN_OPT=yes
fi
;;
+ dbus-runtime)
+ if [ "$VAL" = "yes" ]; then
+ CFG_DBUS="runtime"
+ else
+ UNKNOWN_OPT=yes
+ fi
+ ;;
nis)
if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
CFG_NIS="$VAL"
@@ -2616,8 +2633,8 @@ Additional options:
-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.
+ + -dbus-linked ....... Compile the Qt D-Bus module and link to libdbus-1.
+ -dbus-runtime ...... Compile the Qt D-Bus module and dynamically load libdbus-1.
-reduce-relocations ..... Reduce relocations in the libraries through extra
linker optimizations (Qt/X11 and Qt for Embedded Linux only;
@@ -2643,8 +2660,11 @@ Additional options:
-no-eglfs .......... Do not compile EGLFS (EGL Full Screen/Single Surface) support.
* -eglfs ............. Compile EGLFS support.
- -no-kms ............ Do not compile EGLFS KMS backend.
- * -kms ............... Compile EGLFS KMS backend.
+ -no-kms ............ Do not compile backends for KMS.
+ * -kms ............... Compile backends for KMS.
+
+ -no-gbm ............ Do not compile backends for GBM.
+ * -gbm ............... Compile backends for GBM.
-no-directfb ....... Do not compile DirectFB support.
* -directfb .......... Compile DirectFB support.
@@ -3324,6 +3344,8 @@ fi
# tests that don't need qmake (must be run before displaying help)
#-------------------------------------------------------------------------------
+echo "Running configuration tests (phase 1)..."
+
# detect build style
if [ "$CFG_DEBUG" = "auto" ]; then
if [ "$XPLATFORM_MAC" = "yes" -o "$XPLATFORM_MINGW" = "yes" ]; then
@@ -3596,6 +3618,8 @@ unset tty
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
+echo "Done running configuration tests."
+
#setup the build parts
if [ -z "$CFG_BUILD_PARTS" ]; then
CFG_BUILD_PARTS="$QT_DEFAULT_BUILD_PARTS"
@@ -4097,7 +4121,7 @@ if true; then ###[ '!' -f "$outpath/bin/qmake" ];
fi
fi # Build qmake
-echo "Running configuration tests..."
+echo "Running configuration tests (phase 2)..."
#-------------------------------------------------------------------------------
# create a qt.conf for the Qt build tree itself
@@ -4724,13 +4748,6 @@ if [ "$CFG_EGLFS" = "yes" ]; then
CFG_EGL=yes
fi
-if [ "$CFG_KMS" = "yes" ]; then
- if [ "$CFG_EGL" = "no" ]; then
- echo "The KMS plugin requires EGL support and cannot be built"
- exit 101
- fi
-fi
-
# auto-detect SQL-modules support
for _SQLDR in $CFG_SQL_AVAILABLE; do
case $_SQLDR in
@@ -5043,10 +5060,10 @@ if [ "$CFG_ICONV" != "no" ]; then
fi
# auto-detect libdbus-1 support
-if [ "$CFG_DBUS" = "auto" ]; then
- CFG_DBUS="runtime"
-fi
-if [ "$CFG_DBUS" = "linked" ]; then
+# auto: detect if libdbus-1 is present; if so, link to it
+# linked: fail if libdbus-1 is not present; otherwise link to it
+# runtime: no detection (cannot fail), load libdbus-1 at runtime
+if [ "$CFG_DBUS" = "auto" ] || [ "$CFG_DBUS" = "linked" ]; then
if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --atleast-version="$MIN_DBUS_1_VERSION" dbus-1 2>/dev/null; then
QT_CFLAGS_DBUS=`$PKG_CONFIG --cflags dbus-1 2>/dev/null`
QT_LIBS_DBUS=`$PKG_CONFIG --libs dbus-1 2>/dev/null`
@@ -5062,14 +5079,19 @@ if [ "$CFG_DBUS" = "linked" ]; then
QT_CFLAGS_DBUS=`env -i PATH="$PATH" pkg-config --cflags dbus-1 2>/dev/null`
fi
QMakeVar set QT_HOST_CFLAGS_DBUS "$QT_CFLAGS_DBUS"
+ CFG_DBUS=linked
else
- if [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
+ # Failed to compile the test, so it's an error if CFG_DBUS is "linked"
+ if [ "$CFG_DBUS" = "linked" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
echo "The Qt D-Bus module cannot be enabled because libdbus-1 version $MIN_DBUS_1_VERSION was not found."
[ -z "$PKG_CONFIG" ] && echo " Use of pkg-config is not enabled, maybe you want to pass -pkg-config?"
echo " Turn on verbose messaging (-v) to $0 to see the final report."
echo " If you believe this message is in error you may use the continue"
echo " switch (-continue) to $0 to continue."
exit 101
+ else
+ # CFG_DBUS is "auto" here
+ CFG_DBUS=runtime
fi
fi
fi
@@ -5353,7 +5375,6 @@ ORIG_CFG_XCB="$CFG_XCB"
ORIG_CFG_EGLFS="$CFG_EGLFS"
ORIG_CFG_DIRECTFB="$CFG_DIRECTFB"
ORIG_CFG_LINUXFB="$CFG_LINUXFB"
-ORIG_CFG_KMS="$CFG_KMS"
ORIG_CFG_MIRCLIENT="$CFG_MIRCLIENT"
if [ "$CFG_LIBUDEV" != "no" ]; then
@@ -5608,6 +5629,20 @@ if [ "$CFG_DIRECTFB" != "no" ]; then
fi
fi
+if [ "$CFG_GBM" != "no" ]; then
+ if compileTest qpa/gbm "GBM"; then
+ CFG_GBM=yes
+ elif [ "$CFG_GBM" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
+ echo " GBM support cannot be enabled due to functionality tests!"
+ echo " Turn on verbose messaging (-v) to $0 to see the final report."
+ echo " If you believe this message is in error you may use the continue"
+ echo " switch (-continue) to $0 to continue."
+ exit 101
+ else
+ CFG_GBM=no
+ fi
+fi
+
if [ "$CFG_LINUXFB" != "no" ]; then
if compileTest qpa/linuxfb "LinuxFB"; then
CFG_LINUXFB=yes
@@ -5746,7 +5781,13 @@ if [ "$CFG_EGLFS" != "no" ]; then
else
CFG_EGLFS_BRCM=no
fi
- if compileTest qpa/eglfs-mali "eglfs-mali"; then
+ if compileTest qpa/eglfs-egldevice "eglfs-egldevice"; then
+ CFG_EGLFS_EGLDEVICE=yes
+ else
+ CFG_EGLFS_EGLDEVICE=no
+ fi
+ if compileTest qpa/eglfs-mali "eglfs-mali" \
+ || compileTest qpa/eglfs-mali-2 "eglfs-mali-2"; then
CFG_EGLFS_MALI=yes
else
CFG_EGLFS_MALI=no
@@ -5761,14 +5802,6 @@ if [ "$CFG_EGLFS" != "no" ]; then
fi
fi
-if [ "$CFG_KMS" = "yes" ]; then
- if [ "$CFG_EGL" = "yes" ]; then
- CFG_KMS="yes"
- else
- CFG_KMS="no"
- fi
-fi
-
# Detect accessibility support
if [ "$CFG_ACCESSIBILITY" = "no" ]; then
echo >&2 "Warning: Disabling Accessibility. This version of Qt is unsupported."
@@ -5814,6 +5847,9 @@ if [ "$CFG_DIRECTFB" = "yes" ]; then
QMakeVar set QMAKE_CFLAGS_DIRECTFB "$QMAKE_CFLAGS_DIRECTFB"
QMakeVar set QMAKE_LIBS_DIRECTFB "$QMAKE_LIBS_DIRECTFB"
fi
+if [ "$CFG_GBM" = "yes" ]; then
+ QT_CONFIG="$QT_CONFIG gbm"
+fi
if [ "$CFG_LINUXFB" = "yes" ]; then
QT_CONFIG="$QT_CONFIG linuxfb"
fi
@@ -5825,9 +5861,9 @@ if [ "$CFG_MIRCLIENT" = "yes" ]; then
fi
if [ "$XPLATFORM_MAC" = "no" ] && [ "$XPLATFORM_MINGW" = "no" ] && [ "$XPLATFORM_QNX" = "no" ] && [ "$XPLATFORM_ANDROID" = "no" ] && [ "$XPLATFORM_HAIKU" = "no" ]; then
- if [ "$CFG_XCB" = "no" ] && [ "$CFG_EGLFS" = "no" ] && [ "$CFG_DIRECTFB" = "no" ] && [ "$CFG_LINUXFB" = "no" ] && [ "$CFG_KMS" = "no" ] && [ "$CFG_MIRCLIENT" = "no" ]; then
+ if [ "$CFG_XCB" = "no" ] && [ "$CFG_EGLFS" = "no" ] && [ "$CFG_DIRECTFB" = "no" ] && [ "$CFG_LINUXFB" = "no" ] && [ "$CFG_MIRCLIENT" = "no" ]; then
if [ "$QPA_PLATFORM_GUARD" = "yes" ] &&
- ( [ "$ORIG_CFG_XCB" = "auto" ] || [ "$ORIG_CFG_EGLFS" = "auto" ] || [ "$ORIG_CFG_DIRECTFB" = "auto" ] || [ "$ORIG_CFG_LINUXFB" = "auto" ] || [ "$ORIG_CFG_KMS" = "auto" ] || [ "$ORIG_CFG_MIRCLIENT" = "auto" ] ); then
+ ( [ "$ORIG_CFG_XCB" = "auto" ] || [ "$ORIG_CFG_EGLFS" = "auto" ] || [ "$ORIG_CFG_DIRECTFB" = "auto" ] || [ "$ORIG_CFG_LINUXFB" = "auto" ] || [ "$ORIG_CFG_MIRCLIENT" = "auto" ] ); then
echo "No QPA platform plugin enabled!"
echo " If you really want to build without a QPA platform plugin you must pass"
echo " -no-qpa-platform-guard to configure. Doing this will"
@@ -6193,6 +6229,15 @@ fi
if [ "$CFG_EGLFS_BRCM" = "yes" ]; then
QT_CONFIG="$QT_CONFIG eglfs_brcm"
fi
+if [ "$CFG_EGLFS_EGLDEVICE" = "yes" ]; then
+ QT_CONFIG="$QT_CONFIG eglfs_egldevice"
+fi
+if [ "$CFG_EGLFS" = "yes" ] && [ "$CFG_KMS" = "yes" ] && [ "$CFG_GBM" = "yes" ]; then
+ QT_CONFIG="$QT_CONFIG eglfs_gbm"
+ CFG_EGLFS_GBM="yes"
+else
+ CFG_EGLFS_GBM="no"
+fi
if [ "$CFG_EGLFS_MALI" = "yes" ]; then
QT_CONFIG="$QT_CONFIG eglfs_mali"
fi
@@ -6415,7 +6460,6 @@ if [ '!' -z "$W_FLAGS" ]; then
# add the user defined warning flags
QMakeVar add QMAKE_CFLAGS_WARN_ON "$W_FLAGS"
QMakeVar add QMAKE_CXXFLAGS_WARN_ON "$W_FLAGS"
- QMakeVar add QMAKE_OBJECTIVE_CFLAGS_WARN_ON "$W_FLAGS"
fi
if [ "$XPLATFORM_MINGW" = "yes" ]; then
@@ -6660,6 +6704,8 @@ s/icpc version \([0-9]*\)\.\([0-9]*\)\.\([0-9]*\) .*$/QT_ICC_MAJOR_VERSION=\1; Q
;;
esac
+echo "Done running configuration tests."
+
#-------------------------------------------------------------------------------
# part of configuration information goes into qconfig.h
#-------------------------------------------------------------------------------
@@ -7257,8 +7303,9 @@ report_support " PulseAudio ............." "$CFG_PULSEAUDIO"
report_support " QPA backends:"
report_support " DirectFB ............." "$CFG_DIRECTFB"
report_support " EGLFS ................" "$CFG_EGLFS"
-report_support " EGLFS i.MX6....... ." "$CFG_EGLFS_VIV"
-report_support " EGLFS KMS .........." "$CFG_KMS"
+report_support " EGLFS i.MX6 ........" "$CFG_EGLFS_VIV"
+report_support " EGLFS EGLDevice ...." "$CFG_EGLFS_EGLDEVICE"
+report_support " EGLFS GBM .........." "$CFG_EGLFS_GBM"
report_support " EGLFS Mali ........." "$CFG_EGLFS_MALI"
report_support " EGLFS Raspberry Pi ." "$CFG_EGLFS_BRCM"
report_support " EGLFS X11 .........." "$CFG_EGL_X"
diff --git a/dist/changes-5.5.1 b/dist/changes-5.5.1
new file mode 100644
index 0000000000..0dd5d6c594
--- /dev/null
+++ b/dist/changes-5.5.1
@@ -0,0 +1,140 @@
+Qt 5.5.1 is a bug-fix release. It maintains both forward and backward
+compatibility (source and binary) with Qt 5.5.0.
+
+For more details, refer to the online documentation included in this
+distribution. The documentation is also available online:
+
+ http://doc.qt.io/qt-5.5/
+
+The Qt version 5.5 series is binary compatible with the 5.4.x series.
+Applications compiled for 5.4 will continue to run with 5.5.
+
+Some of the changes listed in this file include issue tracking numbers
+corresponding to tasks in the Qt Bug Tracker:
+
+ http://bugreports.qt.io/
+
+Each of these identifiers can be entered in the bug tracker to obtain more
+information about a particular change.
+
+****************************************************************************
+* Important Behavior Changes *
+****************************************************************************
+
+ - [QTBUG-47316] QDebug output for QStrings changed compared to Qt 5.5.0 to
+ more closely match the output of previous Qt versions. Like Qt 5.5.0,
+ QDebug will escape non-printable characters, the backslash and quote
+ characters, but will no longer escape the printable characters.
+
+****************************************************************************
+* Future Direction Notice *
+****************************************************************************
+
+ - Qt 5.7 will begin requiring certain C++11 features in order to
+ compile. Due to bugs in the Clang compiler that comes with XCode 5.0,
+ that version will not be supported, despite what was noted in the Qt
+ 5.5.0 changelog.
+ The minimum compiler versions for Qt 5.7 release will be:
+ * Clang 3.3 (XCode 5.1 contains version 3.4)
+ * GCC 4.7
+ * Intel C++ Composer XE 2013 SP1 (compiler version 14.0) on Linux and OS X
+ * Intel C++ Composer XE 2016 (compiler version 16.0) on Windows
+ * Microsoft Visual Studio 2012 (compiler version 17.0)
+
+****************************************************************************
+* Library *
+****************************************************************************
+
+QtCore
+------
+
+ - Logging framework:
+ * Fixed a bug that would cause a
+ "%{time boot}" field in the logging framework's pattern to always
+ display the same value, instead of the time since boot.
+
+ - QDate/QTime:
+ * Fixed a minor source-incompatibility between Qt 5.4 and 5.5.0
+ involving sets of functions overloaded on QTime and some integer or
+ QDate and some integer.
+
+ - QDir:
+ * QDir::relativeFilePath() now returns "." instead of an empty string if
+ the given path is the same as the directory.
+
+ - QLoggingCategory:
+ * Fixed behavior of default severity passed to constructor or
+ Q_LOGGING_CATEGORY with regards to QtInfoMsg, which was previously
+ treated as being more severe than QtFatalMsg.
+
+ - QTimeZone:
+ * [QTBUG-47037] Fixed a wrong timezone conversion when the POSIX
+ timezone rule contains a fractional timezone (e.g. VET4:30).
+
+QtNetwork
+---------
+
+ - [QTBUG-47048] Fix HTTP issues with "Unknown Error" and "Connection
+ Closed"
+ [ChangeLog][QtNetwork][Sockets] Read OS/encrypted read buffers when
+ connection closed by server.
+
+QtSql
+-----
+
+ - QSqlDatabase:
+ * [QTBUG-47784][QTBUG-47452] Fixed a bug where opening a connection to a
+ MySQL database using the QMYSQL plugin would always return true even
+ if the server was unreachable. This bug could also lead to crashes
+ depending on the platform used.
+
+QtWidgets
+---------
+
+ - Important behavior changes:
+ * [QTBUG-46379] Tooltips on OS X are now transparent for mouse events.
+
+****************************************************************************
+* Platform Specific Changes *
+****************************************************************************
+
+Windows
+-------
+
+ - Text:
+ * [QTBUG-46963] Fixed crash in DirectWrite engine when constructing a
+ QRawFont from raw font data.
+
+****************************************************************************
+* Compiler Specific Changes *
+****************************************************************************
+
+GCC
+---
+
+ - Fixed a regression introduced Qt 5.5.0 that generated lots of
+ compiler warnings in Qt public headers when using the (deprecated)
+ version 4.5 of GCC.
+
+****************************************************************************
+* Tools *
+****************************************************************************
+
+configure & build system
+------------------------
+
+ - [QTBUG-46125] Fixed misuse of target linker features for host tools.
+ - [QTBUG-46473] QML plugin DLLs now have version information.
+
+qmake
+-----
+
+ - [QTBUG-46824][Darwin] Characters in the bundle identifier which
+ the App Store considers invalid are now substituted.
+ - [QTBUG-47065][Unix] Fixed use of CONFIG+=separate_debug_info together
+ with CONFIG+=unversioned_libname.
+ - [QTBUG-47450][Xcode] Fixed Info.plist creation in shadow builds.
+ - [QTBUG-47775][Darwin] Fixed Info.plist creation when bundle name
+ contains spaces.
+ - [QTBUG-48110][VS] Fixed VS2015 solution file generation.
+ - [MSVC][nmake] Fixed use of VS2013 mkspecs from VS2015 shell.
diff --git a/doc/global/externalsites/qt-webpages.qdoc b/doc/global/externalsites/qt-webpages.qdoc
index 386573e526..e70a441495 100644
--- a/doc/global/externalsites/qt-webpages.qdoc
+++ b/doc/global/externalsites/qt-webpages.qdoc
@@ -41,11 +41,11 @@
\title Qt Licensing Overview
*/
/*!
- \externalpage http://doc.qt.digia.com/qq/
+ \externalpage http://doc.qt.io/archives/qq/
\title Qt Quarterly
*/
/*!
- \externalpage http://doc.qt.digia.com/qq/qq19-plurals.html
+ \externalpage http://doc.qt.io/archives/qq/qq19-plurals.html
\title Qt Quarterly: Plural Form in Translation
*/
/*!
@@ -62,11 +62,11 @@
\title Qt Coding Style
*/
/*!
- \externalpage http://doc.qt.digia.com/qt-eclipse-1.6/index.html
+ \externalpage http://doc.qt.io/archives/qt-eclipse-1.6/index.html
\title Eclipse Plugin
*/
/*!
- \externalpage http://doc.qt.digia.com/qq/qq11-events.html
+ \externalpage http://doc.qt.io/archives/qq/qq11-events.html
\title Qt Quarterly: Another Look at Events
*/
/*!
diff --git a/doc/global/externalsites/qtcreator.qdoc b/doc/global/externalsites/qtcreator.qdoc
index e4dd322ab4..95200622f3 100644
--- a/doc/global/externalsites/qtcreator.qdoc
+++ b/doc/global/externalsites/qtcreator.qdoc
@@ -27,25 +27,17 @@
/*!
\externalpage http://doc.qt.io/qtcreator/creator-deployment-qnx.html
- \title Qt Creator: Deploying Applications to QNX Devices
+ \title Qt Creator: Deploying Applications to QNX Neutrino Devices
*/
/*!
\externalpage http://doc.qt.io/qtcreator/creator-developing-baremetal.html
\title Qt Creator: Connecting Bare Metal Devices
*/
/*!
- \externalpage http://doc.qt.io/qtcreator/creator-developing-bb10.html
- \title Qt Creator: Connecting BlackBerry 10 Devices
-*/
-/*!
\externalpage http://doc.qt.io/qtcreator/creator-developing-qnx.html
\title Qt Creator: Connecting QNX Devices
*/
/*!
- \externalpage http://doc.qt.io/qtcreator/creator-deployment-bb10.html
- \title Qt Creator: Deploying Applications to BlackBerry 10 Devices
-*/
-/*!
\externalpage http://doc.qt.io/qtcreator/creator-developing-generic-linux.html
\title Qt Creator: Connecting Embedded Linux Devices
*/
@@ -98,7 +90,19 @@
\title Qt Creator: Creating Screens
*/
/*!
- \externalpage http://doc.qt.io/qtcreator/creator-qml-application.html
+ \externalpage http://doc.qt.io/qtcreator/creator-qtquick-designer-extensions.html
+ \title Qt Creator: Using Qt Quick Designer Extensions
+*/
+/*!
+ \externalpage http://doc.qt.io/qtcreator/qmldesigner-pathview-editor.html
+ \title Qt Creator: Editing PathView Properties
+*/
+/*!
+ \externalpage http://doc.qt.io/qtcreator/qmldesigner-connections.html
+ \title Qt Creator: Adding Connections
+*/
+/*!
+ \externalpage http://doc.qt.io/qtcreator/qtcreator-transitions-example.html
\title Qt Creator: Creating a Qt Quick Application
*/
/*!
@@ -279,7 +283,7 @@
*/
/*!
\externalpage http://doc.qt.io/qtcreator/creator-testing.html
- \title Qt Creator: Debugging and Analyzing
+ \title Qt Creator: Testing
*/
/*!
\externalpage http://doc.qt.io/qtcreator/creator-deployment.html
@@ -298,10 +302,6 @@
\title Qt Creator: Designing User Interfaces
*/
/*!
- \externalpage http://doc.qt.io/qtcreator/creator-publish-ovi.html
- \title Qt Creator: Publishing
-*/
-/*!
\externalpage http://doc.qt.io/qtcreator/creator-glossary.html
\title Qt Creator: Glossary
*/
@@ -500,6 +500,18 @@
\title Qt Creator: Qt Quick UI Forms
*/
/*!
+ \externalpage http://doc.qt.io/qtcreator/qtcreator-uiforms-example.html
+ \title Qt Creator: Using Qt Quick UI Forms
+*/
+/*!
\externalpage http://doc.qt.io/qtcreator/creator-clang-static-analyzer.html
\title Qt Creator: Using Clang Static Analyzer
*/
+/*!
+ \externalpage http://doc.qt.io/qtcreator/creator-cpu-usage-analyzer.html
+ \title Qt Creator: Analyzing CPU Usage
+*/
+/*!
+ \externalpage http://doc.qt.io/qtcreator/creator-autotest.html
+ \title Qt Creator: Running Autotests
+*/
diff --git a/doc/global/fileextensions.qdocconf b/doc/global/fileextensions.qdocconf
index 88e51595f1..ca036619f1 100644
--- a/doc/global/fileextensions.qdocconf
+++ b/doc/global/fileextensions.qdocconf
@@ -2,7 +2,7 @@ naturallanguage = en
outputencoding = UTF-8
sourceencoding = UTF-8
-examples.fileextensions = "*.cpp *.h *.js *.xq *.svg *.xml *.ui *.qhp *.qhcp *.qml *.css"
+examples.fileextensions = "*.cpp *.h *.js *.xq *.svg *.xml *.ui *.qhp *.qhcp *.qml *.css *.glsl"
examples.imageextensions = "*.png *.jpg *.gif"
headers.fileextensions = "*.ch *.h *.h++ *.hh *.hpp *.hxx"
diff --git a/examples/embedded/digiflip/digiflip.cpp b/examples/embedded/digiflip/digiflip.cpp
index 3bb3023caf..af4289efb3 100644
--- a/examples/embedded/digiflip/digiflip.cpp
+++ b/examples/embedded/digiflip/digiflip.cpp
@@ -112,7 +112,7 @@ protected:
QString str = QString::number(n);
if (str.length() == 1)
- str.prepend("0");
+ str.prepend('0');
QFont font;
font.setFamily("Helvetica");
diff --git a/examples/gui/openglwindow/main.cpp b/examples/gui/openglwindow/main.cpp
index 6ab05176a6..d79ecd6510 100644
--- a/examples/gui/openglwindow/main.cpp
+++ b/examples/gui/openglwindow/main.cpp
@@ -57,8 +57,6 @@ public:
void render() Q_DECL_OVERRIDE;
private:
- GLuint loadShader(GLenum type, const char *source);
-
GLuint m_posAttr;
GLuint m_colAttr;
GLuint m_matrixUniform;
@@ -113,14 +111,6 @@ static const char *fragmentShaderSource =
//! [3]
//! [4]
-GLuint TriangleWindow::loadShader(GLenum type, const char *source)
-{
- GLuint shader = glCreateShader(type);
- glShaderSource(shader, 1, &source, 0);
- glCompileShader(shader);
- return shader;
-}
-
void TriangleWindow::initialize()
{
m_program = new QOpenGLShaderProgram(this);
diff --git a/examples/network/doc/src/torrent.qdoc b/examples/network/doc/src/torrent.qdoc
index 08857f02d3..9576e08cfa 100644
--- a/examples/network/doc/src/torrent.qdoc
+++ b/examples/network/doc/src/torrent.qdoc
@@ -35,37 +35,4 @@
supported by the Qt Network APIs.
\image torrent-example.png
-
- \section1 License Information
-
- The implementation of the US Secure Hash Algorithm 1 (SHA1) in this example is
- derived from the original description in \l{http://www.rfc-editor.org/rfc/rfc3174.txt}{RFC 3174}.
-
- \legalese
- Copyright (C) The Internet Society (2001). All Rights Reserved.
-
- This document and translations of it may be copied and furnished to
- others, and derivative works that comment on or otherwise explain it
- or assist in its implementation may be prepared, copied, published
- and distributed, in whole or in part, without restriction of any
- kind, provided that the above copyright notice and this paragraph are
- included on all such copies and derivative works. However, this
- document itself may not be modified in any way, such as by removing
- the copyright notice or references to the Internet Society or other
- Internet organizations, except as needed for the purpose of
- developing Internet standards in which case the procedures for
- copyrights defined in the Internet Standards process must be
- followed, or as required to translate it into languages other than
- English.
-
- The limited permissions granted above are perpetual and will not be
- revoked by the Internet Society or its successors or assigns.
-
- This document and the information contained herein is provided on an
- "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
- TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
- BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
- HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
- MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
- \endlegalese
*/
diff --git a/examples/network/torrent/filemanager.cpp b/examples/network/torrent/filemanager.cpp
index b4e921b0a5..58330014cf 100644
--- a/examples/network/torrent/filemanager.cpp
+++ b/examples/network/torrent/filemanager.cpp
@@ -219,8 +219,8 @@ bool FileManager::generateFiles()
QString prefix;
if (!destinationPath.isEmpty()) {
prefix = destinationPath;
- if (!prefix.endsWith("/"))
- prefix += "/";
+ if (!prefix.endsWith('/'))
+ prefix += '/';
QDir dir;
if (!dir.mkpath(prefix)) {
errString = tr("Failed to create directory %1").arg(prefix);
@@ -261,13 +261,13 @@ bool FileManager::generateFiles()
if (!destinationPath.isEmpty()) {
prefix = destinationPath;
- if (!prefix.endsWith("/"))
- prefix += "/";
+ if (!prefix.endsWith('/'))
+ prefix += '/';
}
if (!metaInfo.name().isEmpty()) {
prefix += metaInfo.name();
- if (!prefix.endsWith("/"))
- prefix += "/";
+ if (!prefix.endsWith('/'))
+ prefix += '/';
}
if (!dir.mkpath(prefix)) {
errString = tr("Failed to create directory %1").arg(prefix);
diff --git a/examples/network/torrent/metainfo.cpp b/examples/network/torrent/metainfo.cpp
index cca52c7e7e..52e7afe43a 100644
--- a/examples/network/torrent/metainfo.cpp
+++ b/examples/network/torrent/metainfo.cpp
@@ -96,7 +96,7 @@ bool MetaInfo::parse(const QByteArray &data)
QByteArray path;
foreach (QVariant p, pathElements) {
if (!path.isEmpty())
- path += "/";
+ path += '/';
path += p.toByteArray();
}
diff --git a/examples/opengl/contextinfo/widget.cpp b/examples/opengl/contextinfo/widget.cpp
index c318accf87..2d36fe4265 100644
--- a/examples/opengl/contextinfo/widget.cpp
+++ b/examples/opengl/contextinfo/widget.cpp
@@ -299,7 +299,7 @@ void Widget::printFormat(const QSurfaceFormat &format)
QString opts;
for (size_t i = 0; i < sizeof(options) / sizeof(Option); ++i)
if (format.testOption(options[i].option))
- opts += QString::fromLatin1(options[i].str) + QStringLiteral(" ");
+ opts += QString::fromLatin1(options[i].str) + QLatin1Char(' ');
m_output->append(tr("Options: %1").arg(opts));
for (size_t i = 0; i < sizeof(renderables) / sizeof(Renderable); ++i)
diff --git a/examples/qtconcurrent/wordcount/main.cpp b/examples/qtconcurrent/wordcount/main.cpp
index f45f2820c7..7f6d0f43ba 100644
--- a/examples/qtconcurrent/wordcount/main.cpp
+++ b/examples/qtconcurrent/wordcount/main.cpp
@@ -61,10 +61,10 @@ QStringList findFiles(const QString &startDir, QStringList filters)
QDir dir(startDir);
foreach (QString file, dir.entryList(filters, QDir::Files))
- names += startDir + "/" + file;
+ names += startDir + '/' + file;
foreach (QString subdir, dir.entryList(QDir::AllDirs | QDir::NoDotAndDotDot))
- names += findFiles(startDir + "/" + subdir, filters);
+ names += findFiles(startDir + '/' + subdir, filters);
return names;
}
@@ -81,7 +81,7 @@ WordCount singleThreadedWordCount(QStringList files)
f.open(QIODevice::ReadOnly);
QTextStream textStream(&f);
while (textStream.atEnd() == false)
- foreach(QString word, textStream.readLine().split(" "))
+ foreach (const QString &word, textStream.readLine().split(' '))
wordCount[word] += 1;
}
@@ -100,7 +100,7 @@ WordCount countWords(const QString &file)
WordCount wordCount;
while (textStream.atEnd() == false)
- foreach (QString word, textStream.readLine().split(" "))
+ foreach (const QString &word, textStream.readLine().split(' '))
wordCount[word] += 1;
return wordCount;
diff --git a/examples/sql/masterdetail/dialog.cpp b/examples/sql/masterdetail/dialog.cpp
index 5518707f58..3171acc448 100644
--- a/examples/sql/masterdetail/dialog.cpp
+++ b/examples/sql/masterdetail/dialog.cpp
@@ -153,7 +153,7 @@ void Dialog::addTracks(int albumId, QStringList tracks)
for (int i = 0; i < tracks.count(); i++) {
QString trackNumber = QString::number(i);
if (i < 10)
- trackNumber.prepend("0");
+ trackNumber.prepend('0');
QDomText textNode = albumDetails.createTextNode(tracks.at(i));
diff --git a/examples/sql/querymodel/customsqlmodel.cpp b/examples/sql/querymodel/customsqlmodel.cpp
index 5966802abe..4cdfdd6ae3 100644
--- a/examples/sql/querymodel/customsqlmodel.cpp
+++ b/examples/sql/querymodel/customsqlmodel.cpp
@@ -53,7 +53,7 @@ QVariant CustomSqlModel::data(const QModelIndex &index, int role) const
QVariant value = QSqlQueryModel::data(index, role);
if (value.isValid() && role == Qt::DisplayRole) {
if (index.column() == 0)
- return value.toString().prepend("#");
+ return value.toString().prepend('#');
else if (index.column() == 2)
return value.toString().toUpper();
}
diff --git a/examples/widgets/desktop/systray/doc/images/systemtray-editor.png b/examples/widgets/desktop/systray/doc/images/systemtray-editor.png
new file mode 100644
index 0000000000..fb15dea8cb
--- /dev/null
+++ b/examples/widgets/desktop/systray/doc/images/systemtray-editor.png
Binary files differ
diff --git a/examples/widgets/desktop/systray/doc/images/systemtray-example.png b/examples/widgets/desktop/systray/doc/images/systemtray-example.png
new file mode 100644
index 0000000000..98b5c8133e
--- /dev/null
+++ b/examples/widgets/desktop/systray/doc/images/systemtray-example.png
Binary files differ
diff --git a/examples/widgets/desktop/systray/doc/src/systray.qdoc b/examples/widgets/desktop/systray/doc/src/systray.qdoc
new file mode 100644
index 0000000000..074012b6a7
--- /dev/null
+++ b/examples/widgets/desktop/systray/doc/src/systray.qdoc
@@ -0,0 +1,183 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU 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$
+**
+****************************************************************************/
+
+/*!
+ \example desktop/systray
+ \title System Tray Icon Example
+
+
+ The System Tray Icon example shows how to add an icon with a menu
+ and popup messages to a desktop environment's system tray.
+
+ \image systemtray-example.png Screenshot of the System Tray Icon.
+
+ Modern operating systems usually provide a special area on the
+ desktop, called the system tray or notification area, where
+ long-running applications can display icons and short messages.
+
+ This example consists of one single class, \c Window, providing
+ the main application window (i.e., an editor for the system tray
+ icon) and the associated icon.
+
+ \image systemtray-editor.png
+
+ The editor allows the user to choose the preferred icon as well as
+ set the balloon message's type and duration. The user can also
+ edit the message's title and body. Finally, the editor provide a
+ checkbox controlling whether the icon is actually shown in the
+ system tray, or not.
+
+ \section1 Window Class Definition
+
+ The \c Window class inherits QWidget:
+
+ \snippet desktop/systray/window.h 0
+
+ We implement several private slots to respond to user
+ interaction. The other private functions are only convenience
+ functions provided to simplify the constructor.
+
+ The tray icon is an instance of the QSystemTrayIcon class. To
+ check whether a system tray is present on the user's desktop, call
+ the static QSystemTrayIcon::isSystemTrayAvailable()
+ function. Associated with the icon, we provide a menu containing
+ the typical \gui minimize, \gui maximize, \gui restore and \gui
+ quit actions. We reimplement the QWidget::setVisible() function to
+ update the tray icon's menu whenever the editor's appearance
+ changes, e.g., when maximizing or minimizing the main application
+ window.
+
+ Finally, we reimplement QWidget's \l {QWidget::}{closeEvent()}
+ function to be able to inform the user (when closing the editor
+ window) that the program will keep running in the system tray
+ until the user chooses the \gui Quit entry in the icon's context
+ menu.
+
+ \section1 Window Class Implementation
+
+ When constructing the editor widget, we first create the various
+ editor elements before we create the actual system tray icon:
+
+ \snippet desktop/systray/window.cpp 0
+
+ We ensure that the application responds to user input by
+ connecting most of the editor's input widgets (including the
+ system tray icon) to the application's private slots. But note the
+ visibility checkbox; its \l {QCheckBox::}{toggled()} signal is
+ connected to the \e {icon}'s \l {QSystemTrayIcon::}{setVisible()}
+ function instead.
+
+ \snippet desktop/systray/window.cpp 3
+
+ The \c setIcon() slot is triggered whenever the current index in
+ the icon combobox changes, i.e., whenever the user chooses another
+ icon in the editor. Note that it is also called when the user
+ activates the tray icon with the left mouse button, triggering the
+ icon's \l {QSystemTrayIcon::}{activated()} signal. We will come
+ back to this signal shortly.
+
+ The QSystemTrayIcon::setIcon() function sets the \l
+ {QSystemTrayIcon::}{icon} property that holds the actual system
+ tray icon. On Windows, the system tray icon size is 16x16; on X11,
+ the preferred size is 22x22. The icon will be scaled to the
+ appropriate size as necessary.
+
+ Note that on X11, due to a limitation in the system tray
+ specification, mouse clicks on transparent areas in the icon are
+ propagated to the system tray. If this behavior is unacceptable,
+ we suggest using an icon with no transparency.
+
+ \snippet desktop/systray/window.cpp 4
+
+ Whenever the user activates the system tray icon, it emits its \l
+ {QSystemTrayIcon::}{activated()} signal passing the triggering
+ reason as parameter. QSystemTrayIcon provides the \l
+ {QSystemTrayIcon::}{ActivationReason} enum to describe how the
+ icon was activated.
+
+ In the constructor, we connected our icon's \l
+ {QSystemTrayIcon::}{activated()} signal to our custom \c
+ iconActivated() slot: If the user has clicked the icon using the
+ left mouse button, this function changes the icon image by
+ incrementing the icon combobox's current index, triggering the \c
+ setIcon() slot as mentioned above. If the user activates the icon
+ using the middle mouse button, it calls the custom \c
+ showMessage() slot:
+
+ \snippet desktop/systray/window.cpp 5
+
+ When the \e showMessage() slot is triggered, we first retrieve the
+ message icon depending on the currently chosen message type. The
+ QSystemTrayIcon::MessageIcon enum describes the icon that is shown
+ when a balloon message is displayed. Then we call
+ QSystemTrayIcon's \l {QSystemTrayIcon::}{showMessage()} function
+ to show the message with the title, body, and icon for the time
+ specified in milliseconds.
+
+ OS X users note: The Growl notification system must be
+ installed for QSystemTrayIcon::showMessage() to display messages.
+
+ QSystemTrayIcon also has the corresponding, \l {QSystemTrayIcon::}
+ {messageClicked()} signal, which is emitted when the user clicks a
+ message displayed by \l {QSystemTrayIcon::}{showMessage()}.
+
+ \snippet desktop/systray/window.cpp 6
+
+ In the constructor, we connected the \l
+ {QSystemTrayIcon::}{messageClicked()} signal to our custom \c
+ messageClicked() slot that simply displays a message using the
+ QMessageBox class.
+
+ QMessageBox provides a modal dialog with a short message, an icon,
+ and buttons laid out depending on the current style. It supports
+ four severity levels: "Question", "Information", "Warning" and
+ "Critical". The easiest way to pop up a message box in Qt is to
+ call one of the associated static functions, e.g.,
+ QMessageBox::information().
+
+ As we mentioned earlier, we reimplement a couple of QWidget's
+ virtual functions:
+
+ \snippet desktop/systray/window.cpp 1
+
+ Our reimplementation of the QWidget::setVisible() function updates
+ the tray icon's menu whenever the editor's appearance changes,
+ e.g., when maximizing or minimizing the main application window,
+ before calling the base class implementation.
+
+ \snippet desktop/systray/window.cpp 2
+
+ We have reimplemented the QWidget::closeEvent() event handler to
+ receive widget close events, showing the above message to the
+ users when they are closing the editor window.
+
+ In addition to the functions and slots discussed above, we have
+ also implemented several convenience functions to simplify the
+ constructor: \c createIconGroupBox(), \c createMessageGroupBox(),
+ \c createActions() and \c createTrayIcon(). See the \l
+ {desktop/systray/window.cpp}{window.cpp} file for details.
+*/
diff --git a/examples/widgets/dialogs/classwizard/classwizard.cpp b/examples/widgets/dialogs/classwizard/classwizard.cpp
index c913d7b592..d3e366efe6 100644
--- a/examples/widgets/dialogs/classwizard/classwizard.cpp
+++ b/examples/widgets/dialogs/classwizard/classwizard.cpp
@@ -79,31 +79,31 @@ void ClassWizard::accept()
if (field("comment").toBool()) {
block += "/*\n";
- block += " " + header.toLatin1() + "\n";
+ block += " " + header.toLatin1() + '\n';
block += "*/\n";
- block += "\n";
+ block += '\n';
}
if (field("protect").toBool()) {
- block += "#ifndef " + macroName + "\n";
- block += "#define " + macroName + "\n";
- block += "\n";
+ block += "#ifndef " + macroName + '\n';
+ block += "#define " + macroName + '\n';
+ block += '\n';
}
if (field("includeBase").toBool()) {
- block += "#include " + baseInclude + "\n";
- block += "\n";
+ block += "#include " + baseInclude + '\n';
+ block += '\n';
}
block += "class " + className;
if (!baseClass.isEmpty())
block += " : public " + baseClass;
- block += "\n";
+ block += '\n';
block += "{\n";
/* qmake ignore Q_OBJECT */
if (field("qobjectMacro").toBool()) {
block += " Q_OBJECT\n";
- block += "\n";
+ block += '\n';
}
block += "public:\n";
@@ -115,7 +115,7 @@ void ClassWizard::accept()
block += " " + className + "();\n";
if (field("copyCtor").toBool()) {
block += " " + className + "(const " + className + " &other);\n";
- block += "\n";
+ block += '\n';
block += " " + className + " &operator=" + "(const " + className
+ " &other);\n";
}
@@ -123,11 +123,11 @@ void ClassWizard::accept()
block += "};\n";
if (field("protect").toBool()) {
- block += "\n";
+ block += '\n';
block += "#endif\n";
}
- QFile headerFile(outputDir + "/" + header);
+ QFile headerFile(outputDir + '/' + header);
if (!headerFile.open(QFile::WriteOnly | QFile::Text)) {
QMessageBox::warning(0, QObject::tr("Simple Wizard"),
QObject::tr("Cannot write file %1:\n%2")
@@ -141,12 +141,12 @@ void ClassWizard::accept()
if (field("comment").toBool()) {
block += "/*\n";
- block += " " + implementation.toLatin1() + "\n";
+ block += " " + implementation.toLatin1() + '\n';
block += "*/\n";
- block += "\n";
+ block += '\n';
}
block += "#include \"" + header.toLatin1() + "\"\n";
- block += "\n";
+ block += '\n';
if (field("qobjectCtor").toBool()) {
block += className + "::" + className + "(QObject *parent)\n";
@@ -171,7 +171,7 @@ void ClassWizard::accept()
block += "{\n";
block += " *this = other;\n";
block += "}\n";
- block += "\n";
+ block += '\n';
block += className + " &" + className + "::operator=(const "
+ className + " &other)\n";
block += "{\n";
@@ -183,7 +183,7 @@ void ClassWizard::accept()
}
}
- QFile implementationFile(outputDir + "/" + implementation);
+ QFile implementationFile(outputDir + '/' + implementation);
if (!implementationFile.open(QFile::WriteOnly | QFile::Text)) {
QMessageBox::warning(0, QObject::tr("Simple Wizard"),
QObject::tr("Cannot write file %1:\n%2")
@@ -356,9 +356,9 @@ void CodeStylePage::initializePage()
if (baseClass.isEmpty()) {
baseIncludeLineEdit->clear();
} else if (QRegExp("Q[A-Z].*").exactMatch(baseClass)) {
- baseIncludeLineEdit->setText("<" + baseClass + ">");
+ baseIncludeLineEdit->setText('<' + baseClass + '>');
} else {
- baseIncludeLineEdit->setText("\"" + baseClass.toLower() + ".h\"");
+ baseIncludeLineEdit->setText('"' + baseClass.toLower() + ".h\"");
}
}
//! [16]
diff --git a/examples/widgets/doc/src/codeeditor.qdoc b/examples/widgets/doc/src/codeeditor.qdoc
index 645854a58c..6c9e5921b8 100644
--- a/examples/widgets/doc/src/codeeditor.qdoc
+++ b/examples/widgets/doc/src/codeeditor.qdoc
@@ -192,6 +192,6 @@
fetched with QTextBlock::userData(). Matching parentheses can be
highlighted with an extra selection. The "Matching Parentheses
with QSyntaxHighlighter" article in Qt Quarterly 31 implements
- this. You find it here: \l{http://doc.qt.digia.com/qq/}.
+ this. You find it here: \l{http://doc.qt.io/archives/qq/}.
*/
diff --git a/examples/widgets/doc/src/syntaxhighlighter.qdoc b/examples/widgets/doc/src/syntaxhighlighter.qdoc
index 2b283afe5e..7d33299c81 100644
--- a/examples/widgets/doc/src/syntaxhighlighter.qdoc
+++ b/examples/widgets/doc/src/syntaxhighlighter.qdoc
@@ -248,7 +248,7 @@
It is possible to implement parenthesis matching with
QSyntaxHighlighter. The "Matching Parentheses with
QSyntaxHighlighter" article in Qt Quarterly 31
- (\l{http://doc.qt.digia.com/qq/}) implements this. We also have
+ (\l{http://doc.qt.io/archives/qq/}) implements this. We also have
the \l{Code Editor Example}, which shows how to implement line
numbers and how to highlight the current line.
diff --git a/examples/widgets/draganddrop/draggableicons/main.cpp b/examples/widgets/draganddrop/draggableicons/main.cpp
index 165f71dbf7..44b4f848bf 100644
--- a/examples/widgets/draganddrop/draggableicons/main.cpp
+++ b/examples/widgets/draganddrop/draggableicons/main.cpp
@@ -50,11 +50,10 @@ int main(int argc, char *argv[])
QApplication app(argc, argv);
QWidget mainWidget;
- QHBoxLayout *horizontalLayout = new QHBoxLayout;
+ QHBoxLayout *horizontalLayout = new QHBoxLayout(&mainWidget);
horizontalLayout->addWidget(new DragWidget);
horizontalLayout->addWidget(new DragWidget);
- mainWidget.setLayout(horizontalLayout);
mainWidget.setWindowTitle(QObject::tr("Draggable Icons"));
mainWidget.show();
diff --git a/examples/widgets/draganddrop/draggabletext/draggabletext.pro b/examples/widgets/draganddrop/draggabletext/draggabletext.pro
index 2815be1613..1add2a270e 100644
--- a/examples/widgets/draganddrop/draggabletext/draggabletext.pro
+++ b/examples/widgets/draganddrop/draggabletext/draggabletext.pro
@@ -1,10 +1,8 @@
QT += widgets
-HEADERS = draglabel.h \
- dragwidget.h
+HEADERS = dragwidget.h
RESOURCES = draggabletext.qrc
-SOURCES = draglabel.cpp \
- dragwidget.cpp \
+SOURCES = dragwidget.cpp \
main.cpp
# install
diff --git a/examples/widgets/draganddrop/draggabletext/draglabel.cpp b/examples/widgets/draganddrop/draggabletext/draglabel.cpp
deleted file mode 100644
index 4e741fb6c8..0000000000
--- a/examples/widgets/draganddrop/draggabletext/draglabel.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** 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 The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "draglabel.h"
-
-DragLabel::DragLabel(const QString &text, QWidget *parent)
- : QLabel(text, parent)
-{
- setAutoFillBackground(true);
- setFrameShape(QFrame::Panel);
- setFrameShadow(QFrame::Raised);
-}
diff --git a/examples/widgets/draganddrop/draggabletext/draglabel.h b/examples/widgets/draganddrop/draggabletext/draglabel.h
deleted file mode 100644
index 8d2c31aa1d..0000000000
--- a/examples/widgets/draganddrop/draggabletext/draglabel.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** 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 The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef DRAGLABEL_H
-#define DRAGLABEL_H
-
-#include <QLabel>
-
-QT_BEGIN_NAMESPACE
-class QDragEnterEvent;
-class QDragMoveEvent;
-class QFrame;
-QT_END_NAMESPACE
-
-class DragLabel : public QLabel
-{
-public:
- DragLabel(const QString &text, QWidget *parent);
-};
-
-#endif // DRAGLABEL_H
diff --git a/examples/widgets/draganddrop/draggabletext/dragwidget.cpp b/examples/widgets/draganddrop/draggabletext/dragwidget.cpp
index 3b8bca3277..36c4df2e43 100644
--- a/examples/widgets/draganddrop/draggabletext/dragwidget.cpp
+++ b/examples/widgets/draganddrop/draggabletext/dragwidget.cpp
@@ -40,13 +40,23 @@
#include <QtWidgets>
-#include "draglabel.h"
#include "dragwidget.h"
+static QLabel *createDragLabel(const QString &text, QWidget *parent)
+{
+ QLabel *label = new QLabel(text, parent);
+ label->setAutoFillBackground(true);
+ label->setFrameShape(QFrame::Panel);
+ label->setFrameShadow(QFrame::Raised);
+ return label;
+}
+
+static QString hotSpotMimeDataKey() { return QStringLiteral("application/x-hotspot"); }
+
DragWidget::DragWidget(QWidget *parent)
: QWidget(parent)
{
- QFile dictionaryFile(":/dictionary/words.txt");
+ QFile dictionaryFile(QStringLiteral(":/dictionary/words.txt"));
dictionaryFile.open(QIODevice::ReadOnly);
QTextStream inputStream(&dictionaryFile);
@@ -57,7 +67,7 @@ DragWidget::DragWidget(QWidget *parent)
QString word;
inputStream >> word;
if (!word.isEmpty()) {
- DragLabel *wordLabel = new DragLabel(word, this);
+ QLabel *wordLabel = createDragLabel(word, this);
wordLabel->move(x, y);
wordLabel->show();
wordLabel->setAttribute(Qt::WA_DeleteOnClose);
@@ -69,12 +79,6 @@ DragWidget::DragWidget(QWidget *parent)
}
}
- /*
- QPalette newPalette = palette();
- newPalette.setColor(QPalette::Window, Qt::white);
- setPalette(newPalette);
- */
-
setAcceptDrops(true);
setMinimumSize(400, qMax(200, y));
setWindowTitle(tr("Draggable Text"));
@@ -98,19 +102,19 @@ void DragWidget::dropEvent(QDropEvent *event)
{
if (event->mimeData()->hasText()) {
const QMimeData *mime = event->mimeData();
- QStringList pieces = mime->text().split(QRegExp("\\s+"),
+ QStringList pieces = mime->text().split(QRegularExpression(QStringLiteral("\\s+")),
QString::SkipEmptyParts);
QPoint position = event->pos();
QPoint hotSpot;
- QList<QByteArray> hotSpotPos = mime->data("application/x-hotspot").split(' ');
+ QByteArrayList hotSpotPos = mime->data(hotSpotMimeDataKey()).split(' ');
if (hotSpotPos.size() == 2) {
hotSpot.setX(hotSpotPos.first().toInt());
hotSpot.setY(hotSpotPos.last().toInt());
}
- foreach (QString piece, pieces) {
- DragLabel *newLabel = new DragLabel(piece, this);
+ foreach (const QString &piece, pieces) {
+ QLabel *newLabel = createDragLabel(piece, this);
newLabel->move(position - hotSpot);
newLabel->show();
newLabel->setAttribute(Qt::WA_DeleteOnClose);
@@ -127,18 +131,15 @@ void DragWidget::dropEvent(QDropEvent *event)
} else {
event->ignore();
}
- foreach (QObject *child, children()) {
- if (child->inherits("QWidget")) {
- QWidget *widget = static_cast<QWidget *>(child);
- if (!widget->isVisible())
- widget->deleteLater();
- }
+ foreach (QWidget *widget, findChildren<QWidget *>()) {
+ if (!widget->isVisible())
+ widget->deleteLater();
}
}
void DragWidget::mousePressEvent(QMouseEvent *event)
{
- QLabel *child = static_cast<QLabel*>(childAt(event->pos()));
+ QLabel *child = qobject_cast<QLabel*>(childAt(event->pos()));
if (!child)
return;
@@ -146,8 +147,8 @@ void DragWidget::mousePressEvent(QMouseEvent *event)
QMimeData *mimeData = new QMimeData;
mimeData->setText(child->text());
- mimeData->setData("application/x-hotspot",
- QByteArray::number(hotSpot.x()) + " " + QByteArray::number(hotSpot.y()));
+ mimeData->setData(hotSpotMimeDataKey(),
+ QByteArray::number(hotSpot.x()) + ' ' + QByteArray::number(hotSpot.y()));
QPixmap pixmap(child->size());
child->render(&pixmap);
diff --git a/examples/widgets/draganddrop/dropsite/droparea.cpp b/examples/widgets/draganddrop/dropsite/droparea.cpp
index d3d2bb10ca..0016434cc3 100644
--- a/examples/widgets/draganddrop/dropsite/droparea.cpp
+++ b/examples/widgets/draganddrop/dropsite/droparea.cpp
@@ -92,10 +92,8 @@ void DropArea::dropEvent(QDropEvent *event)
} else if (mimeData->hasUrls()) {
QList<QUrl> urlList = mimeData->urls();
QString text;
- for (int i = 0; i < urlList.size() && i < 32; ++i) {
- QString url = urlList.at(i).path();
- text += url + QString("\n");
- }
+ for (int i = 0; i < urlList.size() && i < 32; ++i)
+ text += urlList.at(i).path() + QLatin1Char('\n');
setText(text);
} else {
setText(tr("Cannot display data"));
diff --git a/examples/widgets/draganddrop/dropsite/dropsitewindow.cpp b/examples/widgets/draganddrop/dropsite/dropsitewindow.cpp
index 5f0e689fc9..5d48be1c34 100644
--- a/examples/widgets/draganddrop/dropsite/dropsitewindow.cpp
+++ b/examples/widgets/draganddrop/dropsite/dropsitewindow.cpp
@@ -55,8 +55,8 @@ DropSiteWindow::DropSiteWindow()
//! [constructor part2]
dropArea = new DropArea;
- connect(dropArea, SIGNAL(changed(const QMimeData*)),
- this, SLOT(updateFormatsTable(const QMimeData*)));
+ connect(dropArea, &DropArea::changed,
+ this, &DropSiteWindow::updateFormatsTable);
//! [constructor part2]
//! [constructor part3]
@@ -78,17 +78,16 @@ DropSiteWindow::DropSiteWindow()
buttonBox->addButton(clearButton, QDialogButtonBox::ActionRole);
buttonBox->addButton(quitButton, QDialogButtonBox::RejectRole);
- connect(quitButton, SIGNAL(pressed()), this, SLOT(close()));
- connect(clearButton, SIGNAL(pressed()), dropArea, SLOT(clear()));
+ connect(quitButton, &QAbstractButton::pressed, this, &QWidget::close);
+ connect(clearButton, &QAbstractButton::pressed, dropArea, &DropArea::clear);
//! [constructor part4]
//! [constructor part5]
- QVBoxLayout *mainLayout = new QVBoxLayout;
+ QVBoxLayout *mainLayout = new QVBoxLayout(this);
mainLayout->addWidget(abstractLabel);
mainLayout->addWidget(dropArea);
mainLayout->addWidget(formatsTable);
mainLayout->addWidget(buttonBox);
- setLayout(mainLayout);
setWindowTitle(tr("Drop Site"));
setMinimumSize(350, 500);
@@ -112,22 +111,18 @@ void DropSiteWindow::updateFormatsTable(const QMimeData *mimeData)
//! [updateFormatsTable() part3]
QString text;
- if (format == "text/plain") {
+ if (format == QLatin1String("text/plain")) {
text = mimeData->text().simplified();
- } else if (format == "text/html") {
+ } else if (format == QLatin1String("text/html")) {
text = mimeData->html().simplified();
- } else if (format == "text/uri-list") {
+ } else if (format == QLatin1String("text/uri-list")) {
QList<QUrl> urlList = mimeData->urls();
for (int i = 0; i < urlList.size() && i < 32; ++i)
- text.append(urlList[i].toString() + " ");
+ text.append(urlList.at(i).toString() + QLatin1Char(' '));
} else {
QByteArray data = mimeData->data(format);
- for (int i = 0; i < data.size() && i < 32; ++i) {
- QString hex = QString("%1").arg(uchar(data[i]), 2, 16,
- QChar('0'))
- .toUpper();
- text.append(hex + " ");
- }
+ for (int i = 0; i < data.size() && i < 32; ++i)
+ text.append(QStringLiteral("%1 ").arg(uchar(data[i]), 2, 16, QLatin1Char('0')).toUpper());
}
//! [updateFormatsTable() part3]
diff --git a/examples/widgets/draganddrop/fridgemagnets/dragwidget.cpp b/examples/widgets/draganddrop/fridgemagnets/dragwidget.cpp
index a591a29994..3a9ab5fa76 100644
--- a/examples/widgets/draganddrop/fridgemagnets/dragwidget.cpp
+++ b/examples/widgets/draganddrop/fridgemagnets/dragwidget.cpp
@@ -43,11 +43,13 @@
#include <QtWidgets>
+static inline QString fridgetMagnetsMimeType() { return QStringLiteral("application/x-fridgemagnet"); }
+
//! [0]
DragWidget::DragWidget(QWidget *parent)
: QWidget(parent)
{
- QFile dictionaryFile(":/dictionary/words.txt");
+ QFile dictionaryFile(QStringLiteral(":/dictionary/words.txt"));
dictionaryFile.open(QFile::ReadOnly);
QTextStream inputStream(&dictionaryFile);
//! [0]
@@ -74,7 +76,6 @@ DragWidget::DragWidget(QWidget *parent)
//! [1]
//! [2]
- //Fridge magnets is used for demoing Qt on S60 and themed backgrounds look better than white
QPalette newPalette = palette();
newPalette.setColor(QPalette::Window, Qt::white);
setPalette(newPalette);
@@ -90,7 +91,7 @@ DragWidget::DragWidget(QWidget *parent)
void DragWidget::dragEnterEvent(QDragEnterEvent *event)
{
//! [4] //! [5]
- if (event->mimeData()->hasFormat("application/x-fridgemagnet")) {
+ if (event->mimeData()->hasFormat(fridgetMagnetsMimeType())) {
if (children().contains(event->source())) {
event->setDropAction(Qt::MoveAction);
event->accept();
@@ -110,7 +111,7 @@ void DragWidget::dragEnterEvent(QDragEnterEvent *event)
//! [8]
void DragWidget::dragMoveEvent(QDragMoveEvent *event)
{
- if (event->mimeData()->hasFormat("application/x-fridgemagnet")) {
+ if (event->mimeData()->hasFormat(fridgetMagnetsMimeType())) {
if (children().contains(event->source())) {
event->setDropAction(Qt::MoveAction);
event->accept();
@@ -128,10 +129,10 @@ void DragWidget::dragMoveEvent(QDragMoveEvent *event)
//! [9]
void DragWidget::dropEvent(QDropEvent *event)
{
- if (event->mimeData()->hasFormat("application/x-fridgemagnet")) {
+ if (event->mimeData()->hasFormat(fridgetMagnetsMimeType())) {
const QMimeData *mime = event->mimeData();
//! [9] //! [10]
- QByteArray itemData = mime->data("application/x-fridgemagnet");
+ QByteArray itemData = mime->data(fridgetMagnetsMimeType());
QDataStream dataStream(&itemData, QIODevice::ReadOnly);
QString text;
@@ -152,11 +153,11 @@ void DragWidget::dropEvent(QDropEvent *event)
}
//! [11] //! [12]
} else if (event->mimeData()->hasText()) {
- QStringList pieces = event->mimeData()->text().split(QRegExp("\\s+"),
+ QStringList pieces = event->mimeData()->text().split(QRegularExpression(QStringLiteral("\\s+")),
QString::SkipEmptyParts);
QPoint position = event->pos();
- foreach (QString piece, pieces) {
+ foreach (const QString &piece, pieces) {
DragLabel *newLabel = new DragLabel(piece, this);
newLabel->move(position);
newLabel->show();
@@ -190,7 +191,7 @@ void DragWidget::mousePressEvent(QMouseEvent *event)
//! [15]
QMimeData *mimeData = new QMimeData;
- mimeData->setData("application/x-fridgemagnet", itemData);
+ mimeData->setData(fridgetMagnetsMimeType(), itemData);
mimeData->setText(child->labelText());
//! [15]
diff --git a/examples/widgets/draganddrop/fridgemagnets/main.cpp b/examples/widgets/draganddrop/fridgemagnets/main.cpp
index edff4486d6..a52ff8cabd 100644
--- a/examples/widgets/draganddrop/fridgemagnets/main.cpp
+++ b/examples/widgets/draganddrop/fridgemagnets/main.cpp
@@ -52,7 +52,7 @@ int main(int argc, char *argv[])
#endif
DragWidget window;
- bool smallScreen = QApplication::arguments().contains("-small-screen");
+ bool smallScreen = QApplication::arguments().contains(QStringLiteral("-small-screen"));
if (smallScreen)
window.showFullScreen();
else
diff --git a/examples/widgets/draganddrop/puzzle/main.cpp b/examples/widgets/draganddrop/puzzle/main.cpp
index 706ebe4d70..e8ecbe37db 100644
--- a/examples/widgets/draganddrop/puzzle/main.cpp
+++ b/examples/widgets/draganddrop/puzzle/main.cpp
@@ -48,7 +48,7 @@ int main(int argc, char *argv[])
QApplication app(argc, argv);
MainWindow window;
- window.openImage(":/images/example.jpg");
+ window.loadImage(QStringLiteral(":/images/example.jpg"));
window.show();
return app.exec();
}
diff --git a/examples/widgets/draganddrop/puzzle/mainwindow.cpp b/examples/widgets/draganddrop/puzzle/mainwindow.cpp
index 0fbdfc3f8d..48e79946e7 100644
--- a/examples/widgets/draganddrop/puzzle/mainwindow.cpp
+++ b/examples/widgets/draganddrop/puzzle/mainwindow.cpp
@@ -55,26 +55,27 @@ MainWindow::MainWindow(QWidget *parent)
setWindowTitle(tr("Puzzle"));
}
-void MainWindow::openImage(const QString &path)
+void MainWindow::openImage()
{
- QString fileName = path;
+ const QString fileName =
+ QFileDialog::getOpenFileName(this, tr("Open Image"), QString(),
+ tr("Image Files (*.png *.jpg *.bmp)"));
- if (fileName.isNull()) {
- fileName = QFileDialog::getOpenFileName(this,
- tr("Open Image"), "", "Image Files (*.png *.jpg *.bmp)");
- }
+ if (!fileName.isEmpty())
+ loadImage(fileName);
+}
- if (!fileName.isEmpty()) {
- QPixmap newImage;
- if (!newImage.load(fileName)) {
- QMessageBox::warning(this, tr("Open Image"),
- tr("The image file could not be loaded."),
- QMessageBox::Cancel);
- return;
- }
- puzzleImage = newImage;
- setupPuzzle();
+void MainWindow::loadImage(const QString &fileName)
+{
+ QPixmap newImage;
+ if (!newImage.load(fileName)) {
+ QMessageBox::warning(this, tr("Open Image"),
+ tr("The image file could not be loaded."),
+ QMessageBox::Close);
+ return;
}
+ puzzleImage = newImage;
+ setupPuzzle();
}
void MainWindow::setCompleted()
@@ -120,19 +121,15 @@ void MainWindow::setupMenus()
{
QMenu *fileMenu = menuBar()->addMenu(tr("&File"));
- QAction *openAction = fileMenu->addAction(tr("&Open..."));
+ QAction *openAction = fileMenu->addAction(tr("&Open..."), this, &MainWindow::openImage);
openAction->setShortcuts(QKeySequence::Open);
- QAction *exitAction = fileMenu->addAction(tr("E&xit"));
+ QAction *exitAction = fileMenu->addAction(tr("E&xit"), qApp, &QCoreApplication::quit);
exitAction->setShortcuts(QKeySequence::Quit);
QMenu *gameMenu = menuBar()->addMenu(tr("&Game"));
- QAction *restartAction = gameMenu->addAction(tr("&Restart"));
-
- connect(openAction, SIGNAL(triggered()), this, SLOT(openImage()));
- connect(exitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
- connect(restartAction, SIGNAL(triggered()), this, SLOT(setupPuzzle()));
+ gameMenu->addAction(tr("&Restart"), this, &MainWindow::setupPuzzle);
}
void MainWindow::setupWidgets()
@@ -144,8 +141,8 @@ void MainWindow::setupWidgets()
piecesList = new PiecesList(puzzleWidget->pieceSize(), this);
- connect(puzzleWidget, SIGNAL(puzzleCompleted()),
- this, SLOT(setCompleted()), Qt::QueuedConnection);
+ connect(puzzleWidget, &PuzzleWidget::puzzleCompleted,
+ this, &MainWindow::setCompleted, Qt::QueuedConnection);
frameLayout->addWidget(piecesList);
frameLayout->addWidget(puzzleWidget);
diff --git a/examples/widgets/draganddrop/puzzle/mainwindow.h b/examples/widgets/draganddrop/puzzle/mainwindow.h
index 093a14472e..b5b7d0d903 100644
--- a/examples/widgets/draganddrop/puzzle/mainwindow.h
+++ b/examples/widgets/draganddrop/puzzle/mainwindow.h
@@ -56,9 +56,10 @@ class MainWindow : public QMainWindow
public:
MainWindow(QWidget *parent = 0);
+ void loadImage(const QString &path);
public slots:
- void openImage(const QString &path = QString());
+ void openImage();
void setupPuzzle();
private slots:
diff --git a/examples/widgets/draganddrop/puzzle/pieceslist.cpp b/examples/widgets/draganddrop/puzzle/pieceslist.cpp
index e60fd0a9ff..fb27aa2304 100644
--- a/examples/widgets/draganddrop/puzzle/pieceslist.cpp
+++ b/examples/widgets/draganddrop/puzzle/pieceslist.cpp
@@ -57,7 +57,7 @@ PiecesList::PiecesList(int pieceSize, QWidget *parent)
void PiecesList::dragEnterEvent(QDragEnterEvent *event)
{
- if (event->mimeData()->hasFormat("image/x-puzzle-piece"))
+ if (event->mimeData()->hasFormat(PiecesList::puzzleMimeType()))
event->accept();
else
event->ignore();
@@ -65,7 +65,7 @@ void PiecesList::dragEnterEvent(QDragEnterEvent *event)
void PiecesList::dragMoveEvent(QDragMoveEvent *event)
{
- if (event->mimeData()->hasFormat("image/x-puzzle-piece")) {
+ if (event->mimeData()->hasFormat(PiecesList::puzzleMimeType())) {
event->setDropAction(Qt::MoveAction);
event->accept();
} else {
@@ -75,8 +75,8 @@ void PiecesList::dragMoveEvent(QDragMoveEvent *event)
void PiecesList::dropEvent(QDropEvent *event)
{
- if (event->mimeData()->hasFormat("image/x-puzzle-piece")) {
- QByteArray pieceData = event->mimeData()->data("image/x-puzzle-piece");
+ if (event->mimeData()->hasFormat(PiecesList::puzzleMimeType())) {
+ QByteArray pieceData = event->mimeData()->data(PiecesList::puzzleMimeType());
QDataStream dataStream(&pieceData, QIODevice::ReadOnly);
QPixmap pixmap;
QPoint location;
@@ -112,7 +112,7 @@ void PiecesList::startDrag(Qt::DropActions /*supportedActions*/)
dataStream << pixmap << location;
QMimeData *mimeData = new QMimeData;
- mimeData->setData("image/x-puzzle-piece", itemData);
+ mimeData->setData(PiecesList::puzzleMimeType(), itemData);
QDrag *drag = new QDrag(this);
drag->setMimeData(mimeData);
diff --git a/examples/widgets/draganddrop/puzzle/pieceslist.h b/examples/widgets/draganddrop/puzzle/pieceslist.h
index 83c1ad8285..07fa504f41 100644
--- a/examples/widgets/draganddrop/puzzle/pieceslist.h
+++ b/examples/widgets/draganddrop/puzzle/pieceslist.h
@@ -51,6 +51,8 @@ public:
explicit PiecesList(int pieceSize, QWidget *parent = 0);
void addPiece(QPixmap pixmap, QPoint location);
+ static QString puzzleMimeType() { return QStringLiteral("image/x-puzzle-piece"); }
+
protected:
void dragEnterEvent(QDragEnterEvent *event) Q_DECL_OVERRIDE;
void dragMoveEvent(QDragMoveEvent *event) Q_DECL_OVERRIDE;
diff --git a/examples/widgets/draganddrop/puzzle/puzzlewidget.cpp b/examples/widgets/draganddrop/puzzle/puzzlewidget.cpp
index 69c0cbf0cc..29052da4fb 100644
--- a/examples/widgets/draganddrop/puzzle/puzzlewidget.cpp
+++ b/examples/widgets/draganddrop/puzzle/puzzlewidget.cpp
@@ -39,6 +39,7 @@
****************************************************************************/
#include "puzzlewidget.h"
+#include "pieceslist.h"
#include <QDrag>
#include <QDragEnterEvent>
@@ -65,7 +66,7 @@ void PuzzleWidget::clear()
void PuzzleWidget::dragEnterEvent(QDragEnterEvent *event)
{
- if (event->mimeData()->hasFormat("image/x-puzzle-piece"))
+ if (event->mimeData()->hasFormat(PiecesList::puzzleMimeType()))
event->accept();
else
event->ignore();
@@ -83,8 +84,8 @@ void PuzzleWidget::dragMoveEvent(QDragMoveEvent *event)
{
QRect updateRect = highlightedRect.united(targetSquare(event->pos()));
- if (event->mimeData()->hasFormat("image/x-puzzle-piece")
- && findPiece(targetSquare(event->pos())) == -1) {
+ if (event->mimeData()->hasFormat(PiecesList::puzzleMimeType())
+ && pieceRects.indexOf(targetSquare(event->pos())) == -1) {
highlightedRect = targetSquare(event->pos());
event->setDropAction(Qt::MoveAction);
@@ -99,10 +100,10 @@ void PuzzleWidget::dragMoveEvent(QDragMoveEvent *event)
void PuzzleWidget::dropEvent(QDropEvent *event)
{
- if (event->mimeData()->hasFormat("image/x-puzzle-piece")
- && findPiece(targetSquare(event->pos())) == -1) {
+ if (event->mimeData()->hasFormat(PiecesList::puzzleMimeType())
+ && pieceRects.indexOf(targetSquare(event->pos())) == -1) {
- QByteArray pieceData = event->mimeData()->data("image/x-puzzle-piece");
+ QByteArray pieceData = event->mimeData()->data(PiecesList::puzzleMimeType());
QDataStream dataStream(&pieceData, QIODevice::ReadOnly);
QRect square = targetSquare(event->pos());
QPixmap pixmap;
@@ -130,19 +131,10 @@ void PuzzleWidget::dropEvent(QDropEvent *event)
}
}
-int PuzzleWidget::findPiece(const QRect &pieceRect) const
-{
- for (int i = 0; i < pieceRects.size(); ++i) {
- if (pieceRect == pieceRects[i])
- return i;
- }
- return -1;
-}
-
void PuzzleWidget::mousePressEvent(QMouseEvent *event)
{
QRect square = targetSquare(event->pos());
- int found = findPiece(square);
+ int found = pieceRects.indexOf(square);
if (found == -1)
return;
@@ -164,7 +156,7 @@ void PuzzleWidget::mousePressEvent(QMouseEvent *event)
dataStream << pixmap << location;
QMimeData *mimeData = new QMimeData;
- mimeData->setData("image/x-puzzle-piece", itemData);
+ mimeData->setData(PiecesList::puzzleMimeType(), itemData);
QDrag *drag = new QDrag(this);
drag->setMimeData(mimeData);
diff --git a/examples/widgets/draganddrop/puzzle/puzzlewidget.h b/examples/widgets/draganddrop/puzzle/puzzlewidget.h
index 6bf264b5e0..eb8a3a29f9 100644
--- a/examples/widgets/draganddrop/puzzle/puzzlewidget.h
+++ b/examples/widgets/draganddrop/puzzle/puzzlewidget.h
@@ -75,7 +75,6 @@ protected:
void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
private:
- int findPiece(const QRect &pieceRect) const;
const QRect targetSquare(const QPoint &position) const;
QList<QPixmap> piecePixmaps;
diff --git a/examples/widgets/gestures/imagegestures/imagewidget.cpp b/examples/widgets/gestures/imagegestures/imagewidget.cpp
index 440eb783c1..28c715c688 100644
--- a/examples/widgets/gestures/imagegestures/imagewidget.cpp
+++ b/examples/widgets/gestures/imagegestures/imagewidget.cpp
@@ -200,7 +200,6 @@ void ImageWidget::openDirectory(const QString &path)
QImage ImageWidget::loadImage(const QString &fileName)
{
- qDebug() << position << files << fileName;
QImageReader reader(fileName);
reader.setAutoTransform(true);
qCDebug(lcExample) << "loading" << QDir::toNativeSeparators(fileName) << position << '/' << files.size();
@@ -230,7 +229,7 @@ void ImageWidget::goNextImage()
prevImage = currentImage;
currentImage = nextImage;
if (position+1 < files.size())
- nextImage = loadImage(path+QLatin1String("/")+files.at(position+1));
+ nextImage = loadImage(path + QLatin1Char('/') + files.at(position+1));
else
nextImage = QImage();
}
@@ -247,7 +246,7 @@ void ImageWidget::goPrevImage()
nextImage = currentImage;
currentImage = prevImage;
if (position > 0)
- prevImage = loadImage(path+QLatin1String("/")+files.at(position-1));
+ prevImage = loadImage(path + QLatin1Char('/') + files.at(position-1));
else
prevImage = QImage();
}
@@ -277,12 +276,12 @@ void ImageWidget::goToImage(int index)
position = index;
if (index > 0)
- prevImage = loadImage(path+QLatin1String("/")+files.at(position-1));
+ prevImage = loadImage(path + QLatin1Char('/') + files.at(position-1));
else
prevImage = QImage();
- currentImage = loadImage(path+QLatin1String("/")+files.at(position));
+ currentImage = loadImage(path + QLatin1Char('/') + files.at(position));
if (position+1 < files.size())
- nextImage = loadImage(path+QLatin1String("/")+files.at(position+1));
+ nextImage = loadImage(path + QLatin1Char('/') + files.at(position+1));
else
nextImage = QImage();
update();
diff --git a/examples/widgets/gestures/imagegestures/imagewidget.h b/examples/widgets/gestures/imagegestures/imagewidget.h
index 1629516c0a..71ad2792d0 100644
--- a/examples/widgets/gestures/imagegestures/imagewidget.h
+++ b/examples/widgets/gestures/imagegestures/imagewidget.h
@@ -77,7 +77,6 @@ private:
void swipeTriggered(QSwipeGesture*);
//! [class definition begin]
- void updateImage();
QImage loadImage(const QString &fileName);
void loadImage();
void goNextImage();
diff --git a/examples/widgets/gestures/imagegestures/mainwidget.h b/examples/widgets/gestures/imagegestures/mainwidget.h
index 20e32d1afb..e37baa398c 100644
--- a/examples/widgets/gestures/imagegestures/mainwidget.h
+++ b/examples/widgets/gestures/imagegestures/mainwidget.h
@@ -57,8 +57,6 @@ public slots:
void openDirectory(const QString &path);
private:
- bool loadImage(const QString &fileName);
-
ImageWidget *imageWidget;
};
diff --git a/examples/widgets/graphicsview/boxes/scene.cpp b/examples/widgets/graphicsview/boxes/scene.cpp
index 48bdcb9d93..c9691704cb 100644
--- a/examples/widgets/graphicsview/boxes/scene.cpp
+++ b/examples/widgets/graphicsview/boxes/scene.cpp
@@ -319,9 +319,9 @@ RenderOptionsDialog::RenderOptionsDialog()
while (++it != tokens.end()) {
m_parameterNames << name;
if (!singleElement) {
- m_parameterNames.back() += "[";
+ m_parameterNames.back() += '[';
m_parameterNames.back() += counter + counterPos;
- m_parameterNames.back() += "]";
+ m_parameterNames.back() += ']';
int j = 8; // position of last digit
++counter[j];
while (j > 0 && counter[j] > '9') {
diff --git a/examples/widgets/itemviews/chart/mainwindow.cpp b/examples/widgets/itemviews/chart/mainwindow.cpp
index 9a3b372233..a148c3036d 100644
--- a/examples/widgets/itemviews/chart/mainwindow.cpp
+++ b/examples/widgets/itemviews/chart/mainwindow.cpp
@@ -124,7 +124,7 @@ void MainWindow::loadFile(const QString &fileName)
if (!line.isEmpty()) {
model->insertRows(row, 1, QModelIndex());
- QStringList pieces = line.split(",", QString::SkipEmptyParts);
+ QStringList pieces = line.split(',', QString::SkipEmptyParts);
model->setData(model->index(row, 0, QModelIndex()),
pieces.value(0));
model->setData(model->index(row, 1, QModelIndex()),
diff --git a/examples/widgets/itemviews/editabletreemodel/treemodel.cpp b/examples/widgets/itemviews/editabletreemodel/treemodel.cpp
index 2903dd7d38..2b12c142cd 100644
--- a/examples/widgets/itemviews/editabletreemodel/treemodel.cpp
+++ b/examples/widgets/itemviews/editabletreemodel/treemodel.cpp
@@ -246,7 +246,7 @@ void TreeModel::setupModelData(const QStringList &lines, TreeItem *parent)
while (number < lines.count()) {
int position = 0;
while (position < lines[number].length()) {
- if (lines[number].mid(position, 1) != " ")
+ if (lines[number].at(position) != ' ')
break;
++position;
}
diff --git a/examples/widgets/itemviews/frozencolumn/main.cpp b/examples/widgets/itemviews/frozencolumn/main.cpp
index cfdf57135c..1292a7f403 100644
--- a/examples/widgets/itemviews/frozencolumn/main.cpp
+++ b/examples/widgets/itemviews/frozencolumn/main.cpp
@@ -54,15 +54,15 @@ int main(int argc, char* argv[])
QFile file(":/grades.txt");
if (file.open(QFile::ReadOnly)) {
QString line = file.readLine(200);
- QStringList list = line.simplified().split(",");
+ QStringList list = line.simplified().split(',');
model->setHorizontalHeaderLabels(list);
int row = 0;
QStandardItem *newItem = 0;
while (file.canReadLine()) {
line = file.readLine(200);
- if (!line.startsWith("#") && line.contains(",")) {
- list= line.simplified().split(",");
+ if (!line.startsWith('#') && line.contains(',')) {
+ list = line.simplified().split(',');
for (int col = 0; col < list.length(); ++col){
newItem = new QStandardItem(list.at(col));
model->setItem(row, col, newItem);
diff --git a/examples/widgets/itemviews/interview/model.cpp b/examples/widgets/itemviews/interview/model.cpp
index ba65144cfa..efbb67486b 100644
--- a/examples/widgets/itemviews/interview/model.cpp
+++ b/examples/widgets/itemviews/interview/model.cpp
@@ -88,7 +88,7 @@ QVariant Model::data(const QModelIndex &index, int role) const
if (!index.isValid())
return QVariant();
if (role == Qt::DisplayRole)
- return QVariant("Item " + QString::number(index.row()) + ":" + QString::number(index.column()));
+ return QVariant("Item " + QString::number(index.row()) + ':' + QString::number(index.column()));
if (role == Qt::DecorationRole) {
if (index.column() == 0)
return iconProvider.icon(QFileIconProvider::Folder);
diff --git a/examples/widgets/itemviews/simpledommodel/dommodel.cpp b/examples/widgets/itemviews/simpledommodel/dommodel.cpp
index f6450abc8b..531957f60b 100644
--- a/examples/widgets/itemviews/simpledommodel/dommodel.cpp
+++ b/examples/widgets/itemviews/simpledommodel/dommodel.cpp
@@ -88,7 +88,7 @@ QVariant DomModel::data(const QModelIndex &index, int role) const
for (int i = 0; i < attributeMap.count(); ++i) {
QDomNode attribute = attributeMap.item(i);
attributes << attribute.nodeName() + "=\""
- +attribute.nodeValue() + "\"";
+ +attribute.nodeValue() + '"';
}
return attributes.join(' ');
case 2:
diff --git a/examples/widgets/itemviews/simpletreemodel/treemodel.cpp b/examples/widgets/itemviews/simpletreemodel/treemodel.cpp
index aaa4685b27..f5cd1a160e 100644
--- a/examples/widgets/itemviews/simpletreemodel/treemodel.cpp
+++ b/examples/widgets/itemviews/simpletreemodel/treemodel.cpp
@@ -180,7 +180,7 @@ void TreeModel::setupModelData(const QStringList &lines, TreeItem *parent)
while (number < lines.count()) {
int position = 0;
while (position < lines[number].length()) {
- if (lines[number].mid(position, 1) != " ")
+ if (lines[number].at(position) != ' ')
break;
position++;
}
diff --git a/examples/widgets/tools/regexp/regexpdialog.cpp b/examples/widgets/tools/regexp/regexpdialog.cpp
index 32df8a4b91..8ed1e790fb 100644
--- a/examples/widgets/tools/regexp/regexpdialog.cpp
+++ b/examples/widgets/tools/regexp/regexpdialog.cpp
@@ -153,8 +153,8 @@ void RegExpDialog::refresh()
QString escaped = pattern;
escaped.replace("\\", "\\\\");
escaped.replace("\"", "\\\"");
- escaped.prepend("\"");
- escaped.append("\"");
+ escaped.prepend('"');
+ escaped.append('"');
escapedPatternLineEdit->setText(escaped);
QRegExp rx(pattern);
diff --git a/examples/widgets/tools/regularexpression/regularexpressiondialog.cpp b/examples/widgets/tools/regularexpression/regularexpressiondialog.cpp
index d40b4b325d..6cddc1f6c1 100644
--- a/examples/widgets/tools/regularexpression/regularexpressiondialog.cpp
+++ b/examples/widgets/tools/regularexpression/regularexpressiondialog.cpp
@@ -111,8 +111,8 @@ void RegularExpressionDialog::refresh()
QString escaped = pattern;
escaped.replace(QLatin1String("\\"), QLatin1String("\\\\"));
escaped.replace(QLatin1String("\""), QLatin1String("\\\""));
- escaped.prepend(QLatin1String("\""));
- escaped.append(QLatin1String("\""));
+ escaped.prepend(QLatin1Char('"'));
+ escaped.append(QLatin1Char('"'));
escapedPatternLineEdit->setText(escaped);
QRegularExpression rx(pattern);
diff --git a/examples/widgets/tools/settingseditor/variantdelegate.cpp b/examples/widgets/tools/settingseditor/variantdelegate.cpp
index f68082c660..fe2391762b 100644
--- a/examples/widgets/tools/settingseditor/variantdelegate.cpp
+++ b/examples/widgets/tools/settingseditor/variantdelegate.cpp
@@ -60,7 +60,7 @@ VariantDelegate::VariantDelegate(QObject *parent)
dateExp.setPattern("([0-9]{,4})-([0-9]{,2})-([0-9]{,2})");
timeExp.setPattern("([0-9]{,2}):([0-9]{,2}):([0-9]{,2})");
- dateTimeExp.setPattern(dateExp.pattern() + "T" + timeExp.pattern());
+ dateTimeExp.setPattern(dateExp.pattern() + 'T' + timeExp.pattern());
}
void VariantDelegate::paint(QPainter *painter,
@@ -217,7 +217,7 @@ void VariantDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
value = QSize(sizeExp.cap(1).toInt(), sizeExp.cap(2).toInt());
break;
case QVariant::StringList:
- value = text.split(",");
+ value = text.split(',');
break;
case QVariant::Time:
{
diff --git a/examples/widgets/tutorials/addressbook/part7/addressbook.cpp b/examples/widgets/tutorials/addressbook/part7/addressbook.cpp
index 6764423d71..2953ecd7de 100644
--- a/examples/widgets/tutorials/addressbook/part7/addressbook.cpp
+++ b/examples/widgets/tutorials/addressbook/part7/addressbook.cpp
@@ -421,23 +421,23 @@ void AddressBook::exportAsVCard()
//! [export function part2]
//! [export function part3]
- out << "BEGIN:VCARD" << "\n";
- out << "VERSION:2.1" << "\n";
- out << "N:" << lastName << ";" << firstName << "\n";
+ out << "BEGIN:VCARD" << '\n';
+ out << "VERSION:2.1" << '\n';
+ out << "N:" << lastName << ';' << firstName << '\n';
if (!nameList.isEmpty())
- out << "FN:" << nameList.join(' ') << "\n";
+ out << "FN:" << nameList.join(' ') << '\n';
else
- out << "FN:" << firstName << "\n";
+ out << "FN:" << firstName << '\n';
//! [export function part3]
//! [export function part4]
address.replace(";", "\\;", Qt::CaseInsensitive);
- address.replace("\n", ";", Qt::CaseInsensitive);
+ address.replace('\n', ";", Qt::CaseInsensitive);
address.replace(",", " ", Qt::CaseInsensitive);
- out << "ADR;HOME:;" << address << "\n";
- out << "END:VCARD" << "\n";
+ out << "ADR;HOME:;" << address << '\n';
+ out << "END:VCARD" << '\n';
QMessageBox::information(this, tr("Export Successful"),
tr("\"%1\" has been exported as a vCard.").arg(name));
diff --git a/examples/widgets/tutorials/modelview/5_edit/mymodel.cpp b/examples/widgets/tutorials/modelview/5_edit/mymodel.cpp
index 5eb677bb9d..c04c77772f 100644
--- a/examples/widgets/tutorials/modelview/5_edit/mymodel.cpp
+++ b/examples/widgets/tutorials/modelview/5_edit/mymodel.cpp
@@ -83,7 +83,7 @@ bool MyModel::setData(const QModelIndex & index, const QVariant & value, int rol
{
for(int col= 0; col < COLS; col++)
{
- result += m_gridData[row][col] + " ";
+ result += m_gridData[row][col] + ' ';
}
}
emit editCompleted( result );
diff --git a/examples/widgets/widgets/calculator/calculator.cpp b/examples/widgets/widgets/calculator/calculator.cpp
index e76011ee0d..87061a9868 100644
--- a/examples/widgets/widgets/calculator/calculator.cpp
+++ b/examples/widgets/widgets/calculator/calculator.cpp
@@ -276,7 +276,7 @@ void Calculator::pointClicked()
{
if (waitingForOperand)
display->setText("0");
- if (!display->text().contains("."))
+ if (!display->text().contains('.'))
display->setText(display->text() + tr("."));
waitingForOperand = false;
}
diff --git a/examples/widgets/widgets/stylesheet/mainwindow.cpp b/examples/widgets/widgets/stylesheet/mainwindow.cpp
index a49c06dfd2..6d84897c77 100644
--- a/examples/widgets/widgets/stylesheet/mainwindow.cpp
+++ b/examples/widgets/widgets/stylesheet/mainwindow.cpp
@@ -67,7 +67,7 @@ void MainWindow::on_aboutAction_triggered()
{
QMessageBox::about(this, tr("About Style sheet"),
tr("The <b>Style Sheet</b> example shows how widgets can be styled "
- "using <a href=\"http://doc.qt.digia.com/4.5/stylesheet.html\">Qt "
+ "using <a href=\"http://doc.qt.io/qt-5/stylesheet.html\">Qt "
"Style Sheets</a>. Click <b>File|Edit Style Sheet</b> to pop up the "
"style editor, and either choose an existing style sheet or design "
"your own."));
diff --git a/examples/xml/htmlinfo/main.cpp b/examples/xml/htmlinfo/main.cpp
index 3869ca5472..1424cfca67 100644
--- a/examples/xml/htmlinfo/main.cpp
+++ b/examples/xml/htmlinfo/main.cpp
@@ -79,7 +79,7 @@ void parseHtmlFile(QTextStream &out, const QString &fileName) {
}
//! [2]
- out << " Title: \"" << title << "\"" << endl
+ out << " Title: \"" << title << '"' << endl
<< " Number of paragraphs: " << paragraphCount << endl
<< " Number of links: " << links.size() << endl
<< " Showing first few links:" << endl;
diff --git a/examples/xml/saxbookmarks/xbelgenerator.cpp b/examples/xml/saxbookmarks/xbelgenerator.cpp
index 24612c132c..5f1ec62e7e 100644
--- a/examples/xml/saxbookmarks/xbelgenerator.cpp
+++ b/examples/xml/saxbookmarks/xbelgenerator.cpp
@@ -81,8 +81,8 @@ QString XbelGenerator::escapedAttribute(const QString &str)
{
QString result = escapedText(str);
result.replace("\"", "&quot;");
- result.prepend("\"");
- result.append("\"");
+ result.prepend(QLatin1Char('"'));
+ result.append(QLatin1Char('"'));
return result;
}
diff --git a/mkspecs/aix-g++-64/qmake.conf b/mkspecs/aix-g++-64/qmake.conf
index 176c437c45..7f620a9577 100644
--- a/mkspecs/aix-g++-64/qmake.conf
+++ b/mkspecs/aix-g++-64/qmake.conf
@@ -5,6 +5,8 @@
MAKEFILE_GENERATOR = UNIX
QMAKE_PLATFORM = aix
+include(../common/unix.conf)
+
QMAKE_COMPILER = gcc
QMAKE_CC = gcc
@@ -67,5 +69,4 @@ QMAKE_OBJCOPY = objcopy
QMAKE_NM = nm -P
QMAKE_RANLIB = ranlib -X64
-include(../common/unix.conf)
load(qt_config)
diff --git a/mkspecs/aix-g++/qmake.conf b/mkspecs/aix-g++/qmake.conf
index 553d9af544..d2f26a1b41 100644
--- a/mkspecs/aix-g++/qmake.conf
+++ b/mkspecs/aix-g++/qmake.conf
@@ -5,6 +5,8 @@
MAKEFILE_GENERATOR = UNIX
QMAKE_PLATFORM = aix
+include(../common/unix.conf)
+
QMAKE_COMPILER = gcc
QMAKE_CC = gcc
@@ -67,5 +69,4 @@ QMAKE_OBJCOPY = objcopy
QMAKE_NM = nm -P
QMAKE_RANLIB =
-include(../common/unix.conf)
load(qt_config)
diff --git a/mkspecs/aix-xlc-64/qmake.conf b/mkspecs/aix-xlc-64/qmake.conf
index 42dbd18b4a..1aea8d81c5 100644
--- a/mkspecs/aix-xlc-64/qmake.conf
+++ b/mkspecs/aix-xlc-64/qmake.conf
@@ -5,6 +5,8 @@
MAKEFILE_GENERATOR = UNIX
QMAKE_PLATFORM = aix
+include(../common/unix.conf)
+
QMAKE_COMPILER = ibm_xlc
QMAKE_CC = xlc
@@ -66,5 +68,4 @@ QMAKE_OBJCOPY = objcopy
QMAKE_NM = nm -P
QMAKE_RANLIB = ranlib -X64
-include(../common/unix.conf)
load(qt_config)
diff --git a/mkspecs/aix-xlc/qmake.conf b/mkspecs/aix-xlc/qmake.conf
index d2de649355..c765d4ff6b 100644
--- a/mkspecs/aix-xlc/qmake.conf
+++ b/mkspecs/aix-xlc/qmake.conf
@@ -5,6 +5,8 @@
MAKEFILE_GENERATOR = UNIX
QMAKE_PLATFORM = aix
+include(../common/unix.conf)
+
QMAKE_COMPILER = ibm_xlc
QMAKE_CC = xlc
@@ -69,5 +71,4 @@ QMAKE_OBJCOPY = objcopy
QMAKE_NM = nm -P
QMAKE_RANLIB = ranlib
-include(../common/unix.conf)
load(qt_config)
diff --git a/mkspecs/common/armcc.conf b/mkspecs/common/armcc.conf
deleted file mode 100644
index a52fefc106..0000000000
--- a/mkspecs/common/armcc.conf
+++ /dev/null
@@ -1,44 +0,0 @@
-#
-# qmake configuration for armcc
-#
-
-QMAKE_COMPILER = armcc
-
-CONFIG += rvct_linker
-QMAKE_CC = armcc
-QMAKE_CFLAGS +=
-QMAKE_CFLAGS_DEPS += -M
-QMAKE_CFLAGS_WARN_ON +=
-QMAKE_CFLAGS_WARN_OFF += -W
-QMAKE_CFLAGS_RELEASE += -O2
-QMAKE_CFLAGS_DEBUG += -g -O0
-QMAKE_CFLAGS_HIDESYMS += --visibility_inlines_hidden
-
-QMAKE_CXX = armcc
-QMAKE_CXXFLAGS += $$QMAKE_CFLAGS --exceptions --exceptions_unwind
-QMAKE_CXXFLAGS_DEPS += $$QMAKE_CFLAGS_DEPS
-QMAKE_CXXFLAGS_WARN_ON += $$QMAKE_CFLAGS_WARN_ON
-QMAKE_CXXFLAGS_WARN_OFF += $$QMAKE_CFLAGS_WARN_OFF
-QMAKE_CXXFLAGS_RELEASE += $$QMAKE_CFLAGS_RELEASE
-QMAKE_CXXFLAGS_DEBUG += $$QMAKE_CFLAGS_DEBUG
-QMAKE_CXXFLAGS_SHLIB += $$QMAKE_CFLAGS_SHLIB
-QMAKE_CXXFLAGS_STATIC_LIB += $$QMAKE_CFLAGS_STATIC_LIB
-QMAKE_CXXFLAGS_YACC += $$QMAKE_CFLAGS_YACC
-QMAKE_CXXFLAGS_HIDESYMS += $$QMAKE_CFLAGS_HIDESYMS
-
-QMAKE_LINK = armlink
-QMAKE_LINK_SHLIB = armlink
-QMAKE_LINK_C = armlink
-QMAKE_LINK_C_SHLIB = armlink
-QMAKE_LFLAGS +=
-QMAKE_LFLAGS_RELEASE +=
-QMAKE_LFLAGS_DEBUG +=
-QMAKE_LFLAGS_APP +=
-QMAKE_LFLAGS_SHLIB +=
-QMAKE_LFLAGS_PLUGIN += $$QMAKE_LFLAGS_SHLIB
-QMAKE_LFLAGS_THREAD +=
-
-QMAKE_AR = armar --create
-QMAKE_LIB = armar --create
-QMAKE_RANLIB =
-
diff --git a/mkspecs/common/clang-mac.conf b/mkspecs/common/clang-mac.conf
index d95e982b14..c616e20b6e 100644
--- a/mkspecs/common/clang-mac.conf
+++ b/mkspecs/common/clang-mac.conf
@@ -7,5 +7,4 @@ QMAKE_OBJCXXFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE
QMAKE_XCODE_GCC_VERSION = com.apple.compilers.llvm.clang.1_0
QMAKE_CXXFLAGS += -stdlib=libc++
-QMAKE_OBJECTIVE_CFLAGS += -stdlib=libc++
QMAKE_LFLAGS += -stdlib=libc++
diff --git a/mkspecs/common/gcc-base-mac.conf b/mkspecs/common/gcc-base-mac.conf
index 747f09ae81..e9bf780ec1 100644
--- a/mkspecs/common/gcc-base-mac.conf
+++ b/mkspecs/common/gcc-base-mac.conf
@@ -12,14 +12,6 @@ include(gcc-base.conf)
QMAKE_COMPILER_DEFINES += __APPLE__ __GNUC__=4 __APPLE_CC__
-QMAKE_OBJECTIVE_CFLAGS = $$QMAKE_CFLAGS
-QMAKE_OBJECTIVE_CFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON
-QMAKE_OBJECTIVE_CFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF
-QMAKE_OBJECTIVE_CFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG
-QMAKE_OBJECTIVE_CFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE
-QMAKE_OBJECTIVE_CFLAGS_RELEASE_WITH_DEBUGINFO = $$QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO
-QMAKE_OBJECTIVE_CFLAGS_HIDESYMS = $$QMAKE_CXXFLAGS_HIDESYMS
-
QMAKE_LFLAGS += -headerpad_max_install_names
QMAKE_LFLAGS_SHLIB += -single_module -dynamiclib
diff --git a/mkspecs/common/ios/clang.conf b/mkspecs/common/ios/clang.conf
index 36cb655229..f45b89665f 100644
--- a/mkspecs/common/ios/clang.conf
+++ b/mkspecs/common/ios/clang.conf
@@ -22,7 +22,7 @@ QMAKE_IOS_OBJ_CFLAGS += -Wno-deprecated-implementations -Wprotocol -Wno-select
# Set build flags
QMAKE_CFLAGS += $$QMAKE_IOS_CFLAGS
QMAKE_CXXFLAGS += $$QMAKE_IOS_CFLAGS $$QMAKE_IOS_CXXFLAGS
-QMAKE_OBJECTIVE_CFLAGS += $$QMAKE_IOS_CFLAGS $$QMAKE_IOS_CXXFLAGS $$QMAKE_IOS_OBJ_CFLAGS
+QMAKE_OBJECTIVE_CFLAGS += $$QMAKE_IOS_OBJ_CFLAGS
QMAKE_IOS_CFLAGS =
QMAKE_IOS_CXXFLAGS =
diff --git a/mkspecs/common/linux.conf b/mkspecs/common/linux.conf
index 8d6fb6fe17..b98d9bdf2d 100644
--- a/mkspecs/common/linux.conf
+++ b/mkspecs/common/linux.conf
@@ -4,6 +4,8 @@
QMAKE_PLATFORM += linux
+include(unix.conf)
+
QMAKE_CFLAGS_THREAD += -D_REENTRANT
QMAKE_CXXFLAGS_THREAD += $$QMAKE_CFLAGS_THREAD
QMAKE_LFLAGS_GCSECTIONS = -Wl,--gc-sections
@@ -51,5 +53,3 @@ QMAKE_RANLIB =
QMAKE_STRIP = strip
QMAKE_STRIPFLAGS_LIB += --strip-unneeded
-
-include(unix.conf)
diff --git a/mkspecs/common/mac.conf b/mkspecs/common/mac.conf
index 91639ddb50..d80b41c74b 100644
--- a/mkspecs/common/mac.conf
+++ b/mkspecs/common/mac.conf
@@ -6,6 +6,8 @@
QMAKE_PLATFORM += mac darwin
+include(unix.conf)
+
QMAKE_RESOURCE = /Developer/Tools/Rez
QMAKE_EXTENSION_SHLIB = dylib
QMAKE_LIBDIR =
@@ -27,5 +29,3 @@ QMAKE_LIBS_THREAD =
QMAKE_AR = ar cq
QMAKE_RANLIB = ranlib -s
QMAKE_NM = nm -P
-
-include(unix.conf)
diff --git a/mkspecs/common/msvc-desktop.conf b/mkspecs/common/msvc-desktop.conf
index 849048dad0..a1c436388c 100644
--- a/mkspecs/common/msvc-desktop.conf
+++ b/mkspecs/common/msvc-desktop.conf
@@ -74,6 +74,9 @@ QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWS
QMAKE_LFLAGS_EXE = \"/MANIFESTDEPENDENCY:type=\'win32\' name=\'Microsoft.Windows.Common-Controls\' version=\'6.0.0.0\' publicKeyToken=\'6595b64144ccf1df\' language=\'*\' processorArchitecture=\'*\'\"
QMAKE_LFLAGS_DLL = /DLL
QMAKE_LFLAGS_LTCG = /LTCG
+QMAKE_PREFIX_SHLIB =
+QMAKE_EXTENSION_SHLIB = dll
+QMAKE_PREFIX_STATICLIB =
QMAKE_EXTENSION_STATICLIB = lib
QMAKE_LIBS_CORE = kernel32.lib user32.lib shell32.lib uuid.lib ole32.lib advapi32.lib ws2_32.lib
diff --git a/mkspecs/common/qcc-base-qnx-armle-v7.conf b/mkspecs/common/qcc-base-qnx-armle-v7.conf
index 12d393f070..ad3bb33da4 100644
--- a/mkspecs/common/qcc-base-qnx-armle-v7.conf
+++ b/mkspecs/common/qcc-base-qnx-armle-v7.conf
@@ -4,9 +4,10 @@
MAKEFILE_GENERATOR = UNIX
-include(g++-unix.conf)
include(unix.conf)
+include(g++-unix.conf)
+
QMAKE_CC = qcc -Vgcc_ntoarmv7le
QMAKE_CXX = qcc -Vgcc_ntoarmv7le
QNX_CPUDIR = armle-v7
diff --git a/mkspecs/common/qcc-base-qnx-x86.conf b/mkspecs/common/qcc-base-qnx-x86.conf
index b49075086d..37a5d9ce70 100644
--- a/mkspecs/common/qcc-base-qnx-x86.conf
+++ b/mkspecs/common/qcc-base-qnx-x86.conf
@@ -4,9 +4,10 @@
MAKEFILE_GENERATOR = UNIX
-include(g++-unix.conf)
include(unix.conf)
+include(g++-unix.conf)
+
QMAKE_CC = qcc -Vgcc_ntox86
QMAKE_CXX = qcc -Vgcc_ntox86
QNX_CPUDIR = x86
diff --git a/mkspecs/common/qcc-base-qnx.conf b/mkspecs/common/qcc-base-qnx.conf
index dbbf346ea2..156ba0ddd8 100644
--- a/mkspecs/common/qcc-base-qnx.conf
+++ b/mkspecs/common/qcc-base-qnx.conf
@@ -4,7 +4,7 @@
include(qcc-base.conf)
-QMAKE_PLATFORM += qnx
+QMAKE_PLATFORM = qnx $$QMAKE_PLATFORM
#Choose qnx QPA Plugin as default
QT_QPA_DEFAULT_PLATFORM = qnx
diff --git a/mkspecs/common/unix.conf b/mkspecs/common/unix.conf
index 2146b62f17..8521c85b99 100644
--- a/mkspecs/common/unix.conf
+++ b/mkspecs/common/unix.conf
@@ -12,5 +12,6 @@ QMAKE_YACCFLAGS_MANGLE += -p $base -b $base
QMAKE_YACC_HEADER = $base.tab.h
QMAKE_YACC_SOURCE = $base.tab.c
QMAKE_PREFIX_SHLIB = lib
+QMAKE_EXTENSION_SHLIB = so
QMAKE_PREFIX_STATICLIB = lib
QMAKE_EXTENSION_STATICLIB = a
diff --git a/mkspecs/common/wince/qmake.conf b/mkspecs/common/wince/qmake.conf
index 3eac38f6b7..224c350e2f 100644
--- a/mkspecs/common/wince/qmake.conf
+++ b/mkspecs/common/wince/qmake.conf
@@ -62,6 +62,9 @@ QMAKE_LFLAGS_LTCG = /LTCG
QMAKE_LIBS_NETWORK = ws2.lib
QMAKE_LIBS_OPENGL =
QMAKE_LIBS_COMPAT =
+QMAKE_PREFIX_SHLIB =
+QMAKE_EXTENSION_SHLIB = dll
+QMAKE_PREFIX_STATICLIB =
QMAKE_EXTENSION_STATICLIB = lib
QMAKE_LIBS_EGL = libEGL.lib
diff --git a/mkspecs/common/winrt_winphone/qmake.conf b/mkspecs/common/winrt_winphone/qmake.conf
index 9ff1966284..288043da88 100644
--- a/mkspecs/common/winrt_winphone/qmake.conf
+++ b/mkspecs/common/winrt_winphone/qmake.conf
@@ -70,6 +70,9 @@ QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWS
QMAKE_LFLAGS_EXE = /MANIFEST:NO
QMAKE_LFLAGS_DLL = /MANIFEST:NO /DLL
QMAKE_LFLAGS_LTCG = /LTCG
+QMAKE_PREFIX_SHLIB =
+QMAKE_EXTENSION_SHLIB = dll
+QMAKE_PREFIX_STATICLIB =
QMAKE_EXTENSION_STATICLIB = lib
QMAKE_LIBS += runtimeobject.lib
diff --git a/mkspecs/cygwin-g++/qmake.conf b/mkspecs/cygwin-g++/qmake.conf
index 53cd35611f..a4f64d9c66 100644
--- a/mkspecs/cygwin-g++/qmake.conf
+++ b/mkspecs/cygwin-g++/qmake.conf
@@ -6,7 +6,7 @@
MAKEFILE_GENERATOR = UNIX
QMAKE_PLATFORM = cygwin unix posix
-CONFIG += incremental
+CONFIG += incremental unversioned_libname
QMAKE_INCREMENTAL_STYLE = sublib
QMAKE_COMPILER = gcc
@@ -56,8 +56,6 @@ QMAKE_LFLAGS_PLUGIN = $$QMAKE_LFLAGS_SHLIB
QMAKE_LFLAGS_SONAME = -Wl,-soname,
QMAKE_LFLAGS_THREAD =
QMAKE_LFLAGS_RPATH = -Wl,-rpath,
-QMAKE_CYGWIN_SHLIB = 1
-QMAKE_CYGWIN_EXE = 1
QMAKE_LIBS =
QMAKE_LIBS_DYNLOAD = -ldl
@@ -65,6 +63,7 @@ QMAKE_LIBS_X11 = -lXext -lX11
QMAKE_LIBS_OPENGL = -lGL
QMAKE_LIBS_THREAD = -lpthread
QMAKE_PREFIX_SHLIB = lib
+QMAKE_EXTENSION_SHLIB = dll
QMAKE_PREFIX_STATICLIB = lib
QMAKE_EXTENSION_STATICLIB = a
diff --git a/mkspecs/darwin-g++/qmake.conf b/mkspecs/darwin-g++/qmake.conf
index ab333b1684..79f81a990f 100644
--- a/mkspecs/darwin-g++/qmake.conf
+++ b/mkspecs/darwin-g++/qmake.conf
@@ -9,6 +9,8 @@ QMAKE_PLATFORM = osx macx mac darwin
CONFIG += native_precompiled_headers
DEFINES += __USE_WS_X11__
+include(../common/unix.conf)
+
QMAKE_COMPILER = gcc
QMAKE_CC = cc
@@ -84,5 +86,4 @@ QMAKE_PCH_OUTPUT_EXT = .gch
QMAKE_CXXFLAGS_PRECOMPILE += -x objective-c++-header -c ${QMAKE_PCH_INPUT} -o ${QMAKE_PCH_OUTPUT}
QMAKE_CXXFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE
-include(../common/unix.conf)
load(qt_config)
diff --git a/mkspecs/devices/linux-jetson-tk1-pro-g++/qmake.conf b/mkspecs/devices/linux-jetson-tk1-pro-g++/qmake.conf
new file mode 100644
index 0000000000..ca9ebda087
--- /dev/null
+++ b/mkspecs/devices/linux-jetson-tk1-pro-g++/qmake.conf
@@ -0,0 +1,38 @@
+#
+# qmake configuration for the Jetson TK1 Pro boards
+#
+# A typical configure line might look like:
+# configure \
+# -device jetson-tk1-pro \
+# -device-option VIBRANTE_SDK_TOPDIR=/opt/nvidia/vibrante-vcm30t124-linux
+# -device-option CROSS_COMPILE=/opt/nvidia/toolchains/tegra-4.8.1-nv/usr/bin/arm-cortex_a15-linux-gnueabi/arm-cortex_a15-linux-gnueabi- \
+# -sysroot /opt/nvidia/vibrante-vcm30t124-linux/targetfs \
+# -no-gcc-sysroot
+
+include(../common/linux_device_pre.conf)
+
+isEmpty(VIBRANTE_SDK_TOPDIR):error("You must pass -device-option VIBRANTE_SDK_TOPDIR=/path/to/sdk")
+
+QMAKE_INCDIR += \
+ $${VIBRANTE_SDK_TOPDIR}/include \
+ $$[QT_SYSROOT]/usr/include
+
+QMAKE_LIBDIR += \
+ $${VIBRANTE_SDK_TOPDIR}/lib-target \
+ $$[QT_SYSROOT]/usr/lib \
+ $$[QT_SYSROOT]/lib/arm-linux-gnueabihf \
+ $$[QT_SYSROOT]/usr/lib/arm-linux-gnueabihf
+
+QMAKE_LFLAGS += \
+ -Wl,-rpath-link,$${VIBRANTE_SDK_TOPDIR}/lib-target \
+ -Wl,-rpath-link,$$[QT_SYSROOT]/usr/lib \
+ -Wl,-rpath-link,$$[QT_SYSROOT]/usr/lib/arm-linux-gnueabihf \
+ -Wl,-rpath-link,$$[QT_SYSROOT]/lib/arm-linux-gnueabihf
+
+DISTRO_OPTS += hard-float
+COMPILER_FLAGS += -mtune=cortex-a15 -march=armv7-a -mfpu=neon-vfpv4 -DWIN_INTERFACE_CUSTOM
+
+EGLFS_DEVICE_INTEGRATION = eglfs_kms_egldevice
+
+include(../common/linux_arm_device_post.conf)
+load(qt_config)
diff --git a/mkspecs/devices/linux-jetson-tk1-pro-g++/qplatformdefs.h b/mkspecs/devices/linux-jetson-tk1-pro-g++/qplatformdefs.h
new file mode 100644
index 0000000000..beacd150b8
--- /dev/null
+++ b/mkspecs/devices/linux-jetson-tk1-pro-g++/qplatformdefs.h
@@ -0,0 +1,34 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "../../linux-g++/qplatformdefs.h"
diff --git a/mkspecs/features/default_post.prf b/mkspecs/features/default_post.prf
index ebe83af25e..cd8d8859aa 100644
--- a/mkspecs/features/default_post.prf
+++ b/mkspecs/features/default_post.prf
@@ -35,7 +35,6 @@ force_debug_info|debug: \
force_debug_info {
QMAKE_CFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO
QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO
- QMAKE_OBJECTIVE_CFLAGS_RELEASE = $$QMAKE_OBJECTIVE_CFLAGS_RELEASE_WITH_DEBUGINFO
QMAKE_LFLAGS_RELEASE = $$QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO
}
@@ -51,13 +50,11 @@ optimize_full {
debug {
QMAKE_CFLAGS += $$QMAKE_CFLAGS_DEBUG
QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS_DEBUG
- QMAKE_OBJECTIVE_CFLAGS += $$QMAKE_OBJECTIVE_CFLAGS_DEBUG
QMAKE_LFLAGS += $$QMAKE_LFLAGS_DEBUG
QMAKE_LIBFLAGS += $$QMAKE_LIBFLAGS_DEBUG
} else {
QMAKE_CFLAGS += $$QMAKE_CFLAGS_RELEASE
QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS_RELEASE
- QMAKE_OBJECTIVE_CFLAGS += $$QMAKE_OBJECTIVE_CFLAGS_RELEASE
QMAKE_LFLAGS += $$QMAKE_LFLAGS_RELEASE
QMAKE_LIBFLAGS += $$QMAKE_LIBFLAGS_RELEASE
}
@@ -107,7 +104,6 @@ c++11|c++14|c++1z {
!strict_c++:!isEmpty(QMAKE_CXXFLAGS_GNU$$cxxstd): cxxstd = GNU$$cxxstd
QMAKE_CXXFLAGS += $$eval(QMAKE_CXXFLAGS_$$cxxstd)
- QMAKE_OBJECTIVE_CFLAGS += $$eval(QMAKE_CXXFLAGS_$$cxxstd)
QMAKE_LFLAGS += $$eval(QMAKE_LFLAGS_$$cxxstd)
unset(cxxstd)
diff --git a/mkspecs/features/gcov.prf b/mkspecs/features/gcov.prf
index 330831fc0e..f45ba4c520 100644
--- a/mkspecs/features/gcov.prf
+++ b/mkspecs/features/gcov.prf
@@ -25,7 +25,6 @@
QMAKE_CFLAGS += -fprofile-arcs -ftest-coverage
QMAKE_CXXFLAGS += -fprofile-arcs -ftest-coverage
-QMAKE_OBJECTIVE_CFLAGS += -fprofile-arcs -ftest-coverage
QMAKE_LFLAGS += -fprofile-arcs -ftest-coverage
QMAKE_CLEAN += $(OBJECTS_DIR)*.gcno and $(OBJECTS_DIR)*.gcda
diff --git a/mkspecs/features/mac/objective_c.prf b/mkspecs/features/mac/objective_c.prf
index 0f25f41eec..b3b1d4be99 100644
--- a/mkspecs/features/mac/objective_c.prf
+++ b/mkspecs/features/mac/objective_c.prf
@@ -1,23 +1,10 @@
-for(source, SOURCES) {
- contains(source,.*\\.mm?$) {
- warning(Objective-C source \'$$source\' found in SOURCES but should be in OBJECTIVE_SOURCES)
- SOURCES -= $$source
- OBJECTIVE_SOURCES += $$source
- }
-}
+# Objective-C/C++ sources go in SOURCES, like all other sources
+SOURCES += $$OBJECTIVE_SOURCES
-isEmpty(QMAKE_OBJECTIVE_CC):QMAKE_OBJECTIVE_CC = $$QMAKE_CC
+# Strip C/C++ flags from QMAKE_OBJECTIVE_CFLAGS just in case
+QMAKE_OBJECTIVE_CFLAGS -= $$QMAKE_CFLAGS $$QMAKE_CXXFLAGS
-OBJECTIVE_C_OBJECTS_DIR = $$OBJECTS_DIR
-isEmpty(OBJECTIVE_C_OBJECTS_DIR):OBJECTIVE_C_OBJECTS_DIR = .
-isEmpty(QMAKE_EXT_OBJECTIVE_C):QMAKE_EXT_OBJECTIVE_C = .mm .m
-
-objective_c.dependency_type = TYPE_C
-objective_c.variables = QMAKE_OBJECTIVE_CFLAGS
-objective_c.commands = $$QMAKE_OBJECTIVE_CC -c $(QMAKE_COMP_QMAKE_OBJECTIVE_CFLAGS) $(DEFINES) $(INCPATH) ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT}
-objective_c.output = $$OBJECTIVE_C_OBJECTS_DIR/${QMAKE_FILE_BASE}$${first(QMAKE_EXT_OBJ)}
-objective_c.input = OBJECTIVE_SOURCES
-objective_c.name = Compile ${QMAKE_FILE_IN}
-silent:objective_c.commands = @echo objective-c ${QMAKE_FILE_IN} && $$objective_c.commands
-QMAKE_EXTRA_COMPILERS += objective_c
+# Add Objective-C/C++ flags to C/C++ flags, the compiler can handle it
+QMAKE_CFLAGS += $$QMAKE_OBJECTIVE_CFLAGS
+QMAKE_CXXFLAGS += $$QMAKE_OBJECTIVE_CFLAGS
diff --git a/mkspecs/features/mac/sdk.prf b/mkspecs/features/mac/sdk.prf
index a5643e311d..210843bd94 100644
--- a/mkspecs/features/mac/sdk.prf
+++ b/mkspecs/features/mac/sdk.prf
@@ -32,7 +32,6 @@ isEmpty(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.version) {
!equals(MAKEFILE_GENERATOR, XCODE) {
QMAKE_CFLAGS += -isysroot $$QMAKE_MAC_SDK_PATH
QMAKE_CXXFLAGS += -isysroot $$QMAKE_MAC_SDK_PATH
- QMAKE_OBJECTIVE_CFLAGS += -isysroot $$QMAKE_MAC_SDK_PATH
QMAKE_LFLAGS += -Wl,-syslibroot,$$QMAKE_MAC_SDK_PATH
}
@@ -80,6 +79,5 @@ isEmpty(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.platform_name) {
version_min_flag = -m$${version_identifier}-version-min=$$deployment_target
QMAKE_CFLAGS += $$version_min_flag
QMAKE_CXXFLAGS += $$version_min_flag
- QMAKE_OBJECTIVE_CFLAGS += $$version_min_flag
QMAKE_LFLAGS += $$version_min_flag
}
diff --git a/mkspecs/features/moc.prf b/mkspecs/features/moc.prf
index c0b5682446..8e8deec63c 100644
--- a/mkspecs/features/moc.prf
+++ b/mkspecs/features/moc.prf
@@ -16,7 +16,7 @@ MOC_INCLUDEPATH = $$QMAKESPEC $$_PRO_FILE_PWD_ $$MOC_INCLUDEPATH $$QMAKE_DEFAULT
# has too many includes. We do this to overcome a command-line limit on Win < XP
WIN_INCLUDETEMP=
win32:count(MOC_INCLUDEPATH, 40, >) {
- WIN_INCLUDETEMP = $$MOC_DIR/mocinclude.tmp
+ WIN_INCLUDETEMP = $$MOC_DIR/mocinclude.opt
WIN_INCLUDETEMP_CONT =
for (inc, MOC_INCLUDEPATH): \
diff --git a/mkspecs/features/qt.prf b/mkspecs/features/qt.prf
index 2e466ec9be..d416a8955a 100644
--- a/mkspecs/features/qt.prf
+++ b/mkspecs/features/qt.prf
@@ -119,12 +119,6 @@ for(ever) {
!mac|!contains(MODULE_CONFIG, lib_bundle): \
MODULE_NAME ~= s,^Qt,Qt$$QT_MAJOR_VERSION,
- win32 {
- # Make sure the version number isn't appended again to the lib name
- QMAKE_$${upper($$MODULE_NAME$$QT_LIBINFIX)}_VERSION_OVERRIDE = 0
- QMAKE_$${upper($$MODULE_NAME$$QT_LIBINFIX)}D_VERSION_OVERRIDE = 0
- }
-
isEmpty(LINKAGE) {
!isEmpty(MODULE_LIBS_ADD): \
LINKAGE = -L$$MODULE_LIBS_ADD
@@ -161,7 +155,8 @@ qt_module_deps = $$resolve_depends(qt_module_deps, "QT.")
!no_qt_rpath:!static:contains(QT_CONFIG, rpath):!contains(QT_CONFIG, static):\
contains(qt_module_deps, core) {
- relative_qt_rpath:defined(target.path, var) {
+ relative_qt_rpath:contains(INSTALLS, target):\
+ isEmpty(target.files):isEmpty(target.commands):isEmpty(target.extra) {
mac {
if(equals(TEMPLATE, app):app_bundle)|\
if(equals(TEMPLATE, lib):plugin:plugin_bundle) {
@@ -172,11 +167,17 @@ qt_module_deps = $$resolve_depends(qt_module_deps, "QT.")
} else {
binpath = $$target.path
}
- QMAKE_RPATHDIR += @loader_path/$$relative_path($$[QT_INSTALL_LIBS], $$binpath)
+ rpath = @loader_path
} else {
QMAKE_LFLAGS += -Wl,-z,origin
- QMAKE_RPATHDIR += $ORIGIN/$$relative_path($$[QT_INSTALL_LIBS], $$target.path)
+ binpath = $$target.path
+ rpath = $ORIGIN
}
+ # NOT the /dev property, as INSTALLS use host paths
+ relpath = $$relative_path($$[QT_INSTALL_LIBS], $$binpath)
+ !equals(relpath, .): \
+ rpath = $$rpath/$$relpath
+ QMAKE_RPATHDIR += $$rpath
} else {
QMAKE_RPATHDIR += $$[QT_INSTALL_LIBS/dev]
}
diff --git a/mkspecs/features/resolve_target.prf b/mkspecs/features/resolve_target.prf
index aa52e9d67e..d6460c1d9d 100644
--- a/mkspecs/features/resolve_target.prf
+++ b/mkspecs/features/resolve_target.prf
@@ -54,13 +54,13 @@ win32 {
} else {
equals(TEMPLATE, lib) {
static {
- QMAKE_RESOLVED_TARGET = $${QMAKE_RESOLVED_TARGET}$${LIBPREFIX}$${TARGET}.a
+ QMAKE_RESOLVED_TARGET = $${QMAKE_RESOLVED_TARGET}$${LIBPREFIX}$${TARGET}.$${QMAKE_EXTENSION_STATICLIB}
} else: plugin|unversioned_libname {
- QMAKE_RESOLVED_TARGET = $${QMAKE_RESOLVED_TARGET}$${LIBPREFIX}$${TARGET}.so
+ QMAKE_RESOLVED_TARGET = $${QMAKE_RESOLVED_TARGET}$${LIBPREFIX}$${TARGET}.$${QMAKE_EXTENSION_SHLIB}
} else {
TEMP_VERSION = $$VERSION
isEmpty(TEMP_VERSION):TEMP_VERSION = 1.0.0
- QMAKE_RESOLVED_TARGET = $${QMAKE_RESOLVED_TARGET}$${LIBPREFIX}$${TARGET}.so.$${TEMP_VERSION}
+ QMAKE_RESOLVED_TARGET = $${QMAKE_RESOLVED_TARGET}$${LIBPREFIX}$${TARGET}.$${QMAKE_EXTENSION_SHLIB}.$${TEMP_VERSION}
}
} else {
QMAKE_RESOLVED_TARGET = $${QMAKE_RESOLVED_TARGET}$${TARGET}
diff --git a/mkspecs/features/spec_pre.prf b/mkspecs/features/spec_pre.prf
index cdc1d7ee1e..ff310d9793 100644
--- a/mkspecs/features/spec_pre.prf
+++ b/mkspecs/features/spec_pre.prf
@@ -7,6 +7,8 @@ QMAKE_DIRLIST_SEP = $$DIRLIST_SEPARATOR
QMAKE_EXT_C = .c
QMAKE_EXT_CPP = .cpp .cc .cxx
+QMAKE_EXT_OBJC = .m
+QMAKE_EXT_OBJCXX = .mm
QMAKE_EXT_CPP_MOC = .moc
QMAKE_EXT_H = .h .hpp .hh .hxx
QMAKE_EXT_H_MOC = .cpp
diff --git a/mkspecs/features/unix/hide_symbols.prf b/mkspecs/features/unix/hide_symbols.prf
index 4af99c2eac..f4d3921cb1 100644
--- a/mkspecs/features/unix/hide_symbols.prf
+++ b/mkspecs/features/unix/hide_symbols.prf
@@ -1,4 +1,3 @@
QMAKE_CFLAGS += $$QMAKE_CFLAGS_HIDESYMS
QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS_HIDESYMS
-QMAKE_OBJECTIVE_CFLAGS += $$QMAKE_OBJECTIVE_CFLAGS_HIDESYMS
QMAKE_LFLAGS += $$QMAKE_LFLAGS_HIDESYMS
diff --git a/mkspecs/features/warn_off.prf b/mkspecs/features/warn_off.prf
index e37979c035..072a7aca15 100644
--- a/mkspecs/features/warn_off.prf
+++ b/mkspecs/features/warn_off.prf
@@ -1,4 +1,3 @@
CONFIG -= warn_on
QMAKE_CFLAGS += $$QMAKE_CFLAGS_WARN_OFF
QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS_WARN_OFF
-QMAKE_OBJECTIVE_CFLAGS += $$QMAKE_OBJECTIVE_CFLAGS_WARN_OFF \ No newline at end of file
diff --git a/mkspecs/features/warn_on.prf b/mkspecs/features/warn_on.prf
index 7e78a8e0d3..03a4a24a61 100644
--- a/mkspecs/features/warn_on.prf
+++ b/mkspecs/features/warn_on.prf
@@ -1,5 +1,4 @@
CONFIG -= warn_off
QMAKE_CFLAGS += $$QMAKE_CFLAGS_WARN_ON
QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS_WARN_ON
-QMAKE_OBJECTIVE_CFLAGS += $$QMAKE_OBJECTIVE_CFLAGS_WARN_ON
diff --git a/mkspecs/features/winrt/font_deployment.prf b/mkspecs/features/winrt/font_deployment.prf
deleted file mode 100644
index c767d5bc1a..0000000000
--- a/mkspecs/features/winrt/font_deployment.prf
+++ /dev/null
@@ -1,62 +0,0 @@
-# Provide default fonts for windows phone
-# The DEFAULTFONTS variable indicates, whether the default set of fonts is
-# used for deployment. The check below won't work after the fonts are added
-# so this helper variable is added and used for the user warning check later.
-!defined(FONTS, var):winphone {
- FONTS = \
- $$[QT_HOST_PREFIX/src]/lib/fonts/DejaVuSans.ttf \
- $$[QT_HOST_PREFIX/src]/lib/fonts/DejaVuSans-Bold.ttf \
- $$[QT_HOST_PREFIX/src]/lib/fonts/DejaVuSans-BoldOblique.ttf \
- $$[QT_HOST_PREFIX/src]/lib/fonts/DejaVuSansMono.ttf \
- $$[QT_HOST_PREFIX/src]/lib/fonts/DejaVuSansMono-Bold.ttf \
- $$[QT_HOST_PREFIX/src]/lib/fonts/DejaVuSansMono-BoldOblique.ttf \
- $$[QT_HOST_PREFIX/src]/lib/fonts/DejaVuSansMono-Oblique.ttf \
- $$[QT_HOST_PREFIX/src]/lib/fonts/DejaVuSans-Oblique.ttf \
- $$[QT_HOST_PREFIX/src]/lib/fonts/DejaVuSerif.ttf \
- $$[QT_HOST_PREFIX/src]/lib/fonts/DejaVuSerif-Bold.ttf \
- $$[QT_HOST_PREFIX/src]/lib/fonts/DejaVuSerif-BoldOblique.ttf \
- $$[QT_HOST_PREFIX/src]/lib/fonts/DejaVuSerif-Oblique.ttf
- DEFAULTFONTS =
-}
-
-if(build_pass:equals(TEMPLATE, "app"))| \
-if(!build_pass:equals(TEMPLATE, "vcapp")) {
- defined(DEFAULTFONTS, var) {
- message(Default fonts will automatically be deployed with your application. \
- To avoid automatic deployment unset the \"FONTS\" variable (\"FONTS =\") in your .pro file. \
- You can also customize which fonts are deployed by setting the \"FONTS\" variable.)
- }
-
- contains(TEMPLATE, "vc.*") {
- BUILD_DIR = $$OUT_PWD
- } else {
- load(resolve_target)
- BUILD_DIR = $$dirname(QMAKE_RESOLVED_TARGET)
- }
-
- for (FONT, FONTS) {
- font_$${FONT}.input = $$FONT
- font_$${FONT}.output = $$BUILD_DIR/fonts/$$basename(FONT)
- font_$${FONT}.CONFIG = verbatim
- QMAKE_SUBSTITUTES += font_$${FONT}
- }
-
- !isEmpty(FONTS):equals(TEMPLATE, "app") {
- fonts.files = $$BUILD_DIR/fonts/*
- isEmpty(target.path) {
- fonts.path = $$OUT_PWD/fonts
- } else {
- fonts.path = $$target.path/fonts
- }
-
- INSTALLS += fonts
- }
-}
-
-!isEmpty(FONTS):winphone:equals(TEMPLATE, "vcapp"):build_pass {
- for (FONT, FONTS) {
- fonts.files += $$OUT_PWD/fonts/$$basename(FONT)
- }
- fonts.path = fonts
- DEPLOYMENT += fonts
-}
diff --git a/mkspecs/freebsd-g++/qmake.conf b/mkspecs/freebsd-g++/qmake.conf
index 47505fc06a..282b6bdfa7 100644
--- a/mkspecs/freebsd-g++/qmake.conf
+++ b/mkspecs/freebsd-g++/qmake.conf
@@ -5,6 +5,8 @@
MAKEFILE_GENERATOR = UNIX
QMAKE_PLATFORM = freebsd bsd
+include(../common/unix.conf)
+
QMAKE_CFLAGS_THREAD = -pthread -D_THREAD_SAFE
QMAKE_CXXFLAGS_THREAD = $$QMAKE_CFLAGS_THREAD
@@ -27,7 +29,6 @@ QMAKE_OBJCOPY = objcopy
QMAKE_NM = nm -P
QMAKE_RANLIB =
-include(../common/unix.conf)
include(../common/gcc-base-unix.conf)
include(../common/g++-unix.conf)
load(qt_config)
diff --git a/mkspecs/freebsd-g++46/qmake.conf b/mkspecs/freebsd-g++46/qmake.conf
index 277997ab28..b930fca78b 100644
--- a/mkspecs/freebsd-g++46/qmake.conf
+++ b/mkspecs/freebsd-g++46/qmake.conf
@@ -5,6 +5,8 @@
MAKEFILE_GENERATOR = UNIX
QMAKE_PLATFORM = freebsd bsd
+include(../common/unix.conf)
+
QMAKE_CFLAGS_THREAD = -pthread -D_THREAD_SAFE
QMAKE_CXXFLAGS_THREAD = $$QMAKE_CFLAGS_THREAD
@@ -27,7 +29,6 @@ QMAKE_OBJCOPY = objcopy
QMAKE_NM = nm -P
QMAKE_RANLIB =
-include(../common/unix.conf)
include(../common/gcc-base-unix.conf)
include(../common/g++-unix.conf)
diff --git a/mkspecs/freebsd-icc/qmake.conf b/mkspecs/freebsd-icc/qmake.conf
index fb419f7e5b..d72ea73278 100644
--- a/mkspecs/freebsd-icc/qmake.conf
+++ b/mkspecs/freebsd-icc/qmake.conf
@@ -30,6 +30,8 @@
MAKEFILE_GENERATOR = UNIX
QMAKE_PLATFORM = freebsd bsd
+include(../common/unix.conf)
+
QMAKE_COMPILER = gcc intel_icc # icc pretends to be gcc
QMAKE_CC = icc
@@ -90,5 +92,4 @@ QMAKE_OBJCOPY = objcopy
QMAKE_NM = nm -P
QMAKE_RANLIB =
-include(../common/unix.conf)
load(qt_config)
diff --git a/mkspecs/haiku-g++/qmake.conf b/mkspecs/haiku-g++/qmake.conf
index 6144392385..ac28069864 100644
--- a/mkspecs/haiku-g++/qmake.conf
+++ b/mkspecs/haiku-g++/qmake.conf
@@ -5,6 +5,8 @@
MAKEFILE_GENERATOR = UNIX
QMAKE_PLATFORM = haiku
+include(../common/unix.conf)
+
# Choose haiku QPA Plugin as default
QT_QPA_DEFAULT_PLATFORM = haiku
@@ -23,5 +25,5 @@ QMAKE_RANLIB =
include(../common/gcc-base-unix.conf)
include(../common/g++-unix.conf)
-include(../common/unix.conf)
+
load(qt_config)
diff --git a/mkspecs/hpux-acc-64/qmake.conf b/mkspecs/hpux-acc-64/qmake.conf
index 2156b448fe..f0b879de83 100644
--- a/mkspecs/hpux-acc-64/qmake.conf
+++ b/mkspecs/hpux-acc-64/qmake.conf
@@ -49,6 +49,8 @@ MAKEFILE_GENERATOR = UNIX
QMAKE_PLATFORM = hpux
QMAKE_COMPILER_DEFINES += __hpux __HP_aCC
+include(../common/unix.conf)
+
QMAKE_COMPILER = hp_acc
QMAKE_CC = cc
@@ -111,5 +113,4 @@ QMAKE_OBJCOPY = objcopy
QMAKE_NM = nm -P
QMAKE_RANLIB =
-include(../common/unix.conf)
load(qt_config)
diff --git a/mkspecs/hpux-acc-o64/qmake.conf b/mkspecs/hpux-acc-o64/qmake.conf
index 69c3df1375..750bb99155 100644
--- a/mkspecs/hpux-acc-o64/qmake.conf
+++ b/mkspecs/hpux-acc-o64/qmake.conf
@@ -48,6 +48,8 @@
MAKEFILE_GENERATOR = UNIX
QMAKE_PLATFORM = hpux
+include(../common/unix.conf)
+
QMAKE_COMPILER = hp_acc
QMAKE_CC = cc
@@ -109,5 +111,4 @@ QMAKE_OBJCOPY = objcopy
QMAKE_NM = nm -P
QMAKE_RANLIB =
-include(../common/unix.conf)
load(qt_config)
diff --git a/mkspecs/hpux-acc/qmake.conf b/mkspecs/hpux-acc/qmake.conf
index eaa8888fbe..2f1ce1054c 100644
--- a/mkspecs/hpux-acc/qmake.conf
+++ b/mkspecs/hpux-acc/qmake.conf
@@ -28,6 +28,8 @@ MAKEFILE_GENERATOR = UNIX
QMAKE_PLATFORM = hpux
QMAKE_COMPILER_DEFINES += __hpux __HP_aCC
+include(../common/unix.conf)
+
QMAKE_COMPILER = hp_acc
QMAKE_CC = cc
@@ -90,5 +92,4 @@ QMAKE_OBJCOPY = objcopy
QMAKE_NM = nm -P
QMAKE_RANLIB =
-include(../common/unix.conf)
load(qt_config)
diff --git a/mkspecs/hpux-g++-64/qmake.conf b/mkspecs/hpux-g++-64/qmake.conf
index 3e822edbfb..a27333fa18 100644
--- a/mkspecs/hpux-g++-64/qmake.conf
+++ b/mkspecs/hpux-g++-64/qmake.conf
@@ -8,6 +8,8 @@
MAKEFILE_GENERATOR = UNIX
QMAKE_PLATFORM = hpux
+include(../common/unix.conf)
+
QMAKE_COMPILER = gcc
QMAKE_CC = gcc
@@ -73,5 +75,4 @@ QMAKE_OBJCOPY = objcopy
QMAKE_NM = nm -P
QMAKE_RANLIB =
-include(../common/unix.conf)
load(qt_config)
diff --git a/mkspecs/hpux-g++/qmake.conf b/mkspecs/hpux-g++/qmake.conf
index 866a3416bc..b488da7178 100644
--- a/mkspecs/hpux-g++/qmake.conf
+++ b/mkspecs/hpux-g++/qmake.conf
@@ -9,6 +9,8 @@ MAKEFILE_GENERATOR = UNIX
QMAKE_PLATFORM = hpux
CONFIG += plugin_no_soname
+include(../common/unix.conf)
+
QMAKE_COMPILER = gcc
QMAKE_CC = gcc
@@ -74,5 +76,4 @@ QMAKE_OBJCOPY = objcopy
QMAKE_NM = nm -P
QMAKE_RANLIB =
-include(../common/unix.conf)
load(qt_config)
diff --git a/mkspecs/hpuxi-acc-32/qmake.conf b/mkspecs/hpuxi-acc-32/qmake.conf
index 79bf20fbb2..e80a7973fe 100644
--- a/mkspecs/hpuxi-acc-32/qmake.conf
+++ b/mkspecs/hpuxi-acc-32/qmake.conf
@@ -6,6 +6,8 @@ MAKEFILE_GENERATOR = UNIX
QMAKE_PLATFORM = hpux
CONFIG += plugin_no_soname
+include(../common/unix.conf)
+
QMAKE_COMPILER = hp_acc
QMAKE_CC = cc
@@ -66,5 +68,4 @@ QMAKE_OBJCOPY = objcopy
QMAKE_NM = nm -P
QMAKE_RANLIB =
-include(../common/unix.conf)
load(qt_config)
diff --git a/mkspecs/hpuxi-acc-64/qmake.conf b/mkspecs/hpuxi-acc-64/qmake.conf
index aaec3eab14..360e35c5d6 100644
--- a/mkspecs/hpuxi-acc-64/qmake.conf
+++ b/mkspecs/hpuxi-acc-64/qmake.conf
@@ -49,6 +49,8 @@ MAKEFILE_GENERATOR = UNIX
QMAKE_PLATFORM = hpux
CONFIG += plugin_no_soname
+include(../common/unix.conf)
+
QMAKE_COMPILER = hp_acc
QMAKE_CC = cc
@@ -109,5 +111,4 @@ QMAKE_OBJCOPY = objcopy
QMAKE_NM = nm -P
QMAKE_RANLIB =
-include(../common/unix.conf)
load(qt_config)
diff --git a/mkspecs/hpuxi-g++-64/qmake.conf b/mkspecs/hpuxi-g++-64/qmake.conf
index 8a05a5f611..4c376de719 100644
--- a/mkspecs/hpuxi-g++-64/qmake.conf
+++ b/mkspecs/hpuxi-g++-64/qmake.conf
@@ -13,6 +13,8 @@
MAKEFILE_GENERATOR = UNIX
QMAKE_PLATFORM = hpux
+include(../common/unix.conf)
+
QMAKE_COMPILER = gcc
QMAKE_CC = gcc
@@ -76,5 +78,4 @@ QMAKE_OBJCOPY = objcopy
QMAKE_NM = nm -P
QMAKE_RANLIB =
-include(../common/unix.conf)
load(qt_config)
diff --git a/mkspecs/hurd-g++/qmake.conf b/mkspecs/hurd-g++/qmake.conf
index e7e4e3a82d..f2e3242627 100644
--- a/mkspecs/hurd-g++/qmake.conf
+++ b/mkspecs/hurd-g++/qmake.conf
@@ -7,6 +7,8 @@ QMAKE_PLATFORM += hurd
CONFIG += incremental
QMAKE_INCREMENTAL_STYLE = sublib
+include(../common/unix.conf)
+
QMAKE_CFLAGS_THREAD += -D_REENTRANT
QMAKE_CXXFLAGS_THREAD += $$QMAKE_CFLAGS_THREAD
QMAKE_LFLAGS_GCSECTIONS = -Wl,--gc-sections
@@ -46,7 +48,6 @@ QMAKE_RANLIB =
QMAKE_STRIP = strip
QMAKE_STRIPFLAGS_LIB += --strip-unneeded
-include(../common/unix.conf)
include(../common/gcc-base-unix.conf)
include(../common/g++-unix.conf)
load(qt_config)
diff --git a/mkspecs/irix-cc-64/qmake.conf b/mkspecs/irix-cc-64/qmake.conf
index 05c8b6fc84..ad5c6a3ee1 100644
--- a/mkspecs/irix-cc-64/qmake.conf
+++ b/mkspecs/irix-cc-64/qmake.conf
@@ -38,6 +38,8 @@ MAKEFILE_GENERATOR = UNIX
QMAKE_PLATFORM = irix
QMAKE_COMPILER_DEFINES += __sgi __EDG
+include(../common/unix.conf)
+
QMAKE_COMPILER = sgi_cc
QMAKE_CC = cc
@@ -103,5 +105,4 @@ QMAKE_RANLIB =
QMAKE_CLEAN = -r $(OBJECTS_DIR)so_locations $(OBJECTS_DIR)ii_files
-include(../common/unix.conf)
load(qt_config)
diff --git a/mkspecs/irix-cc/qmake.conf b/mkspecs/irix-cc/qmake.conf
index 72d4e65474..52abdf8578 100644
--- a/mkspecs/irix-cc/qmake.conf
+++ b/mkspecs/irix-cc/qmake.conf
@@ -38,6 +38,8 @@ MAKEFILE_GENERATOR = UNIX
QMAKE_PLATFORM = irix
QMAKE_COMPILER_DEFINES += __sgi __EDG
+include(../common/unix.conf)
+
QMAKE_COMPILER = sgi_cc
QMAKE_CC = cc
@@ -103,5 +105,4 @@ QMAKE_RANLIB =
QMAKE_CLEAN = -r $(OBJECTS_DIR)so_locations $(OBJECTS_DIR)ii_files
-include(../common/unix.conf)
load(qt_config)
diff --git a/mkspecs/irix-g++-64/qmake.conf b/mkspecs/irix-g++-64/qmake.conf
index 12c224b5c0..bd258df5e8 100644
--- a/mkspecs/irix-g++-64/qmake.conf
+++ b/mkspecs/irix-g++-64/qmake.conf
@@ -6,6 +6,8 @@ MAKEFILE_GENERATOR = UNIX
QMAKE_PLATFORM = irix
QMAKE_COMPILER_DEFINES += __sgi __GNUC__
+include(../common/unix.conf)
+
QMAKE_COMPILER = gcc
QMAKE_CC = gcc
@@ -73,5 +75,4 @@ QMAKE_RANLIB =
QMAKE_CLEAN = so_locations
-include(../common/unix.conf)
load(qt_config)
diff --git a/mkspecs/irix-g++/qmake.conf b/mkspecs/irix-g++/qmake.conf
index 2c02165e0d..57a27b6a1b 100644
--- a/mkspecs/irix-g++/qmake.conf
+++ b/mkspecs/irix-g++/qmake.conf
@@ -6,6 +6,8 @@ MAKEFILE_GENERATOR = UNIX
QMAKE_PLATFORM = irix
QMAKE_COMPILER_DEFINES += __sgi __GNUC__
+include(../common/unix.conf)
+
QMAKE_COMPILER = gcc
QMAKE_CC = gcc
@@ -73,5 +75,4 @@ QMAKE_RANLIB =
QMAKE_CLEAN = so_locations
-include(../common/unix.conf)
load(qt_config)
diff --git a/mkspecs/linux-cxx/qmake.conf b/mkspecs/linux-cxx/qmake.conf
index 1c7cafc6f2..b156bea084 100644
--- a/mkspecs/linux-cxx/qmake.conf
+++ b/mkspecs/linux-cxx/qmake.conf
@@ -7,6 +7,8 @@
MAKEFILE_GENERATOR = UNIX
QMAKE_PLATFORM = linux
+include(../common/unix.conf)
+
QMAKE_COMPILER = compaq_cc
QMAKE_CC = ccc
@@ -61,5 +63,4 @@ QMAKE_LIBS_OPENGL = -lGL
QMAKE_AR = ar cqs
QMAKE_RANLIB =
-include(../common/unix.conf)
load(qt_config)
diff --git a/mkspecs/linux-g++-32/qmake.conf b/mkspecs/linux-g++-32/qmake.conf
index 340aa85e7c..f09abeeec0 100644
--- a/mkspecs/linux-g++-32/qmake.conf
+++ b/mkspecs/linux-g++-32/qmake.conf
@@ -6,10 +6,12 @@ MAKEFILE_GENERATOR = UNIX
CONFIG += incremental
QMAKE_INCREMENTAL_STYLE = sublib
+include(../common/linux.conf)
+
QMAKE_CFLAGS = -m32
QMAKE_LFLAGS = -m32
-include(../common/linux.conf)
include(../common/gcc-base-unix.conf)
include(../common/g++-unix.conf)
+
load(qt_config)
diff --git a/mkspecs/linux-g++-64/qmake.conf b/mkspecs/linux-g++-64/qmake.conf
index 36fb6a83eb..a79b69ff31 100644
--- a/mkspecs/linux-g++-64/qmake.conf
+++ b/mkspecs/linux-g++-64/qmake.conf
@@ -9,10 +9,11 @@ MAKEFILE_GENERATOR = UNIX
CONFIG += incremental
QMAKE_INCREMENTAL_STYLE = sublib
+include(../common/linux.conf)
+
QMAKE_CFLAGS = -m64
QMAKE_LFLAGS = -m64
-include(../common/linux.conf)
include(../common/gcc-base-unix.conf)
include(../common/g++-unix.conf)
diff --git a/mkspecs/linux-g++/qplatformdefs.h b/mkspecs/linux-g++/qplatformdefs.h
index 5c18632e5d..95a57585d9 100644
--- a/mkspecs/linux-g++/qplatformdefs.h
+++ b/mkspecs/linux-g++/qplatformdefs.h
@@ -78,10 +78,10 @@
#undef QT_SOCKLEN_T
-#if defined(__GLIBC__) && (__GLIBC__ >= 2)
-#define QT_SOCKLEN_T socklen_t
-#else
+#if defined(__GLIBC__) && (__GLIBC__ < 2)
#define QT_SOCKLEN_T int
+#else
+#define QT_SOCKLEN_T socklen_t
#endif
#if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 500)
diff --git a/mkspecs/linux-kcc/qmake.conf b/mkspecs/linux-kcc/qmake.conf
index 06efc8c12c..591a59537f 100644
--- a/mkspecs/linux-kcc/qmake.conf
+++ b/mkspecs/linux-kcc/qmake.conf
@@ -16,6 +16,8 @@
MAKEFILE_GENERATOR = UNIX
QMAKE_PLATFORM = linux
+include(../common/unix.conf)
+
QMAKE_COMPILER = kai_cc
QMAKE_CC = KCC
@@ -78,5 +80,4 @@ QMAKE_RANLIB =
QMAKE_CLEAN = -r $(OBJECTS_DIR)ti_files
-include(../common/unix.conf)
load(qt_config)
diff --git a/mkspecs/linux-pgcc/qmake.conf b/mkspecs/linux-pgcc/qmake.conf
index 286f937b0e..c41823ba94 100644
--- a/mkspecs/linux-pgcc/qmake.conf
+++ b/mkspecs/linux-pgcc/qmake.conf
@@ -7,6 +7,8 @@
MAKEFILE_GENERATOR = UNIX
QMAKE_PLATFORM = linux
+include(../common/unix.conf)
+
QMAKE_COMPILER = portland_cc
QMAKE_CC = pgcc
@@ -67,5 +69,4 @@ QMAKE_OBJCOPY = objcopy
QMAKE_NM = nm -P
QMAKE_RANLIB =
-include(../common/unix.conf)
load(qt_config)
diff --git a/mkspecs/lynxos-g++/qmake.conf b/mkspecs/lynxos-g++/qmake.conf
index a53d6a8ec7..91bcc6b85d 100644
--- a/mkspecs/lynxos-g++/qmake.conf
+++ b/mkspecs/lynxos-g++/qmake.conf
@@ -9,6 +9,8 @@ QMAKE_PLATFORM = lynxos
CONFIG += incremental
QMAKE_INCREMENTAL_STYLE = sublib
+include(../common/unix.conf)
+
QMAKE_COMPILER = gcc
QMAKE_CC = gcc
@@ -74,5 +76,4 @@ QMAKE_RANLIB =
QMAKE_STRIP = strip
QMAKE_STRIPFLAGS_LIB += --strip-unneeded
-include(../common/unix.conf)
load(qt_config)
diff --git a/mkspecs/macx-clang-32/qmake.conf b/mkspecs/macx-clang-32/qmake.conf
index 87c601ee74..ec33c02e93 100644
--- a/mkspecs/macx-clang-32/qmake.conf
+++ b/mkspecs/macx-clang-32/qmake.conf
@@ -14,7 +14,6 @@ include(../common/clang-mac.conf)
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.7
QMAKE_CFLAGS += -arch i386
-QMAKE_OBJECTIVE_CFLAGS += -arch i386
QMAKE_CXXFLAGS += -arch i386
QMAKE_LFLAGS += -arch i386
diff --git a/mkspecs/macx-g++-32/qmake.conf b/mkspecs/macx-g++-32/qmake.conf
index 2a8197ebbd..af6fe5689e 100644
--- a/mkspecs/macx-g++-32/qmake.conf
+++ b/mkspecs/macx-g++-32/qmake.conf
@@ -17,7 +17,6 @@ include(../common/g++-macx.conf)
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.7
QMAKE_CFLAGS += -arch i386
-QMAKE_OBJECTIVE_CFLAGS += -arch i386
QMAKE_CXXFLAGS += -arch i386
QMAKE_LFLAGS += -arch i386
diff --git a/mkspecs/macx-icc/qmake.conf b/mkspecs/macx-icc/qmake.conf
index 4d2dd736b1..35e55f799e 100644
--- a/mkspecs/macx-icc/qmake.conf
+++ b/mkspecs/macx-icc/qmake.conf
@@ -41,14 +41,6 @@ QMAKE_CFLAGS_AVX512DQ += -xCORE-AVX512
QMAKE_CFLAGS_AVX512BW += -xCORE-AVX512
QMAKE_CFLAGS_AVX512VL += -xCORE-AVX512
-QMAKE_OBJECTIVE_CC = clang
-QMAKE_OBJECTIVE_CFLAGS = -pipe
-QMAKE_OBJECTIVE_CFLAGS_WARN_ON = -Wall -W
-QMAKE_OBJECTIVE_CFLAGS_WARN_OFF = -w
-QMAKE_OBJECTIVE_CFLAGS_RELEASE = -Os
-QMAKE_OBJECTIVE_CFLAGS_DEBUG = -g
-QMAKE_OBJECTIVE_CFLAGS_HIDESYMS = -fvisibility=hidden
-
QMAKE_CXX = icpc
QMAKE_CXXFLAGS = $$QMAKE_CFLAGS
QMAKE_CXXFLAGS_DEPS = $$QMAKE_CFLAGS_DEPS
diff --git a/mkspecs/macx-ios-clang/features/default_post.prf b/mkspecs/macx-ios-clang/features/default_post.prf
index 5266c88f16..40e7a893de 100644
--- a/mkspecs/macx-ios-clang/features/default_post.prf
+++ b/mkspecs/macx-ios-clang/features/default_post.prf
@@ -93,6 +93,5 @@ macx-xcode {
QMAKE_CFLAGS += $$arch_flags
QMAKE_CXXFLAGS += $$arch_flags
- QMAKE_OBJECTIVE_CFLAGS += $$arch_flags
QMAKE_LFLAGS += $$arch_flags
}
diff --git a/mkspecs/macx-xcode/default.xcscheme b/mkspecs/macx-xcode/default.xcscheme
index 4a16fefca0..ab2f6a8ab7 100644
--- a/mkspecs/macx-xcode/default.xcscheme
+++ b/mkspecs/macx-xcode/default.xcscheme
@@ -73,6 +73,13 @@
ReferencedContainer = "container:@QMAKE_ORIG_TARGET@.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
+ <EnvironmentVariables>
+ <EnvironmentVariable
+ key = "DYLD_IMAGE_SUFFIX"
+ value = "$(QT_LIBRARY_SUFFIX)"
+ isEnabled = "YES">
+ </EnvironmentVariable>
+ </EnvironmentVariables>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
diff --git a/mkspecs/netbsd-g++/qmake.conf b/mkspecs/netbsd-g++/qmake.conf
index 6cb24d9bf9..04c675da24 100644
--- a/mkspecs/netbsd-g++/qmake.conf
+++ b/mkspecs/netbsd-g++/qmake.conf
@@ -5,6 +5,8 @@
MAKEFILE_GENERATOR = UNIX
QMAKE_PLATFORM = netbsd bsd
+include(../common/unix.conf)
+
QMAKE_COMPILER = gcc
QMAKE_CC = gcc
@@ -68,5 +70,4 @@ QMAKE_OBJCOPY = objcopy
QMAKE_NM = nm -P
QMAKE_RANLIB = ranlib
-include(../common/unix.conf)
load(qt_config)
diff --git a/mkspecs/openbsd-g++/qmake.conf b/mkspecs/openbsd-g++/qmake.conf
index 2fdbd2c469..10330bc081 100644
--- a/mkspecs/openbsd-g++/qmake.conf
+++ b/mkspecs/openbsd-g++/qmake.conf
@@ -5,6 +5,8 @@
MAKEFILE_GENERATOR = UNIX
QMAKE_PLATFORM = openbsd bsd
+include(../common/unix.conf)
+
QMAKE_COMPILER = gcc
QMAKE_CC = gcc
@@ -69,5 +71,4 @@ QMAKE_OBJCOPY = objcopy
QMAKE_NM = nm -P
QMAKE_RANLIB = ranlib
-include(../common/unix.conf)
load(qt_config)
diff --git a/mkspecs/sco-g++/qmake.conf b/mkspecs/sco-g++/qmake.conf
index ebf60a3954..27fc1cffe3 100644
--- a/mkspecs/sco-g++/qmake.conf
+++ b/mkspecs/sco-g++/qmake.conf
@@ -7,6 +7,8 @@
MAKEFILE_GENERATOR = UNIX
QMAKE_PLATFORM = sco
+include(../common/unix.conf)
+
QMAKE_COMPILER = gcc
QMAKE_CC = gcc
@@ -65,5 +67,4 @@ QMAKE_OBJCOPY = objcopy
QMAKE_NM = nm -P
QMAKE_RANLIB =
-include(../common/unix.conf)
load(qt_config)
diff --git a/mkspecs/solaris-cc-64/qmake.conf b/mkspecs/solaris-cc-64/qmake.conf
index 6e1d35ef43..1c7b43c29c 100644
--- a/mkspecs/solaris-cc-64/qmake.conf
+++ b/mkspecs/solaris-cc-64/qmake.conf
@@ -24,6 +24,8 @@
MAKEFILE_GENERATOR = UNIX
QMAKE_PLATFORM = solaris
+include(../common/unix.conf)
+
QMAKE_COMPILER = sun_cc
QMAKE_CC = cc
@@ -90,5 +92,4 @@ QMAKE_RANLIB =
QMAKE_CLEAN = -r $(OBJECTS_DIR)Templates.DB $(OBJECTS_DIR)SunWS_cache
-include(../common/unix.conf)
load(qt_config)
diff --git a/mkspecs/solaris-cc/qmake.conf b/mkspecs/solaris-cc/qmake.conf
index 23814135b6..045ab033dd 100644
--- a/mkspecs/solaris-cc/qmake.conf
+++ b/mkspecs/solaris-cc/qmake.conf
@@ -7,6 +7,8 @@
MAKEFILE_GENERATOR = UNIX
QMAKE_PLATFORM = solaris
+include(../common/unix.conf)
+
QMAKE_COMPILER = sun_cc
QMAKE_CC = cc
@@ -73,5 +75,4 @@ QMAKE_RANLIB =
QMAKE_CLEAN = -r $(OBJECTS_DIR)Templates.DB $(OBJECTS_DIR)SunWS_cache
-include(../common/unix.conf)
load(qt_config)
diff --git a/mkspecs/solaris-g++-64/qmake.conf b/mkspecs/solaris-g++-64/qmake.conf
index 34fd044f3e..91ffb9193e 100644
--- a/mkspecs/solaris-g++-64/qmake.conf
+++ b/mkspecs/solaris-g++-64/qmake.conf
@@ -28,6 +28,8 @@
MAKEFILE_GENERATOR = UNIX
QMAKE_PLATFORM = solaris
+include(../common/unix.conf)
+
QMAKE_COMPILER = gcc
QMAKE_CC = gcc
@@ -92,5 +94,4 @@ QMAKE_OBJCOPY = objcopy
QMAKE_NM = nm -P
QMAKE_RANLIB =
-include(../common/unix.conf)
load(qt_config)
diff --git a/mkspecs/solaris-g++/qmake.conf b/mkspecs/solaris-g++/qmake.conf
index ccc178395b..594646353d 100644
--- a/mkspecs/solaris-g++/qmake.conf
+++ b/mkspecs/solaris-g++/qmake.conf
@@ -11,6 +11,8 @@
MAKEFILE_GENERATOR = UNIX
QMAKE_PLATFORM = solaris
+include(../common/unix.conf)
+
QMAKE_COMPILER = gcc
QMAKE_CC = gcc
@@ -75,5 +77,4 @@ QMAKE_OBJCOPY = objcopy
QMAKE_NM = nm -P
QMAKE_RANLIB =
-include(../common/unix.conf)
load(qt_config)
diff --git a/mkspecs/tru64-cxx/qmake.conf b/mkspecs/tru64-cxx/qmake.conf
index a2e0112623..024590bf91 100644
--- a/mkspecs/tru64-cxx/qmake.conf
+++ b/mkspecs/tru64-cxx/qmake.conf
@@ -6,6 +6,8 @@ MAKEFILE_GENERATOR = UNIX
QMAKE_PLATFORM = tru64
CONFIG += plugin_no_soname
+include(../common/unix.conf)
+
QMAKE_COMPILER = dec_cc
QMAKE_CC = cc
@@ -65,5 +67,4 @@ QMAKE_OBJCOPY = objcopy
QMAKE_NM = nm -P
QMAKE_RANLIB =
-include(../common/unix.conf)
load(qt_config)
diff --git a/mkspecs/tru64-g++/qmake.conf b/mkspecs/tru64-g++/qmake.conf
index dd7eb6c9c3..193e2694ea 100644
--- a/mkspecs/tru64-g++/qmake.conf
+++ b/mkspecs/tru64-g++/qmake.conf
@@ -6,6 +6,8 @@ MAKEFILE_GENERATOR = UNIX
QMAKE_PLATFORM = tru64
CONFIG += plugin_no_soname
+include(../common/unix.conf)
+
QMAKE_COMPILER = gcc
QMAKE_CC = gcc
@@ -67,5 +69,4 @@ QMAKE_OBJCOPY = objcopy
QMAKE_NM = nm -P
QMAKE_RANLIB =
-include(../common/unix.conf)
load(qt_config)
diff --git a/mkspecs/unixware-cc/qmake.conf b/mkspecs/unixware-cc/qmake.conf
index 483b8c0bb3..1a36a3e76b 100644
--- a/mkspecs/unixware-cc/qmake.conf
+++ b/mkspecs/unixware-cc/qmake.conf
@@ -10,6 +10,8 @@
MAKEFILE_GENERATOR = UNIX
QMAKE_PLATFORM = unixware
+include(../common/unix.conf)
+
QMAKE_COMPILER = sco_cc
QMAKE_CC = cc
@@ -69,5 +71,4 @@ QMAKE_OBJCOPY = objcopy
QMAKE_NM = nm -P
QMAKE_RANLIB =
-include(../common/unix.conf)
load(qt_config)
diff --git a/mkspecs/unixware-g++/qmake.conf b/mkspecs/unixware-g++/qmake.conf
index feca5a4c9e..abe2773deb 100644
--- a/mkspecs/unixware-g++/qmake.conf
+++ b/mkspecs/unixware-g++/qmake.conf
@@ -7,6 +7,8 @@
MAKEFILE_GENERATOR = UNIX
QMAKE_PLATFORM = unixware
+include(../common/unix.conf)
+
QMAKE_COMPILER = gcc
QMAKE_CC = gcc
@@ -68,5 +70,4 @@ QMAKE_OBJCOPY = objcopy
QMAKE_NM = nm -P
QMAKE_RANLIB =
-include(../common/unix.conf)
load(qt_config)
diff --git a/mkspecs/unsupported/freebsd-clang/qmake.conf b/mkspecs/unsupported/freebsd-clang/qmake.conf
index 92b7c47590..9d9815a7b3 100644
--- a/mkspecs/unsupported/freebsd-clang/qmake.conf
+++ b/mkspecs/unsupported/freebsd-clang/qmake.conf
@@ -5,6 +5,8 @@
MAKEFILE_GENERATOR = UNIX
QMAKE_PLATFORM = freebsd bsd
+include(../common/unix.conf)
+
QMAKE_CFLAGS_THREAD = -pthread -D_THREAD_SAFE
QMAKE_CXXFLAGS_THREAD = $$QMAKE_CFLAGS_THREAD
@@ -28,7 +30,7 @@ QMAKE_OBJCOPY = objcopy
QMAKE_NM = nm -P
QMAKE_RANLIB =
-include(../../common/unix.conf)
include(../../common/gcc-base-unix.conf)
include(../../common/clang.conf)
+
load(qt_config)
diff --git a/mkspecs/unsupported/linux-armcc/qmake.conf b/mkspecs/unsupported/linux-armcc/qmake.conf
deleted file mode 100644
index 2c7eb7c2d8..0000000000
--- a/mkspecs/unsupported/linux-armcc/qmake.conf
+++ /dev/null
@@ -1,29 +0,0 @@
-#
-# qmake configuration for linux-armcc
-#
-
-MAKEFILE_GENERATOR = UNIX
-CONFIG += incremental armcc_linker
-QMAKE_INCREMENTAL_STYLE = sublib
-
-include(../../common/linux.conf)
-include(../../common/armcc.conf)
-load(qt_config)
-
-# use armcc for linking since armlink doesn't understand the arm_linux_config_file option
-QMAKE_LINK = armcc
-QMAKE_LINK_SHLIB = armcc
-QMAKE_LINK_C = armcc
-QMAKE_LINK_C_SHLIB = armcc
-
-QMAKE_LFLAGS_SHLIB += --apcs=/fpic --shared
-QMAKE_LFLAGS_PLUGIN = $$QMAKE_LFLAGS_SHLIB
-
-QMAKE_LIBS += libstdc++.so librt.so
-
-CONFIG -= rvct_linker
-
-QMAKE_CFLAGS += --gnu --arm_linux --dllimport_runtime --thumb --cpu Cortex-A9 --arm_linux_config_file="$(HOME)/qt_rvct_config" --arm-linux-paths --apcs=/interwork --visibility_inlines_hidden --diag_suppress 1300,2523
-QMAKE_CXXFLAGS += $$QMAKE_CFLAGS --cpp
-
-QMAKE_LFLAGS += --diag_suppress 6331,6780,6439 --arm_linux_config_file="$(HOME)/qt_rvct_config" --arm-linux-paths
diff --git a/mkspecs/unsupported/linux-host-g++/qmake.conf b/mkspecs/unsupported/linux-host-g++/qmake.conf
index 546ff21349..3aa7520776 100644
--- a/mkspecs/unsupported/linux-host-g++/qmake.conf
+++ b/mkspecs/unsupported/linux-host-g++/qmake.conf
@@ -17,6 +17,8 @@ QMAKE_PLATFORM = linux
CONFIG += incremental
QMAKE_INCREMENTAL_STYLE = sublib
+include(../common/unix.conf)
+
#
# qmake configuration for common gcc
#
@@ -111,5 +113,4 @@ QMAKE_RANLIB =
QMAKE_STRIP = host-strip
QMAKE_STRIPFLAGS_LIB += --strip-unneeded
-include(../../common/unix.conf)
load(qt_config)
diff --git a/mkspecs/unsupported/qnx-X11-g++/qmake.conf b/mkspecs/unsupported/qnx-X11-g++/qmake.conf
index 8d2c63f330..79a5609dbf 100644
--- a/mkspecs/unsupported/qnx-X11-g++/qmake.conf
+++ b/mkspecs/unsupported/qnx-X11-g++/qmake.conf
@@ -7,9 +7,9 @@
MAKEFILE_GENERATOR = UNIX
QMAKE_PLATFORM = qnx
+include(../common/unix.conf)
include(../common/gcc-base-unix.conf)
include(../common/g++-unix.conf)
-include(../common/unix.conf)
QMAKE_CFLAGS_THREAD = -D_REENTRANT
QMAKE_CXXFLAGS_THREAD = $$QMAKE_CLFAGS_THREAD
diff --git a/mkspecs/unsupported/vxworks-ppc-dcc/qmake.conf b/mkspecs/unsupported/vxworks-ppc-dcc/qmake.conf
index a4cf23df9c..16e3127803 100644
--- a/mkspecs/unsupported/vxworks-ppc-dcc/qmake.conf
+++ b/mkspecs/unsupported/vxworks-ppc-dcc/qmake.conf
@@ -7,6 +7,8 @@ QMAKE_PLATFORM = vxworks
CONFIG += incremental
QMAKE_INCREMENTAL_STYLE = sublib
+include(../common/unix.conf)
+
VXWORKS_ARCH = ppc
VXWORKS_CPU = PPC32
VXWORKS_DIAB_SPEC = -tPPC7400FV:vxworks66
@@ -88,6 +90,5 @@ QMAKE_RANLIB =
QMAKE_STRIP = strip
QMAKE_STRIPFLAGS_LIB += --strip-unneeded
-include(../../common/unix.conf)
load(qt_config)
diff --git a/mkspecs/unsupported/vxworks-ppc-g++/qmake.conf b/mkspecs/unsupported/vxworks-ppc-g++/qmake.conf
index 1d3e9f4eb4..49cacdba43 100644
--- a/mkspecs/unsupported/vxworks-ppc-g++/qmake.conf
+++ b/mkspecs/unsupported/vxworks-ppc-g++/qmake.conf
@@ -8,13 +8,14 @@ CONFIG += incremental
QMAKE_INCREMENTAL_STYLE = sublib
DEFINES += VXWORKS
+include(../../common/linux.conf)
+
VXWORKS_ARCH = ppc
VXWORKS_CPU = PPC32
VXWORKS_ARCH_MUNCH = ppc
include(../../common/gcc-base-unix.conf)
include(../../common/g++-unix.conf)
-include(../../common/linux.conf)
QMAKE_CC = cc$$VXWORKS_ARCH_MUNCH
QMAKE_CFLAGS = -fno-builtin -I$(WIND_BASE)/target/h -I$(WIND_BASE)/target/h/wrn/coreip -DCPU=$$upper($$VXWORKS_ARCH) -DVX_CPU_FAMILY=$$VXWORKS_ARCH -DTOOL_FAMILY=gnu -DTOOL=gnu -D_WRS_KERNEL -D_VSB_CONFIG_FILE=\'<../lib/h/config/vsbConfig.h>\'
diff --git a/mkspecs/unsupported/vxworks-simpentium-dcc/qmake.conf b/mkspecs/unsupported/vxworks-simpentium-dcc/qmake.conf
index 49f0c21d4a..44e39a8a8c 100644
--- a/mkspecs/unsupported/vxworks-simpentium-dcc/qmake.conf
+++ b/mkspecs/unsupported/vxworks-simpentium-dcc/qmake.conf
@@ -7,6 +7,8 @@ QMAKE_PLATFORM = vxworks
CONFIG += incremental
QMAKE_INCREMENTAL_STYLE = sublib
+include(../common/unix.conf)
+
VXWORKS_ARCH = simlinux
VXWORKS_CPU = SIMLINUX
VXWORKS_DIAB_SPEC = -tX86LH:vxworks66
@@ -87,6 +89,5 @@ QMAKE_RANLIB =
QMAKE_STRIP = strip
QMAKE_STRIPFLAGS_LIB += --strip-unneeded
-include(../../common/unix.conf)
load(qt_config)
diff --git a/mkspecs/unsupported/vxworks-simpentium-g++/qmake.conf b/mkspecs/unsupported/vxworks-simpentium-g++/qmake.conf
index 3c8fd12d4a..4d5cc97fad 100644
--- a/mkspecs/unsupported/vxworks-simpentium-g++/qmake.conf
+++ b/mkspecs/unsupported/vxworks-simpentium-g++/qmake.conf
@@ -8,13 +8,14 @@ CONFIG += incremental
QMAKE_INCREMENTAL_STYLE = sublib
DEFINES += VXWORKS
+include(../../common/linux.conf)
+
VXWORKS_ARCH = simlinux
VXWORKS_CPU = SIMLINUX
VXWORKS_ARCH_MUNCH = pentium
include(../../common/gcc-base-unix.conf)
include(../../common/g++-unix.conf)
-include(../../common/linux.conf)
QMAKE_CC = cc$$VXWORKS_ARCH_MUNCH
QMAKE_CFLAGS = -fno-builtin -I$(WIND_BASE)/target/h -I$(WIND_BASE)/target/h/wrn/coreip -DCPU=$$upper($$VXWORKS_ARCH) -DVX_CPU_FAMILY=$$VXWORKS_ARCH -DTOOL_FAMILY=gnu -DTOOL=gnu -D_WRS_KERNEL -D_VSB_CONFIG_FILE=\'<../lib/h/config/vsbConfig.h>\'
diff --git a/mkspecs/win32-g++/qmake.conf b/mkspecs/win32-g++/qmake.conf
index 388d697b58..c00b4cd5ff 100644
--- a/mkspecs/win32-g++/qmake.conf
+++ b/mkspecs/win32-g++/qmake.conf
@@ -87,8 +87,11 @@ QMAKE_LFLAGS_GCSECTIONS = -Wl,--gc-sections
QMAKE_LFLAGS_USE_GOLD = -fuse-ld=gold
QMAKE_LINK_OBJECT_MAX = 10
QMAKE_LINK_OBJECT_SCRIPT = object_script
+QMAKE_PREFIX_SHLIB =
+QMAKE_EXTENSION_SHLIB = dll
QMAKE_PREFIX_STATICLIB = lib
QMAKE_EXTENSION_STATICLIB = a
+QMAKE_LIB_EXTENSIONS = a dll.a
QMAKE_LIBS =
QMAKE_LIBS_CORE = -lole32 -luuid -lws2_32 -ladvapi32 -lshell32 -luser32 -lkernel32
diff --git a/mkspecs/win32-g++/qplatformdefs.h b/mkspecs/win32-g++/qplatformdefs.h
index b4ba092d3b..ef3c518262 100644
--- a/mkspecs/win32-g++/qplatformdefs.h
+++ b/mkspecs/win32-g++/qplatformdefs.h
@@ -52,7 +52,6 @@
#include <errno.h>
#include <sys/stat.h>
#include <stdlib.h>
-#include <qt_windows.h>
#include <limits.h>
#if !defined(_WIN32_WINNT) || (_WIN32_WINNT-0 < 0x0500)
diff --git a/mkspecs/win32-icc/qmake.conf b/mkspecs/win32-icc/qmake.conf
index 0e6a2cbba4..c9f6748b6c 100644
--- a/mkspecs/win32-icc/qmake.conf
+++ b/mkspecs/win32-icc/qmake.conf
@@ -77,6 +77,9 @@ QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:console
QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:windows
QMAKE_LFLAGS_DLL = /DLL
QMAKE_LFLAGS_LTCG = $$QMAKE_CFLAGS_LTCG
+QMAKE_PREFIX_SHLIB =
+QMAKE_EXTENSION_SHLIB = dll
+QMAKE_PREFIX_STATICLIB =
QMAKE_EXTENSION_STATICLIB = lib
QMAKE_LIBS =
diff --git a/qmake/doc/src/qmake-manual.qdoc b/qmake/doc/src/qmake-manual.qdoc
index bc2b4a57e9..e7351edf5b 100644
--- a/qmake/doc/src/qmake-manual.qdoc
+++ b/qmake/doc/src/qmake-manual.qdoc
@@ -728,8 +728,7 @@
\section2 Creating and Moving Xcode Projects
Developers on OS X can take advantage of the qmake support for Xcode
- project files, as described in
- \l{Qt is OS X Native#Development Tools}{Qt is OS X Native},
+ project files, as described in \l{Qt for OS X#Additional Command-Line Options}{Qt for OS X} documentation.
by running qmake to generate an Xcode project from an existing qmake project
file. For example:
@@ -4467,7 +4466,7 @@
*/
/*!
- \target qmake-getting-started
+ \keyword qmake-getting-started
\page qmake-tutorial.html
\title Getting Started
\contentspage {qmake Manual}{Contents}
diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp
index 7ff1d97b16..ccb3cfe810 100644
--- a/qmake/generators/mac/pbuilder_pbx.cpp
+++ b/qmake/generators/mac/pbuilder_pbx.cpp
@@ -417,20 +417,24 @@ public:
inline QString groupName() const { return group; }
inline QString compilerName() const { return compiler; }
inline bool isObjectOutput(const QString &file) const {
- bool ret = object_output;
- for(int i = 0; !ret && i < Option::c_ext.size(); ++i) {
- if(file.endsWith(Option::c_ext.at(i))) {
- ret = true;
- break;
- }
+ if (object_output)
+ return true;
+
+ if (file.endsWith(Option::objc_ext))
+ return true;
+ if (file.endsWith(Option::objcpp_ext))
+ return true;
+
+ for (int i = 0; i < Option::c_ext.size(); ++i) {
+ if (file.endsWith(Option::c_ext.at(i)))
+ return true;
}
- for(int i = 0; !ret && i < Option::cpp_ext.size(); ++i) {
- if(file.endsWith(Option::cpp_ext.at(i))) {
- ret = true;
- break;
- }
+ for (int i = 0; i < Option::cpp_ext.size(); ++i) {
+ if (file.endsWith(Option::cpp_ext.at(i)))
+ return true;
}
- return ret;
+
+ return false;
}
};
@@ -490,9 +494,9 @@ static QString xcodeFiletypeForFilename(const QString &filename)
return "sourcecode.c.h";
}
- if (filename.endsWith(QStringLiteral(".mm")))
+ if (filename.endsWith(Option::objcpp_ext))
return QStringLiteral("sourcecode.cpp.objcpp");
- if (filename.endsWith(QStringLiteral(".m")))
+ if (filename.endsWith(Option::objc_ext))
return QStringLiteral("sourcecode.c.objc");
if (filename.endsWith(QStringLiteral(".framework")))
return QStringLiteral("wrapper.framework");
@@ -816,7 +820,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
for(int x = 0; x < tmp.count();) {
bool remove = false;
QString library, name;
- ProString opt = tmp[x].trimmed();
+ ProString opt = tmp[x];
if(opt.startsWith("-L")) {
QString r = opt.mid(2).toQString();
fixForOutput(r);
@@ -833,8 +837,8 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
encode the version number in the Project file which might be a bad
things in days to come? --Sam
*/
- QString lib_file = (*lit) + Option::dir_sep + lib;
- if(QMakeMetaInfo::libExists(lib_file)) {
+ QString lib_file = QMakeMetaInfo::findLib(Option::normalizePath((*lit) + Option::dir_sep + lib));
+ if (!lib_file.isEmpty()) {
QMakeMetaInfo libinfo(project);
if(libinfo.readLib(lib_file)) {
if(!libinfo.isEmpty("QMAKE_PRL_TARGET")) {
diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp
index 4a03fafd77..6f844a5c4d 100644
--- a/qmake/generators/makefile.cpp
+++ b/qmake/generators/makefile.cpp
@@ -252,10 +252,11 @@ MakefileGenerator::setProjectFile(QMakeProject *p)
else
target_mode = TARG_UNIX_MODE;
init();
- findLibraries();
- if(Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE &&
- project->isActiveConfig("link_prl")) //load up prl's'
- processPrlFiles();
+ bool linkPrl = (Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE)
+ && project->isActiveConfig("link_prl");
+ bool mergeLflags = !project->isActiveConfig("no_smart_library_merge")
+ && !project->isActiveConfig("no_lflags_merge");
+ findLibraries(linkPrl, mergeLflags);
}
ProStringList
@@ -377,6 +378,13 @@ MakefileGenerator::init()
ProValueMap &v = project->variables();
+ v["QMAKE_BUILTIN_COMPILERS"] = ProStringList() << "C" << "CXX";
+
+ v["QMAKE_LANGUAGE_C"] = ProString("c");
+ v["QMAKE_LANGUAGE_CXX"] = ProString("c++");
+ v["QMAKE_LANGUAGE_OBJC"] = ProString("objective-c");
+ v["QMAKE_LANGUAGE_OBJCXX"] = ProString("objective-c++");
+
if (v["TARGET"].isEmpty())
warn_msg(WarnLogic, "TARGET is empty");
@@ -871,65 +879,59 @@ MakefileGenerator::init()
bool
MakefileGenerator::processPrlFile(QString &file)
{
- bool ret = false, try_replace_file=false;
- QString meta_file, orig_file = file;
- if(QMakeMetaInfo::libExists(file)) {
+ bool try_replace_file = false;
+ QString f = fileFixify(file, FileFixifyBackwards);
+ QString meta_file = QMakeMetaInfo::findLib(f);
+ if (!meta_file.isEmpty()) {
try_replace_file = true;
- meta_file = file;
- file = "";
} else {
- QString tmp = file;
+ QString tmp = f;
int ext = tmp.lastIndexOf('.');
if(ext != -1)
tmp = tmp.left(ext);
- meta_file = tmp;
- }
-// meta_file = fileFixify(meta_file);
- QString real_meta_file = Option::normalizePath(meta_file);
- if(!meta_file.isEmpty()) {
- QString f = fileFixify(real_meta_file, FileFixifyBackwards);
- if(QMakeMetaInfo::libExists(f)) {
- QMakeMetaInfo libinfo(project);
- debug_msg(1, "Processing PRL file: %s", real_meta_file.toLatin1().constData());
- if(!libinfo.readLib(f)) {
- fprintf(stderr, "Error processing meta file: %s\n", real_meta_file.toLatin1().constData());
- } else if(project->isActiveConfig("no_read_prl_" + libinfo.type().toLower())) {
- debug_msg(2, "Ignored meta file %s [%s]", real_meta_file.toLatin1().constData(), libinfo.type().toLatin1().constData());
- } else {
- ret = true;
- project->values("QMAKE_CURRENT_PRL_LIBS") = libinfo.values("QMAKE_PRL_LIBS");
- ProStringList &defs = project->values("DEFINES");
- const ProStringList &prl_defs = project->values("PRL_EXPORT_DEFINES");
- foreach (const ProString &def, libinfo.values("QMAKE_PRL_DEFINES"))
- if (!defs.contains(def) && prl_defs.contains(def))
- defs.append(def);
- if(try_replace_file && !libinfo.isEmpty("QMAKE_PRL_TARGET")) {
- QString dir;
- int slsh = real_meta_file.lastIndexOf('/');
- if(slsh != -1)
- dir = real_meta_file.left(slsh+1);
- file = libinfo.first("QMAKE_PRL_TARGET").toQString();
- if(QDir::isRelativePath(file))
- file.prepend(dir);
- }
- }
- }
- if(ret) {
- QString mf = QMakeMetaInfo::findLib(meta_file);
- if(project->values("QMAKE_PRL_INTERNAL_FILES").indexOf(mf) == -1)
- project->values("QMAKE_PRL_INTERNAL_FILES").append(mf);
- if(project->values("QMAKE_INTERNAL_INCLUDED_FILES").indexOf(mf) == -1)
- project->values("QMAKE_INTERNAL_INCLUDED_FILES").append(mf);
- }
+ meta_file = QMakeMetaInfo::findLib(tmp);
}
- if(try_replace_file && file.isEmpty()) {
-#if 0
- warn_msg(WarnLogic, "Found prl [%s] file with no target [%s]!", meta_file.toLatin1().constData(),
- orig_file.toLatin1().constData());
-#endif
- file = orig_file;
+ if (meta_file.isEmpty())
+ return false;
+ QMakeMetaInfo libinfo(project);
+ debug_msg(1, "Processing PRL file: %s", meta_file.toLatin1().constData());
+ if (!libinfo.readLib(meta_file)) {
+ fprintf(stderr, "Error processing meta file %s\n", meta_file.toLatin1().constData());
+ return false;
}
- return ret;
+ if (project->isActiveConfig("no_read_prl_" + libinfo.type().toLower())) {
+ debug_msg(2, "Ignored meta file %s [%s]",
+ meta_file.toLatin1().constData(), libinfo.type().toLatin1().constData());
+ return false;
+ }
+ project->values("QMAKE_CURRENT_PRL_LIBS") = libinfo.values("QMAKE_PRL_LIBS");
+ ProStringList &defs = project->values("DEFINES");
+ const ProStringList &prl_defs = project->values("PRL_EXPORT_DEFINES");
+ foreach (const ProString &def, libinfo.values("QMAKE_PRL_DEFINES"))
+ if (!defs.contains(def) && prl_defs.contains(def))
+ defs.append(def);
+ if (try_replace_file) {
+ ProString tgt = libinfo.first("QMAKE_PRL_TARGET");
+ if (tgt.isEmpty()) {
+ fprintf(stderr, "Error: %s does not define QMAKE_PRL_TARGET\n",
+ meta_file.toLatin1().constData());
+ } else if (!tgt.contains('.')) {
+ fprintf(stderr, "Error: %s defines QMAKE_PRL_TARGET without extension\n",
+ meta_file.toLatin1().constData());
+ } else {
+ int off = qMax(file.lastIndexOf('/'), file.lastIndexOf('\\')) + 1;
+ debug_msg(1, " Replacing library reference %s with %s",
+ file.mid(off).toLatin1().constData(),
+ tgt.toQString().toLatin1().constData());
+ file.replace(off, 1000, tgt.toQString());
+ }
+ }
+ QString mf = fileFixify(meta_file);
+ if (!project->values("QMAKE_PRL_INTERNAL_FILES").contains(mf))
+ project->values("QMAKE_PRL_INTERNAL_FILES").append(mf);
+ if (!project->values("QMAKE_INTERNAL_INCLUDED_FILES").contains(mf))
+ project->values("QMAKE_INTERNAL_INCLUDED_FILES").append(mf);
+ return true;
}
void
@@ -944,12 +946,6 @@ MakefileGenerator::filterIncludedFiles(const char *var)
}
}
-void
-MakefileGenerator::processPrlFiles()
-{
- qFatal("MakefileGenerator::processPrlFiles() called!");
-}
-
static QString
qv(const ProString &val)
{
@@ -968,10 +964,6 @@ qv(const ProStringList &val)
void
MakefileGenerator::writePrlFile(QTextStream &t)
{
- ProString target = project->first("TARGET");
- int slsh = target.lastIndexOf(Option::dir_sep);
- if(slsh != -1)
- target.chopFront(slsh + 1);
QString bdir = Option::output_dir;
if(bdir.isEmpty())
bdir = qmake_getpwd();
@@ -981,7 +973,7 @@ MakefileGenerator::writePrlFile(QTextStream &t)
if(!project->isEmpty("QMAKE_ABSOLUTE_SOURCE_PATH"))
t << "QMAKE_PRL_SOURCE_DIR =" << qv(project->first("QMAKE_ABSOLUTE_SOURCE_PATH")) << endl;
- t << "QMAKE_PRL_TARGET =" << qv(target) << endl;
+ t << "QMAKE_PRL_TARGET =" << qv(project->first("LIB_TARGET")) << endl;
if(!project->isEmpty("PRL_EXPORT_DEFINES"))
t << "QMAKE_PRL_DEFINES =" << qv(project->values("PRL_EXPORT_DEFINES")) << endl;
if(!project->isEmpty("PRL_EXPORT_CFLAGS"))
@@ -1151,12 +1143,28 @@ MakefileGenerator::writeObj(QTextStream &t, const char *src)
<< " " << escapeDependencyPaths(findDependencies(srcf)).join(" \\\n\t\t");
ProKey comp;
- for(QStringList::Iterator cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit) {
- if((*sit).endsWith((*cppit))) {
- comp = "QMAKE_RUN_CXX";
- break;
+ foreach (const ProString &compiler, project->values("QMAKE_BUILTIN_COMPILERS")) {
+ // Unfortunately we were not consistent about the C++ naming
+ ProString extensionSuffix = compiler;
+ if (extensionSuffix == "CXX")
+ extensionSuffix = ProString("CPP");
+
+ // Nor the C naming
+ ProString compilerSuffix = compiler;
+ if (compilerSuffix == "C")
+ compilerSuffix = ProString("CC");
+
+ foreach (const ProString &extension, project->values(ProKey("QMAKE_EXT_" + extensionSuffix))) {
+ if ((*sit).endsWith(extension)) {
+ comp = ProKey("QMAKE_RUN_" + compilerSuffix);
+ break;
+ }
}
+
+ if (!comp.isNull())
+ break;
}
+
if (comp.isEmpty())
comp = "QMAKE_RUN_CC";
if (!project->isEmpty(comp)) {
@@ -2744,6 +2752,22 @@ MakefileGenerator::fileInfo(QString file) const
return fi;
}
+MakefileGenerator::LibFlagType
+MakefileGenerator::parseLibFlag(const ProString &flag, ProString *arg)
+{
+ if (flag.startsWith("-L")) {
+ *arg = flag.mid(2);
+ return LibFlagPath;
+ }
+ if (flag.startsWith("-l")) {
+ *arg = flag.mid(2);
+ return LibFlagLib;
+ }
+ if (flag.startsWith('-'))
+ return LibFlagOther;
+ return LibFlagFile;
+}
+
ProStringList
MakefileGenerator::fixLibFlags(const ProKey &var)
{
@@ -3253,7 +3277,8 @@ MakefileGenerator::writePkgConfigFile()
int suffix = bundle.lastIndexOf(".framework");
if (suffix != -1)
bundle = bundle.left(suffix);
- pkgConfiglibName = "-framework " + bundle + " ";
+ t << "-framework ";
+ pkgConfiglibName = bundle.toQString();
} else {
if (!project->values("QMAKE_DEFAULT_LIBDIRS").contains(libDir))
t << "-L${libdir} ";
diff --git a/qmake/generators/makefile.h b/qmake/generators/makefile.h
index 07483dbcb0..61b8f9ac60 100644
--- a/qmake/generators/makefile.h
+++ b/qmake/generators/makefile.h
@@ -197,11 +197,10 @@ protected:
QString prlFileName(bool fixify=true);
void writePrlFile();
bool processPrlFile(QString &);
- virtual void processPrlFiles();
virtual void writePrlFile(QTextStream &);
//make sure libraries are found
- virtual bool findLibraries();
+ virtual bool findLibraries(bool linkPrl, bool mergeLflags);
//for retrieving values and lists of values
virtual QString var(const ProKey &var) const;
@@ -221,6 +220,8 @@ protected:
QString filePrefixRoot(const QString &, const QString &);
+ enum LibFlagType { LibFlagLib, LibFlagPath, LibFlagFile, LibFlagOther };
+ virtual LibFlagType parseLibFlag(const ProString &flag, ProString *arg);
ProStringList fixLibFlags(const ProKey &var);
virtual ProString fixLibFlag(const ProString &lib);
@@ -276,7 +277,7 @@ inline bool MakefileGenerator::noIO() const
inline QString MakefileGenerator::defaultInstall(const QString &)
{ return QString(""); }
-inline bool MakefileGenerator::findLibraries()
+inline bool MakefileGenerator::findLibraries(bool, bool)
{ return true; }
inline MakefileGenerator::~MakefileGenerator()
diff --git a/qmake/generators/projectgenerator.cpp b/qmake/generators/projectgenerator.cpp
index 9b1796c45d..7d042ce66c 100644
--- a/qmake/generators/projectgenerator.cpp
+++ b/qmake/generators/projectgenerator.cpp
@@ -166,7 +166,7 @@ ProjectGenerator::init()
QString nd = newdir;
if(nd == ".")
nd = "";
- else if(!nd.isEmpty() && !nd.endsWith(QString(QChar(QDir::separator()))))
+ else if (!nd.isEmpty() && !nd.endsWith(QDir::separator()))
nd += QDir::separator();
nd += profiles[i];
fileFixify(nd);
diff --git a/qmake/generators/unix/unixmake.cpp b/qmake/generators/unix/unixmake.cpp
index 03196fbc3a..1d9ebb35e3 100644
--- a/qmake/generators/unix/unixmake.cpp
+++ b/qmake/generators/unix/unixmake.cpp
@@ -45,21 +45,11 @@ QT_BEGIN_NAMESPACE
void
UnixMakefileGenerator::init()
{
- if(project->isEmpty("QMAKE_EXTENSION_SHLIB")) {
- if(project->isEmpty("QMAKE_CYGWIN_SHLIB")) {
- project->values("QMAKE_EXTENSION_SHLIB").append("so");
- } else {
- project->values("QMAKE_EXTENSION_SHLIB").append("dll");
- }
- }
-
ProStringList &configs = project->values("CONFIG");
if(project->isEmpty("ICON") && !project->isEmpty("RC_FILE"))
project->values("ICON") = project->values("RC_FILE");
if(project->isEmpty("QMAKE_EXTENSION_PLUGIN"))
project->values("QMAKE_EXTENSION_PLUGIN").append(project->first("QMAKE_EXTENSION_SHLIB"));
- if(project->isEmpty("QMAKE_LIBTOOL"))
- project->values("QMAKE_LIBTOOL").append("libtool --silent");
project->values("QMAKE_ORIG_TARGET") = project->values("TARGET");
@@ -111,11 +101,6 @@ UnixMakefileGenerator::init()
project->values("QMAKE_LFLAGS") += project->values("QMAKE_LFLAGS_PREBIND");
if(!project->isEmpty("QMAKE_INCDIR"))
project->values("INCLUDEPATH") += project->values("QMAKE_INCDIR");
- project->values("QMAKE_L_FLAG")
- << (project->isActiveConfig("rvct_linker") ? "--userlibpath "
- : project->isActiveConfig("armcc_linker") ? "-L--userlibpath="
- : project->isActiveConfig("ti_linker") ? "--search_path="
- : "-L");
ProStringList ldadd;
if(!project->isEmpty("QMAKE_LIBDIR")) {
const ProStringList &libdirs = project->values("QMAKE_LIBDIR");
@@ -157,19 +142,19 @@ UnixMakefileGenerator::init()
if(project->isActiveConfig("GNUmake") && !project->isEmpty("QMAKE_CFLAGS_DEPS"))
include_deps = true; //do not generate deps
- if(project->isActiveConfig("compile_libtool"))
- Option::obj_ext = ".lo"; //override the .o
MakefileGenerator::init();
- QString comps[] = { "C", "CXX", "OBJC", "OBJCXX", QString() };
- for(int i = 0; !comps[i].isNull(); i++) {
+ if (project->isActiveConfig("objective_c"))
+ project->values("QMAKE_BUILTIN_COMPILERS") << "OBJC" << "OBJCXX";
+
+ foreach (const ProString &compiler, project->values("QMAKE_BUILTIN_COMPILERS")) {
QString compile_flag = var("QMAKE_COMPILE_FLAG");
if(compile_flag.isEmpty())
compile_flag = "-c";
if(doPrecompiledHeaders() && !project->isEmpty("PRECOMPILED_HEADER")) {
- QString pchFlags = var(ProKey("QMAKE_" + comps[i] + "FLAGS_USE_PRECOMPILE"));
+ QString pchFlags = var(ProKey("QMAKE_" + compiler + "FLAGS_USE_PRECOMPILE"));
QString pchBaseName;
if(!project->isEmpty("PRECOMPILED_DIR")) {
@@ -196,22 +181,11 @@ UnixMakefileGenerator::init()
pchBaseName += project->first("QMAKE_PCH_OUTPUT_EXT").toQString();
pchBaseName += Option::dir_sep;
- QString pchOutputFile;
-
- if(comps[i] == "C") {
- pchOutputFile = "c";
- } else if(comps[i] == "CXX") {
- pchOutputFile = "c++";
- } else if(project->isActiveConfig("objective_c")) {
- if(comps[i] == "OBJC")
- pchOutputFile = "objective-c";
- else if(comps[i] == "OBJCXX")
- pchOutputFile = "objective-c++";
- }
- if(!pchOutputFile.isEmpty()) {
+ ProString language = project->first(ProKey("QMAKE_LANGUAGE_" + compiler));
+ if (!language.isEmpty()) {
pchFlags.replace("${QMAKE_PCH_OUTPUT}",
- escapeFilePath(pchBaseName + pchOutputFile + headerSuffix));
+ escapeFilePath(pchBaseName + language + headerSuffix));
}
}
@@ -219,26 +193,30 @@ UnixMakefileGenerator::init()
compile_flag += " " + pchFlags;
}
- QString cflags;
- if(comps[i] == "OBJC" || comps[i] == "OBJCXX")
- cflags += " $(CFLAGS)";
- else
- cflags += " $(" + comps[i] + "FLAGS)";
- compile_flag += cflags + " $(INCPATH)";
+ QString compilerExecutable;
+ if (compiler == "C" || compiler == "OBJC") {
+ compilerExecutable = "$(CC)";
+ compile_flag += " $(CFLAGS)";
+ } else {
+ compilerExecutable = "$(CXX)";
+ compile_flag += " $(CXXFLAGS)";
+ }
+
+ compile_flag += " $(INCPATH)";
- QString compiler = comps[i];
- if (compiler == "C")
- compiler = "CC";
+ ProString compilerVariable = compiler;
+ if (compilerVariable == "C")
+ compilerVariable = ProString("CC");
- const ProKey runComp("QMAKE_RUN_" + compiler);
+ const ProKey runComp("QMAKE_RUN_" + compilerVariable);
if(project->isEmpty(runComp))
- project->values(runComp).append("$(" + compiler + ") " + compile_flag + " " + var("QMAKE_CC_O_FLAG") + "$obj $src");
- const ProKey runCompImp("QMAKE_RUN_" + compiler + "_IMP");
+ project->values(runComp).append(compilerExecutable + " " + compile_flag + " " + var("QMAKE_CC_O_FLAG") + "$obj $src");
+ const ProKey runCompImp("QMAKE_RUN_" + compilerVariable + "_IMP");
if(project->isEmpty(runCompImp))
- project->values(runCompImp).append("$(" + compiler + ") " + compile_flag + " " + var("QMAKE_CC_O_FLAG") + "\"$@\" \"$<\"");
+ project->values(runCompImp).append(compilerExecutable + " " + compile_flag + " " + var("QMAKE_CC_O_FLAG") + "\"$@\" \"$<\"");
}
- if (project->isActiveConfig("mac") && !project->isEmpty("TARGET") && !project->isActiveConfig("compile_libtool") &&
+ if (project->isActiveConfig("mac") && !project->isEmpty("TARGET") &&
((project->isActiveConfig("build_pass") || project->isEmpty("BUILDS")))) {
ProString bundle;
if(project->isActiveConfig("bundle") && !project->isEmpty("QMAKE_BUNDLE_EXTENSION")) {
@@ -292,6 +270,11 @@ UnixMakefileGenerator::init()
init2();
project->values("QMAKE_INTERNAL_PRL_LIBS") << "QMAKE_LIBS";
+ ProString target = project->first("TARGET");
+ int slsh = target.lastIndexOf(Option::dir_sep);
+ if (slsh != -1)
+ target.chopFront(slsh + 1);
+ project->values("LIB_TARGET").prepend(target);
if(!project->isEmpty("QMAKE_MAX_FILES_PER_AR")) {
bool ok;
int max_files = project->first("QMAKE_MAX_FILES_PER_AR").toInt(&ok);
@@ -315,56 +298,14 @@ UnixMakefileGenerator::init()
project->values("QMAKE_INTERNAL_PRL_LIBS") << "QMAKE_AR_SUBLIBS";
}
}
-
- if(project->isActiveConfig("compile_libtool")) {
- static const char * const libtoolify[] = {
- "QMAKE_RUN_CC", "QMAKE_RUN_CC_IMP", "QMAKE_RUN_CXX", "QMAKE_RUN_CXX_IMP",
- "QMAKE_LINK_THREAD", "QMAKE_LINK", "QMAKE_AR_CMD", "QMAKE_LINK_SHLIB_CMD", 0
- };
- for (int i = 0; libtoolify[i]; i++) {
- ProStringList &l = project->values(libtoolify[i]);
- if(!l.isEmpty()) {
- QString libtool_flags, comp_flags;
- if (!strncmp(libtoolify[i], "QMAKE_LINK", 10) || !strcmp(libtoolify[i], "QMAKE_AR_CMD")) {
- libtool_flags += " --mode=link";
- if(project->isActiveConfig("staticlib")) {
- libtool_flags += " -static";
- } else {
- if(!project->isEmpty("QMAKE_LIB_FLAG")) {
- int maj = project->first("VER_MAJ").toInt();
- int min = project->first("VER_MIN").toInt();
- int pat = project->first("VER_PAT").toInt();
- comp_flags += " -version-info " + QString::number(10*maj + min) +
- ":" + QString::number(pat) + ":0";
- if (strcmp(libtoolify[i], "QMAKE_AR_CMD")) {
- QString rpath = Option::output_dir;
- if(!project->isEmpty("DESTDIR")) {
- rpath = project->first("DESTDIR").toQString();
- if(QDir::isRelativePath(rpath))
- rpath.prepend(Option::output_dir + Option::dir_sep);
- }
- comp_flags += " -rpath " + escapeFilePath(Option::fixPathToTargetOS(rpath, false));
- }
- }
- }
- if(project->isActiveConfig("plugin"))
- libtool_flags += " -module";
- } else {
- libtool_flags += " --mode=compile";
- }
- l.first().prepend("$(LIBTOOL)" + libtool_flags + " ");
- if(!comp_flags.isEmpty())
- l.first() += comp_flags;
- }
- }
- }
}
QStringList
-&UnixMakefileGenerator::findDependencies(const QString &file)
+&UnixMakefileGenerator::findDependencies(const QString &f)
{
- QStringList &ret = MakefileGenerator::findDependencies(file);
+ QStringList &ret = MakefileGenerator::findDependencies(f);
if (doPrecompiledHeaders() && !project->isEmpty("PRECOMPILED_HEADER")) {
+ ProString file = f;
QString header_prefix;
if(!project->isEmpty("PRECOMPILED_DIR"))
header_prefix = project->first("PRECOMPILED_DIR").toQString();
@@ -384,45 +325,33 @@ QStringList
QString header_suffix = project->isActiveConfig("clang_pch_style")
? project->first("QMAKE_PCH_OUTPUT_EXT").toQString() : "";
header_prefix += Option::dir_sep + project->first("QMAKE_PRECOMP_PREFIX");
- for(QStringList::Iterator it = Option::c_ext.begin(); it != Option::c_ext.end(); ++it) {
- if(file.endsWith(*it)) {
- if(!project->isEmpty("QMAKE_CFLAGS_PRECOMPILE")) {
- QString precomp_c_h = header_prefix + "c" + header_suffix;
- if(!ret.contains(precomp_c_h))
- ret += precomp_c_h;
- }
- if(project->isActiveConfig("objective_c")) {
- if(!project->isEmpty("QMAKE_OBJCFLAGS_PRECOMPILE")) {
- QString precomp_objc_h = header_prefix + "objective-c" + header_suffix;
- if(!ret.contains(precomp_objc_h))
- ret += precomp_objc_h;
- }
- if(!project->isEmpty("QMAKE_OBJCXXFLAGS_PRECOMPILE")) {
- QString precomp_objcpp_h = header_prefix + "objective-c++" + header_suffix;
- if(!ret.contains(precomp_objcpp_h))
- ret += precomp_objcpp_h;
- }
- }
- break;
- }
- }
- for(QStringList::Iterator it = Option::cpp_ext.begin(); it != Option::cpp_ext.end(); ++it) {
- if(file.endsWith(*it)) {
- if(!project->isEmpty("QMAKE_CXXFLAGS_PRECOMPILE")) {
- QString precomp_cpp_h = header_prefix + "c++" + header_suffix;
- if(!ret.contains(precomp_cpp_h))
- ret += precomp_cpp_h;
- }
- if(project->isActiveConfig("objective_c")) {
- if(!project->isEmpty("QMAKE_OBJCXXFLAGS_PRECOMPILE")) {
- QString precomp_objcpp_h = header_prefix + "objective-c++" + header_suffix;
- if(!ret.contains(precomp_objcpp_h))
- ret += precomp_objcpp_h;
- }
- }
- break;
+
+ foreach (const ProString &compiler, project->values("QMAKE_BUILTIN_COMPILERS")) {
+ if (project->isEmpty(ProKey("QMAKE_" + compiler + "FLAGS_PRECOMPILE")))
+ continue;
+
+ ProString language = project->first(ProKey("QMAKE_LANGUAGE_" + compiler));
+ if (language.isEmpty())
+ continue;
+
+ // Unfortunately we were not consistent about the C++ naming
+ ProString extensionSuffix = compiler;
+ if (extensionSuffix == "CXX")
+ extensionSuffix = ProString("CPP");
+
+ foreach (const ProString &extension, project->values(ProKey("QMAKE_EXT_" + extensionSuffix))) {
+ if (!file.endsWith(extension.toQString()))
+ continue;
+
+ QString precompiledHeader = header_prefix + language + header_suffix;
+ if (!ret.contains(precompiledHeader))
+ ret += precompiledHeader;
+
+ goto foundPrecompiledDependency;
}
}
+ foundPrecompiledDependency:
+ ; // Hurray!!
}
}
return ret;
@@ -435,20 +364,19 @@ UnixMakefileGenerator::fixLibFlag(const ProString &lib)
}
bool
-UnixMakefileGenerator::findLibraries()
+UnixMakefileGenerator::findLibraries(bool linkPrl, bool mergeLflags)
{
- ProString libArg = project->first("QMAKE_L_FLAG");
- if (libArg == "-L")
- libArg.clear();
- QList<QMakeLocalFileName> libdirs;
- int libidx = 0;
+ QList<QMakeLocalFileName> libdirs, frameworkdirs;
+ int libidx = 0, fwidx = 0;
foreach (const ProString &dlib, project->values("QMAKE_DEFAULT_LIBDIRS"))
libdirs.append(QMakeLocalFileName(dlib.toQString()));
+ frameworkdirs.append(QMakeLocalFileName("/System/Library/Frameworks"));
+ frameworkdirs.append(QMakeLocalFileName("/Library/Frameworks"));
static const char * const lflags[] = { "QMAKE_LIBS", "QMAKE_LIBS_PRIVATE", 0 };
for (int i = 0; lflags[i]; i++) {
ProStringList &l = project->values(lflags[i]);
for (ProStringList::Iterator it = l.begin(); it != l.end(); ) {
- QString stub, dir, extn, opt = (*it).trimmed().toQString();
+ QString opt = (*it).toQString();
if(opt.startsWith("-")) {
if(opt.startsWith("-L")) {
QString lib = opt.mid(2);
@@ -459,173 +387,60 @@ UnixMakefileGenerator::findLibraries()
continue;
}
libdirs.insert(libidx++, f);
- if (!libArg.isEmpty())
- *it = libArg + f.real();
} else if(opt.startsWith("-l")) {
- if (project->isActiveConfig("rvct_linker") || project->isActiveConfig("armcc_linker")) {
- (*it) = "lib" + opt.mid(2) + ".so";
- } else if (project->isActiveConfig("ti_linker")) {
- (*it) = opt.mid(2);
- } else {
- stub = opt.mid(2);
- }
- } else if (target_mode == TARG_MAC_MODE && opt.startsWith("-framework")) {
- if (opt.length() == 10)
- ++it;
- // Skip
- }
- } else {
- extn = dir = "";
- stub = opt;
- int slsh = opt.lastIndexOf(Option::dir_sep);
- if(slsh != -1) {
- dir = opt.left(slsh);
- stub = opt.mid(slsh+1);
- }
- QRegExp stub_reg("^.*lib(" + stub + "[^./=]*)\\.(.*)$");
- if(stub_reg.exactMatch(stub)) {
- stub = stub_reg.cap(1);
- extn = stub_reg.cap(2);
- }
- }
- if(!stub.isEmpty()) {
- stub += project->first(ProKey("QMAKE_" + stub.toUpper() + "_SUFFIX")).toQString();
- bool found = false;
- ProStringList extens;
- if(!extn.isNull())
- extens << extn;
- else
+ QString lib = opt.mid(2);
+ ProStringList extens;
extens << project->first("QMAKE_EXTENSION_SHLIB") << "a";
- for (ProStringList::Iterator extit = extens.begin(); extit != extens.end(); ++extit) {
- if(dir.isNull()) {
- for(QList<QMakeLocalFileName>::Iterator dep_it = libdirs.begin(); dep_it != libdirs.end(); ++dep_it) {
- QString pathToLib = ((*dep_it).local() + '/'
- + project->first("QMAKE_PREFIX_SHLIB")
- + stub + "." + (*extit));
- if(exists(pathToLib)) {
- (*it) = "-l" + stub;
- found = true;
- break;
- }
- }
- } else {
- QString lib = dir + project->first("QMAKE_PREFIX_SHLIB") + stub + "." + (*extit);
- if (exists(lib)) {
- (*it) = lib;
- found = true;
- break;
- }
- }
- }
- if(!found && project->isActiveConfig("compile_libtool")) {
- for(int dep_i = 0; dep_i < libdirs.size(); ++dep_i) {
- if (exists(libdirs[dep_i].local() + '/' + project->first("QMAKE_PREFIX_SHLIB") + stub + Option::libtool_ext)) {
- (*it) = libdirs[dep_i].real() + Option::dir_sep + project->first("QMAKE_PREFIX_SHLIB") + stub + Option::libtool_ext;
- found = true;
- break;
- }
- }
- }
- }
- ++it;
- }
- }
- return false;
-}
-
-QString linkLib(const QString &file, const QString &libName) {
- QString ret;
- QRegExp reg("^.*lib(" + QRegExp::escape(libName) + "[^./=]*).*$");
- if(reg.exactMatch(file))
- ret = "-l" + reg.cap(1);
- return ret;
-}
-
-void
-UnixMakefileGenerator::processPrlFiles()
-{
- const QString libArg = project->first("QMAKE_L_FLAG").toQString();
- QList<QMakeLocalFileName> libdirs, frameworkdirs;
- int libidx = 0, fwidx = 0;
- foreach (const ProString &dlib, project->values("QMAKE_DEFAULT_LIBDIRS"))
- libdirs.append(QMakeLocalFileName(dlib.toQString()));
- frameworkdirs.append(QMakeLocalFileName("/System/Library/Frameworks"));
- frameworkdirs.append(QMakeLocalFileName("/Library/Frameworks"));
- static const char * const lflags[] = { "QMAKE_LIBS", "QMAKE_LIBS_PRIVATE", 0 };
- for (int i = 0; lflags[i]; i++) {
- ProStringList &l = project->values(lflags[i]);
- for(int lit = 0; lit < l.size(); ++lit) {
- QString opt = l.at(lit).trimmed().toQString();
- if(opt.startsWith("-")) {
- if (opt.startsWith(libArg)) {
- QMakeLocalFileName l(opt.mid(libArg.length()));
- if(!libdirs.contains(l))
- libdirs.insert(libidx++, l);
- } else if(opt.startsWith("-l")) {
- QString lib = opt.right(opt.length() - 2);
- QString prl_ext = project->first(ProKey("QMAKE_" + lib.toUpper() + "_SUFFIX")).toQString();
- for(int dep_i = 0; dep_i < libdirs.size(); ++dep_i) {
- const QMakeLocalFileName &lfn = libdirs[dep_i];
- if(!project->isActiveConfig("compile_libtool")) { //give them the .libs..
- QString la = lfn.local() + '/' + project->first("QMAKE_PREFIX_SHLIB") + lib + Option::libtool_ext;
- if (exists(la) && QFile::exists(lfn.local() + "/.libs")) {
- QString dot_libs = lfn.real() + Option::dir_sep + ".libs";
- l.append("-L" + dot_libs);
- libdirs.insert(libidx++, QMakeLocalFileName(dot_libs));
- }
- }
-
- QString prl = lfn.local() + '/' + project->first("QMAKE_PREFIX_SHLIB") + lib + prl_ext;
- if(processPrlFile(prl)) {
- if(prl.startsWith(lfn.local()))
- prl.replace(0, lfn.local().length(), lfn.real());
- opt = linkLib(prl, lib);
- break;
+ for (QList<QMakeLocalFileName>::Iterator dep_it = libdirs.begin();
+ dep_it != libdirs.end(); ++dep_it) {
+ QString libBase = (*dep_it).local() + '/'
+ + project->first("QMAKE_PREFIX_SHLIB") + lib;
+ if (linkPrl && processPrlFile(libBase))
+ goto found;
+ for (ProStringList::Iterator extit = extens.begin(); extit != extens.end(); ++extit) {
+ if (exists(libBase + '.' + (*extit)))
+ goto found;
}
}
+ found: ;
} else if (target_mode == TARG_MAC_MODE && opt.startsWith("-F")) {
- QMakeLocalFileName f(opt.right(opt.length()-2));
- if(!frameworkdirs.contains(f))
+ QMakeLocalFileName f(opt.mid(2));
+ if (!frameworkdirs.contains(f))
frameworkdirs.insert(fwidx++, f);
} else if (target_mode == TARG_MAC_MODE && opt.startsWith("-framework")) {
- if(opt.length() > 11)
- opt = opt.mid(11);
- else
- opt = l.at(++lit).toQString();
- opt = opt.trimmed();
- foreach (const QMakeLocalFileName &dir, frameworkdirs) {
- QString prl = dir.local() + "/" + opt + ".framework/" + opt + Option::prl_ext;
- if(processPrlFile(prl))
- break;
+ if (linkPrl) {
+ if (opt.length() == 10)
+ opt = (*++it).toQString();
+ else
+ opt = opt.mid(10).trimmed();
+ foreach (const QMakeLocalFileName &dir, frameworkdirs) {
+ QString prl = dir.local() + "/" + opt + ".framework/" + opt + Option::prl_ext;
+ if (processPrlFile(prl))
+ break;
+ }
+ } else {
+ if (opt.length() == 10)
+ ++it;
+ // Skip
}
}
- } else if(!opt.isNull()) {
- QString lib = opt;
- processPrlFile(lib);
-#if 0
- if(ret)
- opt = linkLib(lib, "");
-#endif
- if(!opt.isEmpty())
- for (int k = 0; k < l.size(); ++k)
- l[k] = l.at(k).toQString().replace(lib, opt);
+ } else if (linkPrl) {
+ processPrlFile(opt);
}
ProStringList &prl_libs = project->values("QMAKE_CURRENT_PRL_LIBS");
- if(!prl_libs.isEmpty()) {
- for(int prl = 0; prl < prl_libs.size(); ++prl)
- l.insert(++lit, prl_libs.at(prl));
- prl_libs.clear();
- }
+ for (int prl = 0; prl < prl_libs.size(); ++prl)
+ it = l.insert(++it, prl_libs.at(prl));
+ prl_libs.clear();
+ ++it;
}
- //merge them into a logical order
- if(!project->isActiveConfig("no_smart_library_merge") && !project->isActiveConfig("no_lflags_merge")) {
+ if (mergeLflags) {
QHash<ProKey, ProStringList> lflags;
for(int lit = 0; lit < l.size(); ++lit) {
ProKey arch("default");
- ProString opt = l.at(lit).trimmed();
- if(opt.startsWith("-")) {
+ ProString opt = l.at(lit);
+ if (opt.startsWith('-')) {
if (target_mode == TARG_MAC_MODE && opt.startsWith("-Xarch")) {
if (opt.length() > 7) {
arch = opt.mid(7).toKey();
@@ -633,36 +448,27 @@ UnixMakefileGenerator::processPrlFiles()
}
}
- if (opt.startsWith(libArg) ||
- (target_mode == TARG_MAC_MODE && opt.startsWith("-F"))) {
- if(!lflags[arch].contains(opt))
+ if (opt.startsWith("-L")
+ || (target_mode == TARG_MAC_MODE && opt.startsWith("-F"))) {
+ if (!lflags[arch].contains(opt))
lflags[arch].append(opt);
- } else if(opt.startsWith("-l") || opt == "-pthread") {
- // Make sure we keep the dependency-order of libraries
- if (lflags[arch].contains(opt))
- lflags[arch].removeAll(opt);
+ } else if (opt.startsWith("-l") || opt == "-pthread") {
+ // Make sure we keep the dependency order of libraries
+ lflags[arch].removeAll(opt);
lflags[arch].append(opt);
} else if (target_mode == TARG_MAC_MODE && opt.startsWith("-framework")) {
- if(opt.length() > 11)
- opt = opt.mid(11);
- else {
+ if (opt.length() > 10) {
+ opt = opt.mid(10).trimmed();
+ } else {
opt = l.at(++lit);
- if (target_mode == TARG_MAC_MODE && opt.startsWith("-Xarch"))
+ if (opt.startsWith("-Xarch"))
opt = l.at(++lit); // The user has done the right thing and prefixed each part
}
bool found = false;
for(int x = 0; x < lflags[arch].size(); ++x) {
- ProString xf = lflags[arch].at(x);
- if(xf.startsWith("-framework")) {
- ProString framework;
- if(xf.length() > 11)
- framework = xf.mid(11);
- else
- framework = lflags[arch].at(++x);
- if(framework == opt) {
- found = true;
- break;
- }
+ if (lflags[arch].at(x) == "-framework" && lflags[arch].at(++x) == opt) {
+ found = true;
+ break;
}
}
if(!found) {
@@ -692,6 +498,7 @@ UnixMakefileGenerator::processPrlFiles()
}
}
}
+ return false;
}
QString
@@ -720,7 +527,6 @@ UnixMakefileGenerator::defaultInstall(const QString &t)
} else if(project->first("TEMPLATE") == "app") {
target = "$(QMAKE_TARGET)";
} else if(project->first("TEMPLATE") == "lib") {
- if(project->isEmpty("QMAKE_CYGWIN_SHLIB")) {
if (!project->isActiveConfig("staticlib")
&& !project->isActiveConfig("plugin")
&& !project->isActiveConfig("unversioned_libname")) {
@@ -730,7 +536,6 @@ UnixMakefileGenerator::defaultInstall(const QString &t)
links << "$(TARGET0)";
}
}
- }
}
for(int i = 0; i < targets.size(); ++i) {
QString src = targets.at(i).toQString(),
@@ -743,16 +548,7 @@ UnixMakefileGenerator::defaultInstall(const QString &t)
uninst.append("-$(DEL_FILE) " + dst);
}
- if (bundle == NoBundle && project->isActiveConfig("compile_libtool")) {
- QString src_targ = escapeFilePath(target);
- if(src_targ == "$(TARGET)")
- src_targ = "$(TARGETL)";
- QString dst_dir = fileFixify(targetdir, FileFixifyAbsolute);
- if(QDir::isRelativePath(dst_dir))
- dst_dir = Option::fixPathToTargetOS(Option::output_dir + Option::dir_sep + dst_dir);
- ret = "-$(LIBTOOL) --mode=install cp " + src_targ + ' ' + escapeFilePath(filePrefixRoot(root, dst_dir));
- uninst.append("-$(LIBTOOL) --mode=uninstall " + src_targ);
- } else {
+ {
QString src_targ = target;
if(!destdir.isEmpty())
src_targ = Option::fixPathToTargetOS(destdir + target, false);
@@ -870,7 +666,7 @@ UnixMakefileGenerator::defaultInstall(const QString &t)
if(type == "prl" && project->isActiveConfig("create_prl") && !project->isActiveConfig("no_install_prl") &&
!project->isEmpty("QMAKE_INTERNAL_PRL_FILE"))
meta = prlFileName(false);
- if(type == "libtool" && project->isActiveConfig("create_libtool") && !project->isActiveConfig("compile_libtool"))
+ if (type == "libtool" && project->isActiveConfig("create_libtool"))
meta = libtoolFileName(false);
if(type == "pkgconfig" && project->isActiveConfig("create_pc"))
meta = pkgConfigFileName(false);
diff --git a/qmake/generators/unix/unixmake.h b/qmake/generators/unix/unixmake.h
index b136ea04d0..db3f59f517 100644
--- a/qmake/generators/unix/unixmake.h
+++ b/qmake/generators/unix/unixmake.h
@@ -54,9 +54,8 @@ protected:
virtual bool doDepends() const { return !Option::mkfile::do_stub_makefile && MakefileGenerator::doDepends(); }
virtual QString defaultInstall(const QString &);
virtual ProString fixLibFlag(const ProString &lib);
- virtual void processPrlFiles();
- virtual bool findLibraries();
+ virtual bool findLibraries(bool linkPrl, bool mergeLflags);
virtual QString escapeFilePath(const QString &path) const;
ProString escapeFilePath(const ProString &path) const { return MakefileGenerator::escapeFilePath(path); }
virtual QStringList &findDependencies(const QString &);
diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp
index 975c173ea7..d0cd5d2354 100644
--- a/qmake/generators/unix/unixmake2.cpp
+++ b/qmake/generators/unix/unixmake2.cpp
@@ -53,13 +53,8 @@ UnixMakefileGenerator::writePrlFile(QTextStream &t)
{
MakefileGenerator::writePrlFile(t);
// libtool support
-
if(project->isActiveConfig("create_libtool") && project->first("TEMPLATE") == "lib") { //write .la
- if(project->isActiveConfig("compile_libtool"))
- warn_msg(WarnLogic, "create_libtool specified with compile_libtool can lead to conflicting .la\n"
- "formats, create_libtool has been disabled\n");
- else
- writeLibtoolFile();
+ writeLibtoolFile();
}
// pkg-config support
if(project->isActiveConfig("create_pc") && project->first("TEMPLATE") == "lib")
@@ -214,8 +209,6 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
t << "AR = " << var("QMAKE_AR") << endl;
t << "RANLIB = " << var("QMAKE_RANLIB") << endl;
- if(project->isActiveConfig("compile_libtool"))
- t << "LIBTOOL = " << var("QMAKE_LIBTOOL") << endl;
t << "SED = " << var("QMAKE_STREAM_EDITOR") << endl;
t << "STRIP = " << var("QMAKE_STRIP") << endl;
@@ -274,8 +267,6 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
// comment is also important as otherwise quoted use of "$(DESTDIR)" would include this
// spacing.
t << "DESTDIR = " << fileVar("DESTDIR") << "#avoid trailing-slash linebreak\n";
- if(project->isActiveConfig("compile_libtool"))
- t << "TARGETL = " << fileVar("TARGET_la") << endl;
t << "TARGET = " << fileVar("TARGET") << endl; // ### mixed use!
if(project->isActiveConfig("plugin")) {
t << "TARGETD = " << fileVar("TARGET") << endl;
@@ -307,17 +298,6 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
/* rules */
t << "first:" << (!project->isActiveConfig("no_default_goal_deps") ? " all" : "") << "\n";
- t << "####### Implicit rules\n\n";
- t << ".SUFFIXES: " << Option::obj_ext;
- for(QStringList::Iterator cit = Option::c_ext.begin(); cit != Option::c_ext.end(); ++cit)
- t << " " << (*cit);
- for(QStringList::Iterator cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit)
- t << " " << (*cppit);
- t << endl << endl;
- for(QStringList::Iterator cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit)
- t << (*cppit) << Option::obj_ext << ":\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl;
- for(QStringList::Iterator cit = Option::c_ext.begin(); cit != Option::c_ext.end(); ++cit)
- t << (*cit) << Option::obj_ext << ":\n\t" << var("QMAKE_RUN_CC_IMP") << endl << endl;
if(include_deps) {
if (project->isActiveConfig("gcc_MD_depends")) {
@@ -600,10 +580,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
if(!project->isEmpty("QMAKE_PRE_LINK"))
t << "\n\t" << var("QMAKE_PRE_LINK");
- if(project->isActiveConfig("compile_libtool")) {
- t << "\n\t"
- << var("QMAKE_LINK_SHLIB_CMD");
- } else if(project->isActiveConfig("plugin")) {
+ if (project->isActiveConfig("plugin")) {
t << "\n\t"
<< "-$(DEL_FILE) $(TARGET)\n\t"
<< var("QMAKE_LINK_SHLIB_CMD");
@@ -747,8 +724,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
writeMakeQmake(t);
if(project->isEmpty("QMAKE_FAILED_REQUIREMENTS") && !project->isActiveConfig("no_autoqmake")) {
QStringList meta_files;
- if(project->isActiveConfig("create_libtool") && project->first("TEMPLATE") == "lib" &&
- !project->isActiveConfig("compile_libtool")) { //libtool
+ if (project->isActiveConfig("create_libtool") && project->first("TEMPLATE") == "lib") { //libtool
meta_files += libtoolFileName();
}
if(project->isActiveConfig("create_pc") && project->first("TEMPLATE") == "lib") { //pkg-config
@@ -983,10 +959,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
t << "clean:" << clean_targets << "\n\t";
if(!project->isEmpty("OBJECTS")) {
- if(project->isActiveConfig("compile_libtool"))
- t << "-$(LIBTOOL) --mode=clean $(DEL_FILE) $(OBJECTS)\n\t";
- else
- t << "-$(DEL_FILE) $(OBJECTS)\n\t";
+ t << "-$(DEL_FILE) $(OBJECTS)\n\t";
}
if(doPrecompiledHeaders() && !project->isEmpty("PRECOMPILED_HEADER")) {
ProStringList precomp_files;
@@ -1017,15 +990,14 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
ProString header_suffix = project->isActiveConfig("clang_pch_style")
? project->first("QMAKE_PCH_OUTPUT_EXT") : "";
- if(!project->isEmpty("QMAKE_CFLAGS_PRECOMPILE"))
- precomp_files += precomph_out_dir + header_prefix + "c" + header_suffix;
- if(!project->isEmpty("QMAKE_CXXFLAGS_PRECOMPILE"))
- precomp_files += precomph_out_dir + header_prefix + "c++" + header_suffix;
- if(project->isActiveConfig("objective_c")) {
- if(!project->isEmpty("QMAKE_OBJCFLAGS_PRECOMPILE"))
- precomp_files += precomph_out_dir + header_prefix + "objective-c" + header_suffix;
- if(!project->isEmpty("QMAKE_OBJCXXFLAGS_PRECOMPILE"))
- precomp_files += precomph_out_dir + header_prefix + "objective-c++" + header_suffix;
+ foreach (const ProString &compiler, project->values("QMAKE_BUILTIN_COMPILERS")) {
+ if (project->isEmpty(ProKey("QMAKE_" + compiler + "FLAGS_PRECOMPILE")))
+ continue;
+ ProString language = project->first(ProKey("QMAKE_LANGUAGE_" + compiler));
+ if (language.isEmpty())
+ continue;
+
+ precomp_files += precomph_out_dir + header_prefix + language + header_suffix;
}
}
t << "-$(DEL_FILE) " << escapeFilePaths(precomp_files).join(' ') << "\n\t";
@@ -1043,8 +1015,6 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
if(!project->isEmpty("QMAKE_BUNDLE")) {
QString bundlePath = escapeFilePath(destdir + project->first("QMAKE_BUNDLE"));
t << "\t-$(DEL_FILE) -r " << bundlePath << endl;
- } else if(project->isActiveConfig("compile_libtool")) {
- t << "\t-$(LIBTOOL) --mode=clean $(DEL_FILE) $(TARGET)\n";
} else if (project->isActiveConfig("staticlib") || project->isActiveConfig("plugin")) {
t << "\t-$(DEL_FILE) " << escapeFilePath(destdir) << "$(TARGET) \n";
} else if (project->values("QMAKE_APP_FLAG").isEmpty()) {
@@ -1082,17 +1052,16 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
if(doPrecompiledHeaders() && !project->isEmpty("PRECOMPILED_HEADER")) {
QString pchInput = project->first("PRECOMPILED_HEADER").toQString();
t << "###### Precompiled headers\n";
- QString comps[] = { "C", "CXX", "OBJC", "OBJCXX", QString() };
- for(int i = 0; !comps[i].isNull(); i++) {
- QString pchFlags = var(ProKey("QMAKE_" + comps[i] + "FLAGS_PRECOMPILE"));
+ foreach (const ProString &compiler, project->values("QMAKE_BUILTIN_COMPILERS")) {
+ QString pchFlags = var(ProKey("QMAKE_" + compiler + "FLAGS_PRECOMPILE"));
if(pchFlags.isEmpty())
continue;
QString cflags;
- if(comps[i] == "OBJC" || comps[i] == "OBJCXX")
+ if (compiler == "C" || compiler == "OBJC")
cflags += " $(CFLAGS)";
else
- cflags += " $(" + comps[i] + "FLAGS)";
+ cflags += " $(CXXFLAGS)";
ProString pchBaseName = project->first("QMAKE_ORIG_TARGET");
ProString pchOutput;
@@ -1120,21 +1089,13 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
ProString header_suffix = project->isActiveConfig("clang_pch_style")
? project->first("QMAKE_PCH_OUTPUT_EXT") : "";
pchOutput += Option::dir_sep;
- QString pchOutputDir = pchOutput.toQString(), pchOutputFile;
-
- if(comps[i] == "C") {
- pchOutputFile = "c";
- } else if(comps[i] == "CXX") {
- pchOutputFile = "c++";
- } else if(project->isActiveConfig("objective_c")) {
- if(comps[i] == "OBJC")
- pchOutputFile = "objective-c";
- else if(comps[i] == "OBJCXX")
- pchOutputFile = "objective-c++";
- }
- if(pchOutputFile.isEmpty())
+ QString pchOutputDir = pchOutput.toQString();
+
+ QString language = project->first(ProKey("QMAKE_LANGUAGE_" + compiler)).toQString();
+ if (language.isEmpty())
continue;
- pchOutput += header_prefix + pchOutputFile + header_suffix;
+
+ pchOutput += header_prefix + language + header_suffix;
t << escapeDependencyPath(pchOutput) << ": " << escapeDependencyPath(pchInput) << ' '
<< escapeDependencyPaths(findDependencies(pchInput)).join(" \\\n\t\t")
@@ -1144,14 +1105,14 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
.replace("${QMAKE_PCH_OUTPUT_BASE}", escapeFilePath(pchBaseName.toQString()))
.replace("${QMAKE_PCH_OUTPUT}", escapeFilePath(pchOutput.toQString()));
- QString compiler;
- if(comps[i] == "C" || comps[i] == "OBJC" || comps[i] == "OBJCXX")
- compiler = "$(CC)";
+ QString compilerExecutable;
+ if (compiler == "C" || compiler == "OBJC")
+ compilerExecutable = "$(CC)";
else
- compiler = "$(CXX)";
+ compilerExecutable = "$(CXX)";
// compile command
- t << "\n\t" << compiler << cflags << " $(INCPATH) " << pchFlags << endl << endl;
+ t << "\n\t" << compilerExecutable << cflags << " $(INCPATH) " << pchFlags << endl << endl;
}
}
@@ -1177,8 +1138,6 @@ void UnixMakefileGenerator::init2()
}
if(!project->isEmpty("TARGET"))
project->values("TARGET").first().prepend(project->first("DESTDIR"));
- if (!project->values("QMAKE_CYGWIN_EXE").isEmpty())
- project->values("TARGET_EXT").append(".exe");
} else if (project->isActiveConfig("staticlib")) {
project->values("TARGET").first().prepend(project->first("QMAKE_PREFIX_STATICLIB"));
project->values("TARGET").first() += "." + project->first("QMAKE_EXTENSION_STATICLIB");
@@ -1187,17 +1146,13 @@ void UnixMakefileGenerator::init2()
} else {
project->values("TARGETA").append(project->first("DESTDIR") + project->first("QMAKE_PREFIX_STATICLIB")
+ project->first("TARGET") + "." + project->first("QMAKE_EXTENSION_STATICLIB"));
- if(project->isActiveConfig("compile_libtool"))
- project->values("TARGET_la") = ProStringList(project->first("DESTDIR") + "lib" + project->first("TARGET") + Option::libtool_ext);
ProStringList &ar_cmd = project->values("QMAKE_AR_CMD");
if (!ar_cmd.isEmpty())
ar_cmd[0] = ar_cmd.at(0).toQString().replace("(TARGET)","(TARGETA)");
else
ar_cmd.append("$(AR) $(TARGETA) $(OBJECTS)");
- if(project->isActiveConfig("compile_libtool")) {
- project->values("TARGET") = project->values("TARGET_la");
- } else if(!project->isEmpty("QMAKE_BUNDLE")) {
+ if (!project->isEmpty("QMAKE_BUNDLE")) {
ProString bundle_loc = project->first("QMAKE_BUNDLE_LOCATION");
if(!bundle_loc.isEmpty() && !bundle_loc.startsWith("/"))
bundle_loc.prepend("/");
@@ -1351,7 +1306,7 @@ void UnixMakefileGenerator::init2()
project->values("QMAKE_CFLAGS") += project->values("QMAKE_CFLAGS_PLUGIN");
project->values("QMAKE_CXXFLAGS") += project->values("QMAKE_CXXFLAGS_PLUGIN");
project->values("QMAKE_LFLAGS") += project->values("QMAKE_LFLAGS_PLUGIN");
- if(project->isActiveConfig("plugin_with_soname") && !project->isActiveConfig("compile_libtool"))
+ if (project->isActiveConfig("plugin_with_soname"))
project->values("QMAKE_LFLAGS") += project->values("QMAKE_LFLAGS_SONAME");
} else {
project->values("QMAKE_LFLAGS") += project->values("QMAKE_LFLAGS_SHLIB");
@@ -1370,8 +1325,7 @@ void UnixMakefileGenerator::init2()
project->first("VER_MIN") + "." +
project->first("VER_PAT"));
}
- if(!project->isActiveConfig("compile_libtool"))
- project->values("QMAKE_LFLAGS") += project->values("QMAKE_LFLAGS_SONAME");
+ project->values("QMAKE_LFLAGS") += project->values("QMAKE_LFLAGS_SONAME");
}
}
diff --git a/qmake/generators/win32/mingw_make.cpp b/qmake/generators/win32/mingw_make.cpp
index 57955dc456..97bfef88a4 100644
--- a/qmake/generators/win32/mingw_make.cpp
+++ b/qmake/generators/win32/mingw_make.cpp
@@ -33,7 +33,6 @@
#include "mingw_make.h"
#include "option.h"
-#include "meta.h"
#include <proitems.h>
@@ -56,11 +55,6 @@ QString MingwMakefileGenerator::escapeDependencyPath(const QString &path) const
return ret;
}
-QString MingwMakefileGenerator::getLibTarget()
-{
- return QString("lib" + project->first("TARGET") + project->first("TARGET_VERSION_EXT") + ".a");
-}
-
QString MingwMakefileGenerator::getManifestFileForRcFile() const
{
return project->first("QMAKE_MANIFEST").toQString();
@@ -68,48 +62,21 @@ QString MingwMakefileGenerator::getManifestFileForRcFile() const
ProString MingwMakefileGenerator::fixLibFlag(const ProString &lib)
{
- if (lib.startsWith("lib"))
- return QStringLiteral("-l") + escapeFilePath(lib.mid(3));
- return escapeFilePath(lib);
+ if (lib.startsWith("-l")) // Fallback for unresolved -l libs.
+ return QLatin1String("-l") + escapeFilePath(lib.mid(2));
+ if (lib.startsWith("-L")) // Lib search path. Needed only by -l above.
+ return QLatin1String("-L")
+ + escapeFilePath(Option::fixPathToTargetOS(lib.mid(2).toQString(), false));
+ if (lib.startsWith("lib")) // Fallback for unresolved MSVC-style libs.
+ return QLatin1String("-l") + escapeFilePath(lib.mid(3).toQString());
+ return escapeFilePath(Option::fixPathToTargetOS(lib.toQString(), false));
}
-bool MingwMakefileGenerator::findLibraries()
+MakefileGenerator::LibFlagType
+MingwMakefileGenerator::parseLibFlag(const ProString &flag, ProString *arg)
{
- QList<QMakeLocalFileName> dirs;
- static const char * const lflags[] = { "QMAKE_LIBS", "QMAKE_LIBS_PRIVATE", 0 };
- for (int i = 0; lflags[i]; i++) {
- ProStringList &l = project->values(lflags[i]);
- ProStringList::Iterator it = l.begin();
- while (it != l.end()) {
- if ((*it).startsWith("-l")) {
- QString steam = (*it).mid(2).toQString();
- ProString out;
- QString suffix = project->first(ProKey("QMAKE_" + steam.toUpper() + "_SUFFIX")).toQString();
- for (QList<QMakeLocalFileName>::Iterator dir_it = dirs.begin(); dir_it != dirs.end(); ++dir_it) {
- QString extension;
- int ver = findHighestVersion((*dir_it).local(), steam, "dll.a|a");
- if (ver > 0)
- extension += QString::number(ver);
- extension += suffix;
- if (QMakeMetaInfo::libExists((*dir_it).local() + '/' + steam)
- || exists((*dir_it).local() + '/' + steam + extension + ".a")
- || exists((*dir_it).local() + '/' + steam + extension + ".dll.a")) {
- out = *it + extension;
- break;
- }
- }
- if (!out.isEmpty()) // We assume if it never finds it that its correct
- (*it) = out;
- } else if ((*it).startsWith("-L")) {
- QMakeLocalFileName f((*it).mid(2).toQString());
- dirs.append(f);
- *it = "-L" + f.real();
- }
-
- ++it;
- }
- }
- return true;
+ // Skip MSVC handling from Win32MakefileGenerator
+ return MakefileGenerator::parseLibFlag(flag, arg);
}
bool MingwMakefileGenerator::writeMakefile(QTextStream &t)
@@ -183,25 +150,6 @@ void createArObjectScriptFile(const QString &fileName, const QString &target, co
}
}
-void createRvctObjectScriptFile(const QString &fileName, const ProStringList &objList)
-{
- QString filePath = Option::output_dir + QDir::separator() + fileName;
- QFile file(filePath);
- if (file.open(QIODevice::WriteOnly | QIODevice::Text)) {
- QTextStream t(&file);
- for (ProStringList::ConstIterator it = objList.constBegin(); it != objList.constEnd(); ++it) {
- QString path = (*it).toQString();
- // ### quoting?
- if (QDir::isRelativePath(path))
- t << "./" << path << endl;
- else
- t << path << endl;
- }
- t.flush();
- file.close();
- }
-}
-
void MingwMakefileGenerator::writeMingwParts(QTextStream &t)
{
writeStandardParts(t);
@@ -239,8 +187,6 @@ void MingwMakefileGenerator::init()
project->values("TARGET_PRL").append(project->first("TARGET"));
- project->values("QMAKE_L_FLAG") << "-L";
-
processVars();
project->values("QMAKE_LIBS") += project->values("RES_FILE");
@@ -249,8 +195,7 @@ void MingwMakefileGenerator::init()
QString destDir = "";
if(!project->first("DESTDIR").isEmpty())
destDir = Option::fixPathToTargetOS(project->first("DESTDIR") + Option::dir_sep, false, false);
- project->values("MINGW_IMPORT_LIB").prepend(destDir + "lib" + project->first("TARGET")
- + project->first("TARGET_VERSION_EXT") + ".a");
+ project->values("MINGW_IMPORT_LIB").prepend(destDir + project->first("LIB_TARGET"));
project->values("QMAKE_LFLAGS").append(QString("-Wl,--out-implib,") + fileVar("MINGW_IMPORT_LIB"));
}
@@ -335,32 +280,19 @@ void MingwMakefileGenerator::writeObjectsPart(QTextStream &t)
ar_script_file += "." + var("BUILD_NAME");
}
// QMAKE_LIB is used for win32, including mingw, whereas QMAKE_AR is used on Unix.
- if (project->isActiveConfig("rvct_linker")) {
- createRvctObjectScriptFile(ar_script_file, project->values("OBJECTS"));
- QString ar_cmd = project->values("QMAKE_LIB").join(' ');
- if (ar_cmd.isEmpty())
- ar_cmd = "armar --create";
- objectsLinkLine = ar_cmd + ' ' + fileVar("DEST_TARGET") + " --via " + escapeFilePath(ar_script_file);
- } else {
- // Strip off any options since the ar commands will be read from file.
- QString ar_cmd = var("QMAKE_LIB").section(" ", 0, 0);;
- if (ar_cmd.isEmpty())
- ar_cmd = "ar";
- createArObjectScriptFile(ar_script_file, var("DEST_TARGET"), project->values("OBJECTS"));
- objectsLinkLine = ar_cmd + " -M < " + escapeFilePath(ar_script_file);
- }
+ // Strip off any options since the ar commands will be read from file.
+ QString ar_cmd = var("QMAKE_LIB").section(" ", 0, 0);
+ if (ar_cmd.isEmpty())
+ ar_cmd = "ar";
+ createArObjectScriptFile(ar_script_file, var("DEST_TARGET"), project->values("OBJECTS"));
+ objectsLinkLine = ar_cmd + " -M < " + escapeFilePath(ar_script_file);
} else {
QString ld_script_file = var("QMAKE_LINK_OBJECT_SCRIPT") + "." + var("TARGET");
if (!var("BUILD_NAME").isEmpty()) {
ld_script_file += "." + var("BUILD_NAME");
}
- if (project->isActiveConfig("rvct_linker")) {
- createRvctObjectScriptFile(ld_script_file, project->values("OBJECTS"));
- objectsLinkLine = QString::fromLatin1("--via ") + escapeFilePath(ld_script_file);
- } else {
- createLdObjectScriptFile(ld_script_file, project->values("OBJECTS"));
- objectsLinkLine = escapeFilePath(ld_script_file);
- }
+ createLdObjectScriptFile(ld_script_file, project->values("OBJECTS"));
+ objectsLinkLine = escapeFilePath(ld_script_file);
}
Win32MakefileGenerator::writeObjectsPart(t);
}
diff --git a/qmake/generators/win32/mingw_make.h b/qmake/generators/win32/mingw_make.h
index e76391080c..4e94a23ae2 100644
--- a/qmake/generators/win32/mingw_make.h
+++ b/qmake/generators/win32/mingw_make.h
@@ -47,7 +47,6 @@ protected:
QString escapeDependencyPath(const QString &path) const;
ProString escapeDependencyPath(const ProString &path) const { return MakefileGenerator::escapeDependencyPath(path); }
virtual ProString fixLibFlag(const ProString &lib);
- QString getLibTarget();
virtual QString getManifestFileForRcFile() const;
bool writeMakefile(QTextStream &);
void init();
@@ -63,7 +62,7 @@ private:
QString preCompHeaderOut;
- virtual bool findLibraries();
+ virtual LibFlagType parseLibFlag(const ProString &flag, ProString *arg);
QString objectsLinkLine;
};
diff --git a/qmake/generators/win32/msvc_nmake.cpp b/qmake/generators/win32/msvc_nmake.cpp
index 7646198da1..a546e03b59 100644
--- a/qmake/generators/win32/msvc_nmake.cpp
+++ b/qmake/generators/win32/msvc_nmake.cpp
@@ -266,11 +266,6 @@ void NmakeMakefileGenerator::writeSubMakeCall(QTextStream &t, const QString &cal
Win32MakefileGenerator::writeSubMakeCall(t, callPrefix, makeArguments);
}
-QString NmakeMakefileGenerator::getPdbTarget()
-{
- return QString(project->first("TARGET") + project->first("TARGET_VERSION_EXT") + ".pdb");
-}
-
QString NmakeMakefileGenerator::defaultInstall(const QString &t)
{
if((t != "target" && t != "dlltarget") ||
@@ -288,7 +283,7 @@ QString NmakeMakefileGenerator::defaultInstall(const QString &t)
if (project->isActiveConfig("debug_info")) {
if (t == "dlltarget" || project->values(ProKey(t + ".CONFIG")).indexOf("no_dll") == -1) {
- QString pdb_target = getPdbTarget();
+ QString pdb_target = project->first("TARGET") + project->first("TARGET_VERSION_EXT") + ".pdb";
QString src_targ = (project->isEmpty("DESTDIR") ? QString("$(DESTDIR)") : project->first("DESTDIR")) + pdb_target;
QString dst_targ = filePrefixRoot(root, fileFixify(targetdir + pdb_target, FileFixifyAbsolute));
if(!ret.isEmpty())
@@ -373,8 +368,6 @@ void NmakeMakefileGenerator::init()
return;
}
- project->values("QMAKE_L_FLAG") << "/LIBPATH:";
-
processVars();
project->values("QMAKE_LIBS") += project->values("RES_FILE");
@@ -419,21 +412,22 @@ void NmakeMakefileGenerator::init()
project->values("PRECOMPILED_PCH") = ProStringList(precompPch);
}
- ProString version = project->first("TARGET_VERSION_EXT");
+ ProString tgt = project->first("DESTDIR")
+ + project->first("TARGET") + project->first("TARGET_VERSION_EXT");
if(project->isActiveConfig("shared")) {
- project->values("QMAKE_CLEAN").append(project->first("DESTDIR") + project->first("TARGET") + version + ".exp");
- project->values("QMAKE_DISTCLEAN").append(project->first("DESTDIR") + project->first("TARGET") + version + ".lib");
+ project->values("QMAKE_CLEAN").append(tgt + ".exp");
+ project->values("QMAKE_DISTCLEAN").append(tgt + ".lib");
}
if (project->isActiveConfig("debug_info")) {
- QString pdbfile = project->first("DESTDIR") + project->first("TARGET") + version + ".pdb";
+ QString pdbfile = tgt + ".pdb";
QString escapedPdbFile = escapeFilePath(pdbfile);
project->values("QMAKE_CFLAGS").append("/Fd" + escapedPdbFile);
project->values("QMAKE_CXXFLAGS").append("/Fd" + escapedPdbFile);
project->values("QMAKE_DISTCLEAN").append(pdbfile);
}
if (project->isActiveConfig("debug")) {
- project->values("QMAKE_CLEAN").append(project->first("DESTDIR") + project->first("TARGET") + version + ".ilk");
- project->values("QMAKE_CLEAN").append(project->first("DESTDIR") + project->first("TARGET") + version + ".idb");
+ project->values("QMAKE_CLEAN").append(tgt + ".ilk");
+ project->values("QMAKE_CLEAN").append(tgt + ".idb");
} else {
ProStringList &defines = project->values("DEFINES");
if (!defines.contains("NDEBUG"))
@@ -454,6 +448,8 @@ QStringList NmakeMakefileGenerator::sourceFilesForImplicitRulesFilter()
void NmakeMakefileGenerator::writeImplicitRulesPart(QTextStream &t)
{
+ t << "####### Implicit rules\n\n";
+
t << ".SUFFIXES:";
for(QStringList::Iterator cit = Option::c_ext.begin(); cit != Option::c_ext.end(); ++cit)
t << " " << (*cit);
diff --git a/qmake/generators/win32/msvc_nmake.h b/qmake/generators/win32/msvc_nmake.h
index 83ce96c8b7..df72ef394c 100644
--- a/qmake/generators/win32/msvc_nmake.h
+++ b/qmake/generators/win32/msvc_nmake.h
@@ -52,7 +52,6 @@ class NmakeMakefileGenerator : public Win32MakefileGenerator
protected:
virtual void writeSubMakeCall(QTextStream &t, const QString &callPrefix,
const QString &makeArguments);
- virtual QString getPdbTarget();
virtual QString defaultInstall(const QString &t);
virtual QStringList &findDependencies(const QString &file);
QString var(const ProKey &value) const;
diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp
index 09937c8ac2..11e93e54c2 100644
--- a/qmake/generators/win32/msvc_objectmodel.cpp
+++ b/qmake/generators/win32/msvc_objectmodel.cpp
@@ -2412,7 +2412,7 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info)
// Make sure that all deps are only once
QStringList uniqDeps;
for (int c = 0; c < deps.count(); ++c) {
- QString aDep = deps.at(c).trimmed();
+ QString aDep = deps.at(c);
if (!aDep.isEmpty())
uniqDeps << aDep;
}
diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp
index ae4fcfd482..b1e0745e03 100644
--- a/qmake/generators/win32/msvc_vcproj.cpp
+++ b/qmake/generators/win32/msvc_vcproj.cpp
@@ -655,6 +655,7 @@ void VcprojGenerator::writeSubDirs(QTextStream &t)
switch (which_dotnet_version(project->first("MSVC_VER").toLatin1())) {
case NET2015:
t << _slnHeader140;
+ break;
case NET2013:
t << _slnHeader120;
break;
@@ -809,8 +810,6 @@ void VcprojGenerator::init()
else if (project->first("TEMPLATE") == "vclib")
project->values("QMAKE_LIB_FLAG").append("1");
- project->values("QMAKE_L_FLAG") << "/LIBPATH:";
-
processVars();
// set /VERSION for EXE/DLL header
@@ -1036,6 +1035,17 @@ void VcprojGenerator::initConfiguration()
conf.suppressUnknownOptionWarnings = project->isActiveConfig("suppress_vcproj_warnings");
conf.CompilerVersion = which_dotnet_version(project->first("MSVC_VER").toLatin1());
+ if (conf.CompilerVersion >= NET2012) {
+ conf.WinRT = project->isActiveConfig("winrt");
+ if (conf.WinRT) {
+ conf.WinPhone = project->isActiveConfig("winphone");
+ // Saner defaults
+ conf.compiler.UsePrecompiledHeader = pchNone;
+ conf.compiler.CompileAsWinRT = _False;
+ conf.linker.GenerateWindowsMetadata = _False;
+ }
+ }
+
initCompilerTool();
// Only on configuration per build
@@ -1082,17 +1092,6 @@ void VcprojGenerator::initConfiguration()
conf.PrimaryOutputExtension = '.' + targetSuffix;
}
- if (conf.CompilerVersion >= NET2012) {
- conf.WinRT = project->isActiveConfig("winrt");
- if (conf.WinRT) {
- conf.WinPhone = project->isActiveConfig("winphone");
- // Saner defaults
- conf.compiler.UsePrecompiledHeader = pchNone;
- conf.compiler.CompileAsWinRT = _False;
- conf.linker.GenerateWindowsMetadata = _False;
- }
- }
-
conf.Name = project->values("BUILD_NAME").join(' ');
if (conf.Name.isEmpty())
conf.Name = isDebug ? "Debug" : "Release";
diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp
index 0d761b08a2..1fba7057ab 100644
--- a/qmake/generators/win32/winmakefile.cpp
+++ b/qmake/generators/win32/winmakefile.cpp
@@ -49,215 +49,125 @@ Win32MakefileGenerator::Win32MakefileGenerator() : MakefileGenerator()
{
}
-int
-Win32MakefileGenerator::findHighestVersion(const QString &d, const QString &stem, const QString &ext)
+ProString Win32MakefileGenerator::fixLibFlag(const ProString &lib)
{
- QString bd = Option::normalizePath(d);
- if(!exists(bd))
- return -1;
-
- QMakeMetaInfo libinfo(project);
- bool libInfoRead = libinfo.readLib(bd + '/' + stem);
-
- // If the library, for which we're trying to find the highest version
- // number, is a static library
- if (libInfoRead && libinfo.values("QMAKE_PRL_CONFIG").contains("staticlib"))
- return -1;
-
- const ProStringList &vover = project->values(ProKey("QMAKE_" + stem.toUpper() + "_VERSION_OVERRIDE"));
- if (!vover.isEmpty())
- return vover.first().toInt();
-
- int biggest=-1;
- if (project->isActiveConfig("link_highest_lib_version")) {
- static QHash<QString, QStringList> dirEntryListCache;
- QStringList entries = dirEntryListCache.value(bd);
- if (entries.isEmpty()) {
- QDir dir(bd);
- entries = dir.entryList();
- dirEntryListCache.insert(bd, entries);
- }
-
- QRegExp regx(QString("((lib)?%1([0-9]*)).(%2|prl)$").arg(stem).arg(ext), Qt::CaseInsensitive);
- for(QStringList::Iterator it = entries.begin(); it != entries.end(); ++it) {
- if(regx.exactMatch((*it))) {
- if (!regx.cap(3).isEmpty()) {
- bool ok = true;
- int num = regx.cap(3).toInt(&ok);
- biggest = qMax(biggest, (!ok ? -1 : num));
- }
- }
- }
- }
- if(libInfoRead
- && !libinfo.values("QMAKE_PRL_CONFIG").contains("staticlib")
- && !libinfo.isEmpty("QMAKE_PRL_VERSION"))
- biggest = qMax(biggest, libinfo.first("QMAKE_PRL_VERSION").toQString().replace(".", "").toInt());
- return biggest;
+ if (lib.startsWith("-l")) // Fallback for unresolved -l libs.
+ return escapeFilePath(lib.mid(2) + QLatin1String(".lib"));
+ if (lib.startsWith("-L")) // Lib search path. Needed only by -l above.
+ return QLatin1String("/LIBPATH:")
+ + escapeFilePath(Option::fixPathToTargetOS(lib.mid(2).toQString(), false));
+ return escapeFilePath(Option::fixPathToTargetOS(lib.toQString(), false));
}
-ProString Win32MakefileGenerator::fixLibFlag(const ProString &lib)
+MakefileGenerator::LibFlagType
+Win32MakefileGenerator::parseLibFlag(const ProString &flag, ProString *arg)
{
- if (lib.startsWith('/')) {
- if (lib.startsWith("/LIBPATH:"))
- return QLatin1String("/LIBPATH:")
- + escapeFilePath(Option::fixPathToTargetOS(lib.mid(9).toQString(), false));
- // This appears to be a user-supplied flag. Assume sufficient quoting.
- return lib;
+ LibFlagType ret = MakefileGenerator::parseLibFlag(flag, arg);
+ if (ret != LibFlagFile)
+ return ret;
+ // MSVC compatibility. This should be deprecated.
+ if (flag.startsWith("/LIBPATH:")) {
+ *arg = flag.mid(9);
+ return LibFlagPath;
}
- // This must be a fully resolved library path.
- return escapeFilePath(Option::fixPathToTargetOS(lib.toQString(), false));
+ // These are pure qmake inventions. They *really* should be deprecated.
+ if (flag.startsWith("/L")) {
+ *arg = flag.mid(2);
+ return LibFlagPath;
+ }
+ if (flag.startsWith("/l")) {
+ *arg = flag.mid(2);
+ return LibFlagLib;
+ }
+ return LibFlagFile;
}
bool
-Win32MakefileGenerator::findLibraries()
+Win32MakefileGenerator::findLibraries(bool linkPrl, bool mergeLflags)
{
+ ProStringList impexts = project->values("QMAKE_LIB_EXTENSIONS");
+ if (impexts.isEmpty())
+ impexts = project->values("QMAKE_EXTENSION_STATICLIB");
QList<QMakeLocalFileName> dirs;
static const char * const lflags[] = { "QMAKE_LIBS", "QMAKE_LIBS_PRIVATE", 0 };
for (int i = 0; lflags[i]; i++) {
ProStringList &l = project->values(lflags[i]);
for (ProStringList::Iterator it = l.begin(); it != l.end();) {
- bool remove = false;
- QString opt = (*it).trimmed().toQString();
- if(opt.startsWith("/LIBPATH:")) {
- QString libpath = opt.mid(9);
- QMakeLocalFileName l(libpath);
- if (!dirs.contains(l)) {
- dirs.append(l);
- (*it) = "/LIBPATH:" + l.real();
- } else {
- remove = true;
- }
- } else if(opt.startsWith("-L") || opt.startsWith("/L")) {
- QString libpath = Option::fixPathToTargetOS(opt.mid(2), false, false);
- QMakeLocalFileName l(libpath);
- if(!dirs.contains(l)) {
- dirs.append(l);
- (*it) = "/LIBPATH:" + l.real();
- } else {
- remove = true;
+ const ProString &opt = *it;
+ ProString arg;
+ LibFlagType type = parseLibFlag(opt, &arg);
+ if (type == LibFlagPath) {
+ QMakeLocalFileName lp(arg.toQString());
+ if (dirs.contains(lp)) {
+ it = l.erase(it);
+ continue;
}
- } else if(opt.startsWith("-l") || opt.startsWith("/l")) {
- QString lib = opt.right(opt.length() - 2), out;
- if(!lib.isEmpty()) {
- ProString suffix = project->first(ProKey("QMAKE_" + lib.toUpper() + "_SUFFIX"));
- for(QList<QMakeLocalFileName>::Iterator it = dirs.begin();
- it != dirs.end(); ++it) {
- QString extension;
- int ver = findHighestVersion((*it).local(), lib);
- if(ver > 0)
- extension += QString::number(ver);
- extension += suffix;
- extension += ".lib";
- if (QMakeMetaInfo::libExists((*it).local() + '/' + lib)
- || exists((*it).local() + '/' + lib + extension)) {
- out = (*it).real() + Option::dir_sep + lib + extension;
- break;
+ dirs.append(lp);
+ (*it) = "-L" + lp.real();
+ } else if (type == LibFlagLib) {
+ QString lib = arg.toQString();
+ ProString verovr =
+ project->first(ProKey("QMAKE_" + lib.toUpper() + "_VERSION_OVERRIDE"));
+ for (QList<QMakeLocalFileName>::Iterator dir_it = dirs.begin();
+ dir_it != dirs.end(); ++dir_it) {
+ QString cand = (*dir_it).real() + Option::dir_sep + lib;
+ if (linkPrl && processPrlFile(cand)) {
+ (*it) = cand;
+ goto found;
+ }
+ QString libBase = (*dir_it).local() + '/' + lib + verovr;
+ for (ProStringList::ConstIterator extit = impexts.begin();
+ extit != impexts.end(); ++extit) {
+ if (exists(libBase + '.' + *extit)) {
+ (*it) = cand + verovr + '.' + *extit;
+ goto found;
}
}
}
- if(out.isEmpty())
- out = lib + ".lib";
- (*it) = out;
- } else if (!exists(Option::normalizePath(opt))) {
- QList<QMakeLocalFileName> lib_dirs;
- QString file = Option::fixPathToTargetOS(opt);
- int slsh = file.lastIndexOf(Option::dir_sep);
- if(slsh != -1) {
- lib_dirs.append(QMakeLocalFileName(file.left(slsh+1)));
- file = file.right(file.length() - slsh - 1);
+ // We assume if it never finds it that it's correct
+ found: ;
+ } else if (linkPrl && type == LibFlagFile) {
+ QString lib = opt.toQString();
+ if (fileInfo(lib).isAbsolute()) {
+ if (processPrlFile(lib))
+ (*it) = lib;
} else {
- lib_dirs = dirs;
- }
- if(file.endsWith(".lib")) {
- file = file.left(file.length() - 4);
- if(!file.at(file.length()-1).isNumber()) {
- ProString suffix = project->first(ProKey("QMAKE_" + file.toUpper() + "_SUFFIX"));
- for(QList<QMakeLocalFileName>::Iterator dep_it = lib_dirs.begin(); dep_it != lib_dirs.end(); ++dep_it) {
- QString lib_tmpl(file + "%1" + suffix + ".lib");
- int ver = findHighestVersion((*dep_it).local(), file);
- if(ver != -1) {
- if(ver)
- lib_tmpl = lib_tmpl.arg(ver);
- else
- lib_tmpl = lib_tmpl.arg("");
- if(slsh != -1) {
- QString dir = (*dep_it).real();
- if(!dir.endsWith(Option::dir_sep))
- dir += Option::dir_sep;
- lib_tmpl.prepend(dir);
- }
- (*it) = lib_tmpl;
- break;
- }
+ for (QList<QMakeLocalFileName>::Iterator dir_it = dirs.begin();
+ dir_it != dirs.end(); ++dir_it) {
+ QString cand = (*dir_it).real() + Option::dir_sep + lib;
+ if (processPrlFile(cand)) {
+ (*it) = cand;
+ break;
}
}
}
}
- if(remove) {
- it = l.erase(it);
- } else {
- ++it;
- }
- }
- }
- return true;
-}
-void
-Win32MakefileGenerator::processPrlFiles()
-{
- const QString libArg = project->first("QMAKE_L_FLAG").toQString();
- QList<QMakeLocalFileName> libdirs;
- static const char * const lflags[] = { "QMAKE_LIBS", "QMAKE_LIBS_PRIVATE", 0 };
- for (int i = 0; lflags[i]; i++) {
- ProStringList &l = project->values(lflags[i]);
+ ProStringList &prl_libs = project->values("QMAKE_CURRENT_PRL_LIBS");
+ for (int prl = 0; prl < prl_libs.size(); ++prl)
+ it = l.insert(++it, prl_libs.at(prl));
+ prl_libs.clear();
+ ++it;
+ }
+ if (mergeLflags) {
+ ProStringList lopts;
for (int lit = 0; lit < l.size(); ++lit) {
- QString opt = l.at(lit).trimmed().toQString();
- if (opt.startsWith(libArg)) {
- QMakeLocalFileName l(opt.mid(libArg.length()));
- if (!libdirs.contains(l))
- libdirs.append(l);
- } else if (!opt.startsWith("/")) {
- if (!processPrlFile(opt) && (QDir::isRelativePath(opt) || opt.startsWith("-l"))) {
- QString tmp;
- if (opt.startsWith("-l"))
- tmp = opt.mid(2);
- else
- tmp = opt;
- for(QList<QMakeLocalFileName>::Iterator it = libdirs.begin(); it != libdirs.end(); ++it) {
- QString prl = (*it).local() + '/' + tmp;
- if (processPrlFile(prl))
- break;
- }
- }
- }
- ProStringList &prl_libs = project->values("QMAKE_CURRENT_PRL_LIBS");
- for (int prl = 0; prl < prl_libs.size(); ++prl)
- l.insert(++lit, prl_libs.at(prl));
- prl_libs.clear();
- }
-
- // Merge them into a logical order
- if (!project->isActiveConfig("no_smart_library_merge") && !project->isActiveConfig("no_lflags_merge")) {
- ProStringList lflags;
- for (int lit = 0; lit < l.size(); ++lit) {
- ProString opt = l.at(lit).trimmed();
- if (opt.startsWith(libArg)) {
- if (!lflags.contains(opt))
- lflags.append(opt);
- } else {
- // Make sure we keep the dependency-order of libraries
- lflags.removeAll(opt);
- lflags.append(opt);
- }
+ ProString opt = l.at(lit);
+ if (opt.startsWith(QLatin1String("-L"))) {
+ if (!lopts.contains(opt))
+ lopts.append(opt);
+ } else {
+ // Make sure we keep the dependency order of libraries
+ lopts.removeAll(opt);
+ lopts.append(opt);
}
- l = lflags;
}
+ l = lopts;
}
+ }
+ return true;
}
-
void Win32MakefileGenerator::processVars()
{
project->values("QMAKE_ORIG_TARGET") = project->values("TARGET");
@@ -286,7 +196,6 @@ void Win32MakefileGenerator::processVars()
fixTargetExt();
processRcFileVar();
- ProString libArg = project->first("QMAKE_L_FLAG");
ProStringList libs;
ProStringList &libDir = project->values("QMAKE_LIBDIR");
for (ProStringList::Iterator libDir_it = libDir.begin(); libDir_it != libDir.end(); ++libDir_it) {
@@ -294,7 +203,7 @@ void Win32MakefileGenerator::processVars()
if (!lib.isEmpty()) {
if (lib.endsWith('\\'))
lib.chop(1);
- libs << libArg + Option::fixPathToTargetOS(lib, false, false);
+ libs << QLatin1String("-L") + lib;
}
}
project->values("QMAKE_LIBS") += libs + project->values("LIBS");
@@ -321,20 +230,19 @@ void Win32MakefileGenerator::processVars()
void Win32MakefileGenerator::fixTargetExt()
{
- if (project->isEmpty("QMAKE_EXTENSION_STATICLIB"))
- project->values("QMAKE_EXTENSION_STATICLIB").append("lib");
- if (project->isEmpty("QMAKE_EXTENSION_SHLIB"))
- project->values("QMAKE_EXTENSION_SHLIB").append("dll");
-
if (!project->values("QMAKE_APP_FLAG").isEmpty()) {
project->values("TARGET_EXT").append(".exe");
} else if (project->isActiveConfig("shared")) {
+ project->values("LIB_TARGET").prepend(project->first("QMAKE_PREFIX_STATICLIB")
+ + project->first("TARGET") + project->first("TARGET_VERSION_EXT")
+ + '.' + project->first("QMAKE_EXTENSION_STATICLIB"));
project->values("TARGET_EXT").append(project->first("TARGET_VERSION_EXT") + "."
+ project->first("QMAKE_EXTENSION_SHLIB"));
project->values("TARGET").first() = project->first("QMAKE_PREFIX_SHLIB") + project->first("TARGET");
} else {
project->values("TARGET_EXT").append("." + project->first("QMAKE_EXTENSION_STATICLIB"));
project->values("TARGET").first() = project->first("QMAKE_PREFIX_STATICLIB") + project->first("TARGET");
+ project->values("LIB_TARGET").prepend(project->first("TARGET") + project->first("TARGET_EXT")); // for the .prl only
}
}
@@ -662,7 +570,6 @@ void Win32MakefileGenerator::writeStandardParts(QTextStream &t)
t << "DESTDIR_TARGET = " << fileVar("DEST_TARGET") << endl;
t << endl;
- t << "####### Implicit rules\n\n";
writeImplicitRulesPart(t);
t << "####### Build rules\n\n";
@@ -734,16 +641,6 @@ void Win32MakefileGenerator::writeObjectsPart(QTextStream &t)
void Win32MakefileGenerator::writeImplicitRulesPart(QTextStream &t)
{
- t << ".SUFFIXES:";
- for(QStringList::Iterator cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit)
- t << " " << (*cppit);
- for(QStringList::Iterator cit = Option::c_ext.begin(); cit != Option::c_ext.end(); ++cit)
- t << " " << (*cit);
- t << endl << endl;
- for(QStringList::Iterator cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit)
- t << (*cppit) << Option::obj_ext << ":\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl;
- for(QStringList::Iterator cit = Option::c_ext.begin(); cit != Option::c_ext.end(); ++cit)
- t << (*cit) << Option::obj_ext << ":\n\t" << var("QMAKE_RUN_CC_IMP") << endl << endl;
}
void Win32MakefileGenerator::writeBuildRulesPart(QTextStream &)
@@ -785,11 +682,6 @@ void Win32MakefileGenerator::writeRcFilePart(QTextStream &t)
}
}
-QString Win32MakefileGenerator::getLibTarget()
-{
- return QString(project->first("TARGET") + project->first("TARGET_VERSION_EXT") + ".lib");
-}
-
QString Win32MakefileGenerator::defaultInstall(const QString &t)
{
if((t != "target" && t != "dlltarget") ||
@@ -836,7 +728,7 @@ QString Win32MakefileGenerator::defaultInstall(const QString &t)
}
}
if(project->isActiveConfig("shared") && !project->isActiveConfig("plugin")) {
- QString lib_target = getLibTarget();
+ ProString lib_target = project->first("LIB_TARGET");
QString src_targ = escapeFilePath(
(project->isEmpty("DESTDIR") ? QString("$(DESTDIR)") : project->first("DESTDIR"))
+ lib_target);
diff --git a/qmake/generators/win32/winmakefile.h b/qmake/generators/win32/winmakefile.h
index ea763c3175..54c4d3be53 100644
--- a/qmake/generators/win32/winmakefile.h
+++ b/qmake/generators/win32/winmakefile.h
@@ -57,16 +57,14 @@ protected:
virtual void writeRcFilePart(QTextStream &t);
- int findHighestVersion(const QString &dir, const QString &stem, const QString &ext = QLatin1String("lib"));
- virtual bool findLibraries();
+ virtual bool findLibraries(bool linkPrl, bool mergeLflags);
+ virtual LibFlagType parseLibFlag(const ProString &flag, ProString *arg);
virtual ProString fixLibFlag(const ProString &lib);
- virtual void processPrlFiles();
void processVars();
void fixTargetExt();
void processRcFileVar();
- virtual QString getLibTarget();
static QString cQuoted(const QString &str);
virtual QString getManifestFileForRcFile() const;
};
diff --git a/qmake/meta.cpp b/qmake/meta.cpp
index d7aa885541..719b2c060f 100644
--- a/qmake/meta.cpp
+++ b/qmake/meta.cpp
@@ -48,11 +48,8 @@ QMakeMetaInfo::QMakeMetaInfo(QMakeProject *_conf)
bool
-QMakeMetaInfo::readLib(QString lib)
+QMakeMetaInfo::readLib(const QString &meta_file)
{
- clear();
- QString meta_file = findLib(lib);
-
if(cache_vars.contains(meta_file)) {
vars = cache_vars[meta_file];
return true;
@@ -84,18 +81,9 @@ QMakeMetaInfo::readLib(QString lib)
}
-void
-QMakeMetaInfo::clear()
-{
- vars.clear();
-}
-
-
QString
-QMakeMetaInfo::findLib(QString lib)
+QMakeMetaInfo::findLib(const QString &lib)
{
- lib = Option::normalizePath(lib);
-
QString ret;
QString extns[] = { Option::prl_ext, /*Option::pkgcfg_ext, Option::libtool_ext,*/ QString() };
for(int extn = 0; !extns[extn].isNull(); extn++) {
diff --git a/qmake/meta.h b/qmake/meta.h
index a08b946916..7c91ffda44 100644
--- a/qmake/meta.h
+++ b/qmake/meta.h
@@ -52,15 +52,14 @@ class QMakeMetaInfo
ProValueMap vars;
QString meta_type;
static QHash<QString, ProValueMap> cache_vars;
- void clear();
public:
QMakeMetaInfo(QMakeProject *_conf);
- bool readLib(QString lib);
- static QString findLib(QString lib);
- static bool libExists(QString lib);
- QString type() const;
+ // These functions expect the path to be normalized
+ static QString findLib(const QString &lib);
+ bool readLib(const QString &meta_file);
+ QString type() const;
bool isEmpty(const ProKey &v);
ProStringList &values(const ProKey &v);
ProString first(const ProKey &v);
@@ -92,9 +91,6 @@ inline ProString QMakeMetaInfo::first(const ProKey &v)
inline ProValueMap &QMakeMetaInfo::variables()
{ return vars; }
-inline bool QMakeMetaInfo::libExists(QString lib)
-{ return !findLib(lib).isNull(); }
-
QT_END_NAMESPACE
#endif // META_H
diff --git a/qmake/option.cpp b/qmake/option.cpp
index 4d20f64d58..da59616e5c 100644
--- a/qmake/option.cpp
+++ b/qmake/option.cpp
@@ -59,6 +59,8 @@ QStringList Option::h_ext;
QString Option::cpp_moc_ext;
QStringList Option::cpp_ext;
QStringList Option::c_ext;
+QString Option::objc_ext;
+QString Option::objcpp_ext;
QString Option::obj_ext;
QString Option::lex_ext;
QString Option::yacc_ext;
@@ -465,6 +467,8 @@ bool Option::postProcessProject(QMakeProject *project)
Option::cpp_ext = project->values("QMAKE_EXT_CPP").toQStringList();
Option::h_ext = project->values("QMAKE_EXT_H").toQStringList();
Option::c_ext = project->values("QMAKE_EXT_C").toQStringList();
+ Option::objc_ext = project->first("QMAKE_EXT_OBJC").toQString();
+ Option::objcpp_ext = project->first("QMAKE_EXT_OBJCXX").toQString();
Option::res_ext = project->first("QMAKE_EXT_RES").toQString();
Option::pkgcfg_ext = project->first("QMAKE_EXT_PKGCONFIG").toQString();
Option::libtool_ext = project->first("QMAKE_EXT_LIBTOOL").toQString();
diff --git a/qmake/option.h b/qmake/option.h
index 0ab0365bb3..663f096072 100644
--- a/qmake/option.h
+++ b/qmake/option.h
@@ -91,6 +91,8 @@ struct Option
static QStringList h_ext;
static QStringList cpp_ext;
static QStringList c_ext;
+ static QString objc_ext;
+ static QString objcpp_ext;
static QString cpp_moc_ext;
static QString obj_ext;
static QString lex_ext;
diff --git a/src/3rdparty/angle/include/KHR/khrplatform.h b/src/3rdparty/angle/include/KHR/khrplatform.h
index c9e6f17d34..c9e6f17d34 100755..100644
--- a/src/3rdparty/angle/include/KHR/khrplatform.h
+++ b/src/3rdparty/angle/include/KHR/khrplatform.h
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/SurfaceD3D.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/SurfaceD3D.cpp
index 84515f4c6c..84515f4c6c 100755..100644
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/SurfaceD3D.cpp
+++ b/src/3rdparty/angle/src/libANGLE/renderer/d3d/SurfaceD3D.cpp
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
index 5291a3a086..223e2b019b 100644
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
+++ b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
@@ -296,7 +296,20 @@ Renderer11::Renderer11(egl::Display *display)
if (requestedMajorVersion == 9 && requestedMinorVersion == 3)
#endif
{
- mAvailableFeatureLevels.push_back(D3D_FEATURE_LEVEL_9_3);
+ if (requestedMinorVersion == EGL_DONT_CARE || requestedMinorVersion >= 3)
+ {
+ mAvailableFeatureLevels.push_back(D3D_FEATURE_LEVEL_9_3);
+ }
+#if defined(ANGLE_ENABLE_WINDOWS_STORE)
+ if (requestedMinorVersion == EGL_DONT_CARE || requestedMinorVersion >= 2)
+ {
+ mAvailableFeatureLevels.push_back(D3D_FEATURE_LEVEL_9_2);
+ }
+ if (requestedMinorVersion == EGL_DONT_CARE || requestedMinorVersion >= 1)
+ {
+ mAvailableFeatureLevels.push_back(D3D_FEATURE_LEVEL_9_1);
+ }
+#endif
}
EGLint requestedDeviceType = attributes.get(EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE,
diff --git a/src/3rdparty/angle/src/libGLESv2/entry_points_egl_ext.cpp b/src/3rdparty/angle/src/libGLESv2/entry_points_egl_ext.cpp
index 62f3ca1207..02b663192d 100644
--- a/src/3rdparty/angle/src/libGLESv2/entry_points_egl_ext.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/entry_points_egl_ext.cpp
@@ -49,6 +49,8 @@ EGLBoolean EGLAPIENTRY QuerySurfacePointerANGLE(EGLDisplay dpy, EGLSurface surfa
// validate the attribute parameter
switch (attribute)
{
+ case EGL_DEVICE_EXT:
+ break;
case EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE:
if (!display->getExtensions().surfaceD3DTexture2DShareHandle)
{
diff --git a/src/3rdparty/forkfd/forkfd.c b/src/3rdparty/forkfd/forkfd.c
index 51223aef1f..e55ef47683 100644
--- a/src/3rdparty/forkfd/forkfd.c
+++ b/src/3rdparty/forkfd/forkfd.c
@@ -45,12 +45,12 @@
#ifdef __linux__
# define HAVE_WAIT4 1
# if defined(__BIONIC__) || (defined(__GLIBC__) && (__GLIBC__ << 8) + __GLIBC_MINOR__ >= 0x207 && \
- (!defined(__UCLIBC__) || ((__UCLIBC_MAJOR__ << 16) + (__UCLIBC_MINOR__ << 8) + __UCLIBC_SUBLEVEL__ > 0x921)))
+ (!defined(__UCLIBC__) || ((__UCLIBC_MAJOR__ << 16) + (__UCLIBC_MINOR__ << 8) + __UCLIBC_SUBLEVEL__ > 0x90201)))
# include <sys/eventfd.h>
# define HAVE_EVENTFD 1
# endif
# if defined(__BIONIC__) || (defined(__GLIBC__) && (__GLIBC__ << 8) + __GLIBC_MINOR__ >= 0x209 && \
- (!defined(__UCLIBC__) || ((__UCLIBC_MAJOR__ << 16) + (__UCLIBC_MINOR__ << 8) + __UCLIBC_SUBLEVEL__ > 0x921)))
+ (!defined(__UCLIBC__) || ((__UCLIBC_MAJOR__ << 16) + (__UCLIBC_MINOR__ << 8) + __UCLIBC_SUBLEVEL__ > 0x90201)))
# define HAVE_PIPE2 1
# endif
#endif
@@ -721,7 +721,7 @@ err_free:
}
#endif // FORKFD_NO_FORKFD
-#if defined(_POSIX_SPAWN) && !defined(FORKFD_NO_SPAWNFD)
+#if _POSIX_SPAWN > 0 && !defined(FORKFD_NO_SPAWNFD)
int spawnfd(int flags, pid_t *ppid, const char *path, const posix_spawn_file_actions_t *file_actions,
posix_spawnattr_t *attrp, char *const argv[], char *const envp[])
{
diff --git a/src/3rdparty/forkfd/forkfd.h b/src/3rdparty/forkfd/forkfd.h
index dcb36f9f33..38858c00fe 100644
--- a/src/3rdparty/forkfd/forkfd.h
+++ b/src/3rdparty/forkfd/forkfd.h
@@ -29,7 +29,7 @@
#include <stdint.h>
#include <unistd.h> // to get the POSIX flags
-#ifdef _POSIX_SPAWN
+#if _POSIX_SPAWN > 0
# include <spawn.h>
#endif
@@ -51,7 +51,7 @@ int forkfd(int flags, pid_t *ppid);
int forkfd_wait(int ffd, forkfd_info *info, struct rusage *rusage);
int forkfd_close(int ffd);
-#ifdef _POSIX_SPAWN
+#if _POSIX_SPAWN > 0
/* only for spawnfd: */
# define FFD_SPAWN_SEARCH_PATH O_RDWR
diff --git a/src/angle/patches/0008-ANGLE-Fix-Windows-Store-D3D-Trim-and-Level-9-require.patch b/src/angle/patches/0008-ANGLE-Fix-Windows-Store-D3D-Trim-and-Level-9-require.patch
new file mode 100644
index 0000000000..705219ed24
--- /dev/null
+++ b/src/angle/patches/0008-ANGLE-Fix-Windows-Store-D3D-Trim-and-Level-9-require.patch
@@ -0,0 +1,57 @@
+From 3d696560f987a08d608b29bf3e0f557e96bebc56 Mon Sep 17 00:00:00 2001
+From: Samuel Nevala <samuel.nevala@intopalo.com>
+Date: Sat, 3 Oct 2015 02:30:26 +0300
+Subject: [PATCH] ANGLE: Fix Windows Store D3D Trim and Level 9 requirements
+
+Due to additional validation not covered in previous patches, the Windows
+Store certification compatibility had regressed. These changes ensure that
+the required D3D behaviors are met.
+
+Change-Id: I0a74f0d2fecaa87d4a9409da3a7a194254609759
+---
+ .../angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp | 16 +++++++++++++++-
+ .../angle/src/libGLESv2/entry_points_egl_ext.cpp | 2 ++
+ 2 files changed, 17 insertions(+), 1 deletion(-)
+
+diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
+index 5291a3a..61d9212 100644
+--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
++++ b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
+@@ -296,7 +296,21 @@ Renderer11::Renderer11(egl::Display *display)
+ if (requestedMajorVersion == 9 && requestedMinorVersion == 3)
+ #endif
+ {
+- mAvailableFeatureLevels.push_back(D3D_FEATURE_LEVEL_9_3);
++ if (requestedMinorVersion == EGL_DONT_CARE || requestedMinorVersion >= 3)
++ {
++ mAvailableFeatureLevels.push_back(D3D_FEATURE_LEVEL_9_3);
++ }
++#if defined(ANGLE_ENABLE_WINDOWS_STORE)
++ if (requestedMinorVersion == EGL_DONT_CARE || requestedMinorVersion >= 2)
++ {
++ mAvailableFeatureLevels.push_back(D3D_FEATURE_LEVEL_9_2);
++ }
++ if (requestedMinorVersion == EGL_DONT_CARE || requestedMinorVersion >= 1)
++ {
++ mAvailableFeatureLevels.push_back(D3D_FEATURE_LEVEL_9_1);
++ }
++#endif
+ }
+
+ EGLint requestedDeviceType = attributes.get(EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE,
+diff --git a/src/3rdparty/angle/src/libGLESv2/entry_points_egl_ext.cpp b/src/3rdparty/angle/src/libGLESv2/entry_points_egl_ext.cpp
+index 62f3ca1..02b6631 100644
+--- a/src/3rdparty/angle/src/libGLESv2/entry_points_egl_ext.cpp
++++ b/src/3rdparty/angle/src/libGLESv2/entry_points_egl_ext.cpp
+@@ -49,6 +49,8 @@ EGLBoolean EGLAPIENTRY QuerySurfacePointerANGLE(EGLDisplay dpy, EGLSurface surfa
+ // validate the attribute parameter
+ switch (attribute)
+ {
++ case EGL_DEVICE_EXT:
++ break;
+ case EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE:
+ if (!display->getExtensions().surfaceD3DTexture2DShareHandle)
+ {
+--
+1.9.5.msysgit.1
+
diff --git a/src/angle/src/common/common.pri b/src/angle/src/common/common.pri
index 8e2333d2ba..50dde6398b 100644
--- a/src/angle/src/common/common.pri
+++ b/src/angle/src/common/common.pri
@@ -44,7 +44,7 @@ winrt|if(msvc:!win32-msvc2005:!win32-msvc2008:!win32-msvc2010) {
# 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_PRIVATE += -L\"$$DXLIB_DIR\"
+ LIBS_PRIVATE += -L$$DXLIB_DIR
}
}
diff --git a/src/corelib/arch/qatomic_ia64.h b/src/corelib/arch/qatomic_ia64.h
index c880e85209..2ba6d127d9 100644
--- a/src/corelib/arch/qatomic_ia64.h
+++ b/src/corelib/arch/qatomic_ia64.h
@@ -1035,16 +1035,16 @@ bool QBasicAtomicOps<size>::deref(T &_q_value) Q_DECL_NOTHROW
}
template<int size> template <typename T> inline
-bool QBasicAtomicOps<size>::testAndSetRelaxed(T &_q_value, T expectedValue, T newValue) Q_DECL_NOTHROW
+bool QBasicAtomicOps<size>::testAndSetRelaxed(T &_q_value, T expectedValue, T newValue, T *currentValue) Q_DECL_NOTHROW
{
- return testAndSetAcquire(_q_value, expectedValue, newValue);
+ return testAndSetAcquire(_q_value, expectedValue, newValue, currentValue);
}
template<int size> template <typename T> inline
-bool QBasicAtomicOps<size>::testAndSetOrdered(T &_q_value, T expectedValue, T newValue) Q_DECL_NOTHROW
+bool QBasicAtomicOps<size>::testAndSetOrdered(T &_q_value, T expectedValue, T newValue, T *currentValue) Q_DECL_NOTHROW
{
orderedMemoryFence(_q_value);
- return testAndSetAcquire(_q_value, expectedValue, newValue);
+ return testAndSetAcquire(_q_value, expectedValue, newValue, currentValue);
}
template<int size> template <typename T> inline
diff --git a/src/corelib/codecs/qutfcodec_p.h b/src/corelib/codecs/qutfcodec_p.h
index 99887352c9..d97145c6fc 100644
--- a/src/corelib/codecs/qutfcodec_p.h
+++ b/src/corelib/codecs/qutfcodec_p.h
@@ -217,8 +217,6 @@ namespace QUtf8Functions
return Traits::Error;
if (bytesAvailable > 1 && !isContinuationByte(Traits::peekByte(src, 1)))
return Traits::Error;
- if (bytesAvailable > 2 && !isContinuationByte(Traits::peekByte(src, 2)))
- return Traits::Error;
return Traits::EndOfString;
}
diff --git a/src/corelib/doc/qtcore.qdocconf b/src/corelib/doc/qtcore.qdocconf
index 502689e4c2..3d64708def 100644
--- a/src/corelib/doc/qtcore.qdocconf
+++ b/src/corelib/doc/qtcore.qdocconf
@@ -25,8 +25,7 @@ qhp.QtCore.subprojects.classes.sortPages = true
tagfile = ../../../doc/qtcore/qtcore.tags
-depends += activeqt qtdbus qtgui qtwidgets qtnetwork qtdoc qtmacextras qtquick qtlinguist qtdesigner qtconcurrent qtxml qmake qtwinextras
-# depends += qtqml # Qt namespace collides with QtQml::Qt, see QTBUG-38630
+depends += activeqt qtdbus qtgui qtwidgets qtnetwork qtdoc qtmacextras qtquick qtlinguist qtdesigner qtconcurrent qtxml qmake qtwinextras qtqml
headerdirs += ..
diff --git a/src/corelib/doc/snippets/code/doc_src_containers.cpp b/src/corelib/doc/snippets/code/doc_src_containers.cpp
index 00971d69b9..395e48bc89 100644
--- a/src/corelib/doc/snippets/code/doc_src_containers.cpp
+++ b/src/corelib/doc/snippets/code/doc_src_containers.cpp
@@ -176,7 +176,7 @@ QMap<int, int> map;
...
QMap<int, int>::const_iterator i;
for (i = map.constBegin(); i != map.constEnd(); ++i)
- qDebug() << i.key() << ":" << i.value();
+ qDebug() << i.key() << ':' << i.value();
//! [13]
@@ -236,7 +236,7 @@ foreach (const QString &str, list) {
QMap<QString, int> map;
...
foreach (const QString &str, map.keys())
- qDebug() << str << ":" << map.value(str);
+ qDebug() << str << ':' << map.value(str);
//! [19]
@@ -245,7 +245,7 @@ QMultiMap<QString, int> map;
...
foreach (const QString &str, map.uniqueKeys()) {
foreach (int i, map.values(str))
- qDebug() << str << ":" << i;
+ qDebug() << str << ':' << i;
}
//! [20]
diff --git a/src/corelib/doc/snippets/code/src_corelib_tools_qhash.cpp b/src/corelib/doc/snippets/code/src_corelib_tools_qhash.cpp
index 0ac7cb5769..0976488a48 100644
--- a/src/corelib/doc/snippets/code/src_corelib_tools_qhash.cpp
+++ b/src/corelib/doc/snippets/code/src_corelib_tools_qhash.cpp
@@ -220,7 +220,7 @@ for (i = hash.begin(); i != hash.end(); ++i)
//! [19]
QHash<QString, int>::iterator i = hash.begin();
while (i != hash.end()) {
- if (i.key().startsWith("_"))
+ if (i.key().startsWith('_'))
i = hash.erase(i);
else
++i;
@@ -233,7 +233,7 @@ QHash<QString, int>::iterator i = hash.begin();
while (i != hash.end()) {
QHash<QString, int>::iterator prev = i;
++i;
- if (prev.key().startsWith("_"))
+ if (prev.key().startsWith('_'))
hash.erase(prev);
}
//! [20]
@@ -242,7 +242,7 @@ while (i != hash.end()) {
//! [21]
// WRONG
while (i != hash.end()) {
- if (i.key().startsWith("_"))
+ if (i.key().startsWith('_'))
hash.erase(i);
++i;
}
diff --git a/src/corelib/doc/snippets/code/src_corelib_tools_qlinkedlist.cpp b/src/corelib/doc/snippets/code/src_corelib_tools_qlinkedlist.cpp
index 014af8b0ee..f1cf644df6 100644
--- a/src/corelib/doc/snippets/code/src_corelib_tools_qlinkedlist.cpp
+++ b/src/corelib/doc/snippets/code/src_corelib_tools_qlinkedlist.cpp
@@ -128,7 +128,7 @@ QLinkedList<QString> list;
...
QLinkedList<QString>::iterator i = list.begin();
while (i != list.end()) {
- if ((*i).startsWith("_"))
+ if ((*i).startsWith('_'))
i = list.erase(i);
else
++i;
@@ -141,7 +141,7 @@ QLinkedList<QString>::iterator i = list.begin();
while (i != list.end()) {
QLinkedList<QString>::iterator previous = i;
++i;
- if ((*previous).startsWith("_"))
+ if ((*previous).startsWith('_'))
list.erase(previous);
}
//! [11]
@@ -150,7 +150,7 @@ while (i != list.end()) {
//! [12]
// WRONG
while (i != list.end()) {
- if ((*i).startsWith("_"))
+ if ((*i).startsWith('_'))
list.erase(i);
++i;
}
diff --git a/src/corelib/doc/snippets/code/src_corelib_tools_qmap.cpp b/src/corelib/doc/snippets/code/src_corelib_tools_qmap.cpp
index 29e53fc700..3241991129 100644
--- a/src/corelib/doc/snippets/code/src_corelib_tools_qmap.cpp
+++ b/src/corelib/doc/snippets/code/src_corelib_tools_qmap.cpp
@@ -234,7 +234,7 @@ for (i = map.begin(); i != map.end(); ++i)
//! [20]
QMap<QString, int>::iterator i = map.begin();
while (i != map.end()) {
- if (i.key().startsWith("_"))
+ if (i.key().startsWith('_'))
i = map.erase(i);
else
++i;
@@ -247,7 +247,7 @@ QMap<QString, int>::iterator i = map.begin();
while (i != map.end()) {
QMap<QString, int>::iterator prev = i;
++i;
- if (prev.key().startsWith("_"))
+ if (prev.key().startsWith('_'))
map.erase(prev);
}
//! [21]
@@ -256,7 +256,7 @@ while (i != map.end()) {
//! [22]
// WRONG
while (i != map.end()) {
- if (i.key().startsWith("_"))
+ if (i.key().startsWith('_'))
map.erase(i);
++i;
}
diff --git a/src/corelib/doc/snippets/qstring/main.cpp b/src/corelib/doc/snippets/qstring/main.cpp
index e03e705a0b..d0b5fb00f3 100644
--- a/src/corelib/doc/snippets/qstring/main.cpp
+++ b/src/corelib/doc/snippets/qstring/main.cpp
@@ -777,10 +777,10 @@ void Widget::splitCaseSensitiveFunction()
//! [62]
QString str = "a,,b,c";
- QStringList list1 = str.split(",");
+ QStringList list1 = str.split(',');
// list1: [ "a", "", "b", "c" ]
- QStringList list2 = str.split(",", QString::SkipEmptyParts);
+ QStringList list2 = str.split(',', QString::SkipEmptyParts);
// list2: [ "a", "b", "c" ]
//! [62]
}
diff --git a/src/corelib/doc/snippets/qstringlist/main.cpp b/src/corelib/doc/snippets/qstringlist/main.cpp
index 64f2061786..04d4dc8a89 100644
--- a/src/corelib/doc/snippets/qstringlist/main.cpp
+++ b/src/corelib/doc/snippets/qstringlist/main.cpp
@@ -82,7 +82,7 @@ Widget::Widget(QWidget *parent)
//! [5] //! [6]
QStringList list;
//! [5]
- list = str.split(",");
+ list = str.split(',');
// list: ["Arial", "Helvetica", "Times", "Courier"]
//! [6]
diff --git a/src/corelib/doc/src/eventsandfilters.qdoc b/src/corelib/doc/src/eventsandfilters.qdoc
index a4710eb288..99a40bb1b8 100644
--- a/src/corelib/doc/src/eventsandfilters.qdoc
+++ b/src/corelib/doc/src/eventsandfilters.qdoc
@@ -100,7 +100,7 @@
event delivery mechanisms are flexible. The documentation for
QCoreApplication::notify() concisely tells the whole story; the
\e{Qt Quarterly} article
- \l{http://doc.qt.digia.com/qq/qq11-events.html}{Another Look at Events}
+ \l{http://doc.qt.io/archives/qq/qq11-events.html}{Another Look at Events}
rehashes it less concisely. Here we will explain enough for 95%
of applications.
diff --git a/src/corelib/doc/src/objectmodel/metaobjects.qdoc b/src/corelib/doc/src/objectmodel/metaobjects.qdoc
index a482c5cc8b..52c134c517 100644
--- a/src/corelib/doc/src/objectmodel/metaobjects.qdoc
+++ b/src/corelib/doc/src/objectmodel/metaobjects.qdoc
@@ -32,7 +32,7 @@
\ingroup qt-basic-concepts
\keyword meta-object
- \target Meta-Object System
+ \keyword Meta-Object System
Qt's meta-object system provides the signals and slots mechanism for
inter-object communication, run-time type information, and the dynamic
diff --git a/src/corelib/doc/src/objectmodel/properties.qdoc b/src/corelib/doc/src/objectmodel/properties.qdoc
index 55622dd56b..28be328e3a 100644
--- a/src/corelib/doc/src/objectmodel/properties.qdoc
+++ b/src/corelib/doc/src/objectmodel/properties.qdoc
@@ -31,7 +31,7 @@
\brief An overview of Qt's property system.
\ingroup qt-basic-concepts
- \target Qt's Property System
+ \keyword Qt's Property System
Qt provides a sophisticated property system similar to the ones
supplied by some compiler vendors. However, as a compiler- and
diff --git a/src/corelib/doc/src/statemachine.qdoc b/src/corelib/doc/src/statemachine.qdoc
index e44a603959..d50851d816 100644
--- a/src/corelib/doc/src/statemachine.qdoc
+++ b/src/corelib/doc/src/statemachine.qdoc
@@ -71,6 +71,8 @@
which are currently active. All the states in a valid configuration of the state machine will
have a common ancestor.
+ \sa {The Declarative State Machine Framework}
+
\section1 Classes in the State Machine Framework
These classes are provided by qt for creating event-driven state machines.
diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h
index 4828d8596a..8595c51368 100644
--- a/src/corelib/global/qcompilerdetection.h
+++ b/src/corelib/global/qcompilerdetection.h
@@ -572,6 +572,9 @@
# if _MSC_VER < 1900
// ICC disables unicode string support when compatibility mode with MSVC 2013 or lower is active
# undef Q_COMPILER_UNICODE_STRINGS
+// Even though ICC knows about ref-qualified members, MSVC 2013 or lower doesn't, so
+// certain member functions (like QString::toUpper) may be missing from the DLLs.
+# undef Q_COMPILER_REF_QUALIFIERS
// Disable constexpr unless the MS headers have constexpr in all the right places too
// (like std::numeric_limits<T>::max())
# undef Q_COMPILER_CONSTEXPR
@@ -1140,7 +1143,7 @@
# define QT_WARNING_PUSH QT_DO_PRAGMA(clang diagnostic push)
# define QT_WARNING_POP QT_DO_PRAGMA(clang diagnostic pop)
# define QT_WARNING_DISABLE_CLANG(text) QT_DO_PRAGMA(clang diagnostic ignored text)
-# define QT_WARNING_DISABLE_GCC(text) QT_DO_PRAGMA(GCC diagnostic ignored text) // GCC directives work in Clang too
+# define QT_WARNING_DISABLE_GCC(text)
# define QT_WARNING_DISABLE_INTEL(number)
# define QT_WARNING_DISABLE_MSVC(number)
#elif defined(Q_CC_GNU) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 406)
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index 9019676d24..62308aec9d 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -120,7 +120,9 @@ Q_CORE_EXPORT void *qMemSet(void *dest, int c, size_t n);
// (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");
-
+#ifndef QT_BOOTSTRAPPED
+Q_STATIC_ASSERT_X(QT_POINTER_SIZE == sizeof(void *), "configure test ptrsize failed to correctly determine QT_POINTER_SIZE");
+#endif
/*!
\class QFlag
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index 41580598c7..d4bbbe833c 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -602,7 +602,7 @@ public:
QMacAutoReleasePool();
~QMacAutoReleasePool();
private:
- Q_DISABLE_COPY(QMacAutoReleasePool);
+ Q_DISABLE_COPY(QMacAutoReleasePool)
NSAutoreleasePool *pool;
};
diff --git a/src/corelib/global/qhooks_p.h b/src/corelib/global/qhooks_p.h
index 28e0c1ed37..2beb58f8a7 100644
--- a/src/corelib/global/qhooks_p.h
+++ b/src/corelib/global/qhooks_p.h
@@ -35,6 +35,17 @@
#ifndef QHOOKS_H
#define QHOOKS_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include <QtCore/qglobal.h>
QT_BEGIN_NAMESPACE
diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc
index 3edee03a2a..8568dfd97c 100644
--- a/src/corelib/global/qnamespace.qdoc
+++ b/src/corelib/global/qnamespace.qdoc
@@ -28,7 +28,7 @@
/*!
\namespace Qt
\inmodule QtCore
- \target Qt Namespace
+ \keyword Qt Namespace
\brief The Qt namespace contains miscellaneous identifiers
used throughout the Qt library.
@@ -1729,6 +1729,17 @@
\value Key_Zoom
\value Key_Exit
\value Key_Cancel
+ \value Key_MicVolumeUp
+ \value Key_Find
+ \value Key_Open
+ \value Key_MicVolumeDown
+ \value Key_New
+ \value Key_Settings
+ \value Key_Redo
+ \value Key_Exit
+ \value Key_Info
+ \value Key_Undo
+ \value Key_Guide
\sa QKeyEvent::key()
*/
@@ -2420,7 +2431,7 @@
\value WhatsThisCursor \inlineimage cursor-whatsthis.png
An arrow with a question mark, typically used to indicate
the presence of What's This? help for a widget.
- \value BusyCursor \inlineimage cursor-wait.png
+ \value BusyCursor \inlineimage cursor-busy.png
An hourglass or watch cursor, usually shown during
operations that allow the user to interact with
the application while they are performed in the
@@ -2730,7 +2741,7 @@
"\l{http://bugreports.qt.io/browse/QTWEBSITE-13}{http://bugreports.qt.../QTWEBSITE-13/}"),
whereas Qt::ElideRight is appropriate
for other strings (e.g.,
- "\l{http://doc.qt.digia.com/qq/qq09-mac-deployment.html}{Deploying Applications on Ma...}").
+ "\l{http://doc.qt.io/archives/qq/qq09-mac-deployment.html}{Deploying Applications on Ma...}").
\sa QAbstractItemView::textElideMode, QFontMetrics::elidedText(), AlignmentFlag, QTabBar::elideMode
*/
diff --git a/src/corelib/io/qdebug.cpp b/src/corelib/io/qdebug.cpp
index 13eccce9da..81af96b96b 100644
--- a/src/corelib/io/qdebug.cpp
+++ b/src/corelib/io/qdebug.cpp
@@ -696,6 +696,62 @@ QDebug &QDebug::resetFormat()
*/
/*!
+ \fn QDebug operator<<(QDebug stream, const QList<T> &list)
+ \relates QDebug
+
+ Writes the contents of \a list to \a stream. \c T needs to
+ support streaming into QDebug.
+*/
+
+/*!
+ \fn QDebug operator<<(QDebug stream, const QVector<T> &vector)
+ \relates QDebug
+
+ Writes the contents of \a vector to \a stream. \c T needs to
+ support streaming into QDebug.
+*/
+
+/*!
+ \fn QDebug operator<<(QDebug stream, const QSet<T> &set)
+ \relates QDebug
+
+ Writes the contents of \a set to \a stream. \c T needs to
+ support streaming into QDebug.
+*/
+
+/*!
+ \fn QDebug operator<<(QDebug stream, const QMap<Key, T> &map)
+ \relates QDebug
+
+ Writes the contents of \a map to \a stream. Both \c Key and
+ \c T need to support streaming into QDebug.
+*/
+
+/*!
+ \fn QDebug operator<<(QDebug stream, const QHash<Key, T> &hash)
+ \relates QDebug
+
+ Writes the contents of \a hash to \a stream. Both \c Key and
+ \c T need to support streaming into QDebug.
+*/
+
+/*!
+ \fn QDebug operator<<(QDebug stream, const QPair<T1, T2> &pair)
+ \relates QDebug
+
+ Writes the contents of \a pair to \a stream. Both \c T1 and
+ \c T2 need to support streaming into QDebug.
+*/
+
+/*!
+ \fn QDebug operator<<(QDebug stream, const QFlags<T> &flag)
+ \relates QDebug
+ \since 4.7
+
+ Writes \a flag to \a stream.
+*/
+
+/*!
\class QDebugStateSaver
\inmodule QtCore
\brief Convenience class for custom QDebug operators
diff --git a/src/corelib/io/qdebug.h b/src/corelib/io/qdebug.h
index 2f626dfc1f..b1a0396f35 100644
--- a/src/corelib/io/qdebug.h
+++ b/src/corelib/io/qdebug.h
@@ -216,12 +216,12 @@ inline QDebug operator<<(QDebug debug, const QVector<T> &vec)
return operator<<(debug, vec.toList());
}
-template <class aKey, class aT>
-inline QDebug operator<<(QDebug debug, const QMap<aKey, aT> &map)
+template <class Key, class T>
+inline QDebug operator<<(QDebug debug, const QMap<Key, T> &map)
{
const bool oldSetting = debug.autoInsertSpaces();
debug.nospace() << "QMap(";
- for (typename QMap<aKey, aT>::const_iterator it = map.constBegin();
+ for (typename QMap<Key, T>::const_iterator it = map.constBegin();
it != map.constEnd(); ++it) {
debug << '(' << it.key() << ", " << it.value() << ')';
}
@@ -230,12 +230,12 @@ inline QDebug operator<<(QDebug debug, const QMap<aKey, aT> &map)
return debug.maybeSpace();
}
-template <class aKey, class aT>
-inline QDebug operator<<(QDebug debug, const QHash<aKey, aT> &hash)
+template <class Key, class T>
+inline QDebug operator<<(QDebug debug, const QHash<Key, T> &hash)
{
const bool oldSetting = debug.autoInsertSpaces();
debug.nospace() << "QHash(";
- for (typename QHash<aKey, aT>::const_iterator it = hash.constBegin();
+ for (typename QHash<Key, T>::const_iterator it = hash.constBegin();
it != hash.constEnd(); ++it)
debug << '(' << it.key() << ", " << it.value() << ')';
debug << ')';
@@ -276,7 +276,7 @@ inline QDebug operator<<(QDebug debug, const QContiguousCache<T> &cache)
return debug.maybeSpace();
}
-#ifndef QT_NO_QOBJECT
+#if !defined(QT_NO_QOBJECT) && !defined(Q_QDOC)
Q_CORE_EXPORT QDebug qt_QMetaEnum_debugOperator(QDebug&, int value, const QMetaObject *meta, const char *name);
Q_CORE_EXPORT QDebug qt_QMetaEnum_flagDebugOperator(QDebug &dbg, quint64 value, const QMetaObject *meta, const char *name);
@@ -305,7 +305,7 @@ inline typename QtPrivate::QEnableIf<
!QtPrivate::IsQEnumHelper<T>::Value && !QtPrivate::IsQEnumHelper<QFlags<T> >::Value,
QDebug>::Type
qt_QMetaEnum_flagDebugOperator_helper(QDebug debug, const QFlags<T> &flags)
-#else // !QT_NO_QOBJECT
+#else // !QT_NO_QOBJECT && !Q_QDOC
template <class T>
inline QDebug qt_QMetaEnum_flagDebugOperator_helper(QDebug debug, const QFlags<T> &flags)
#endif
diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp
index e1d9858a66..4d2b36632f 100644
--- a/src/corelib/io/qdir.cpp
+++ b/src/corelib/io/qdir.cpp
@@ -138,7 +138,7 @@ inline QChar QDirPrivate::getFilterSepChar(const QString &nameFilter)
// static
inline QStringList QDirPrivate::splitFilters(const QString &nameFilter, QChar sep)
{
- if (sep == 0)
+ if (sep.isNull())
sep = getFilterSepChar(nameFilter);
QStringList ret = nameFilter.split(sep);
for (int i = 0; i < ret.count(); ++i)
diff --git a/src/corelib/io/qfilesystemengine.cpp b/src/corelib/io/qfilesystemengine.cpp
index e4dec2b7fb..a49d69d447 100644
--- a/src/corelib/io/qfilesystemengine.cpp
+++ b/src/corelib/io/qfilesystemengine.cpp
@@ -152,7 +152,7 @@ static bool _q_resolveEntryAndCreateLegacyEngine_recursive(QFileSystemEntry &ent
const QStringList &paths = QDir::searchPaths(filePath.left(prefixSeparator));
for (int i = 0; i < paths.count(); i++) {
- entry = QFileSystemEntry(QDir::cleanPath(paths.at(i) % QLatin1Char('/') % filePath.mid(prefixSeparator + 1)));
+ entry = QFileSystemEntry(QDir::cleanPath(paths.at(i) % QLatin1Char('/') % filePath.midRef(prefixSeparator + 1)));
// Recurse!
if (_q_resolveEntryAndCreateLegacyEngine_recursive(entry, data, engine, true))
return true;
diff --git a/src/corelib/io/qfilesystementry.cpp b/src/corelib/io/qfilesystementry.cpp
index 79f16a0839..709970e3ac 100644
--- a/src/corelib/io/qfilesystementry.cpp
+++ b/src/corelib/io/qfilesystementry.cpp
@@ -53,8 +53,7 @@ static bool isUncRoot(const QString &server)
if (idx == -1 || idx + 1 == localPath.length())
return true;
- localPath = localPath.right(localPath.length() - idx - 1).trimmed();
- return localPath.isEmpty();
+ return localPath.rightRef(localPath.length() - idx - 1).trimmed().isEmpty();
}
static inline QString fixIfRelativeUncPath(const QString &path)
diff --git a/src/corelib/io/qfilesystemwatcher.cpp b/src/corelib/io/qfilesystemwatcher.cpp
index 7fc3049f46..23a2fbecdb 100644
--- a/src/corelib/io/qfilesystemwatcher.cpp
+++ b/src/corelib/io/qfilesystemwatcher.cpp
@@ -296,7 +296,9 @@ QStringList QFileSystemWatcher::addPaths(const QStringList &paths)
QFileSystemWatcherEngine *engine = 0;
- if(!objectName().startsWith(QLatin1String("_qt_autotest_force_engine_"))) {
+ const QString on = objectName();
+
+ if (!on.startsWith(QLatin1String("_qt_autotest_force_engine_"))) {
// Normal runtime case - search intelligently for best engine
if(d->native) {
engine = d->native;
@@ -307,7 +309,7 @@ QStringList QFileSystemWatcher::addPaths(const QStringList &paths)
} else {
// Autotest override case - use the explicitly selected engine only
- QString forceName = objectName().mid(26);
+ const QStringRef forceName = on.midRef(26);
if(forceName == QLatin1String("poller")) {
qDebug() << "QFileSystemWatcher: skipping native engine, using only polling engine";
d_func()->initPollerEngine();
diff --git a/src/corelib/io/qfilesystemwatcher_win.cpp b/src/corelib/io/qfilesystemwatcher_win.cpp
index 4907a20a5f..410753868e 100644
--- a/src/corelib/io/qfilesystemwatcher_win.cpp
+++ b/src/corelib/io/qfilesystemwatcher_win.cpp
@@ -186,7 +186,7 @@ QStringList QWindowsFileSystemWatcherEngine::addPaths(const QStringList &paths,
}
if (!found) {
QWindowsFileSystemWatcherEngineThread *thread = new QWindowsFileSystemWatcherEngineThread();
- DEBUG() << " ###Creating new thread" << thread << "(" << (threads.count()+1) << "threads)";
+ DEBUG() << " ###Creating new thread" << thread << '(' << (threads.count()+1) << "threads)";
thread->handles.append(handle.handle);
thread->handleForDir.insert(QFileSystemWatcherPathKey(absolutePath), handle);
diff --git a/src/corelib/io/qfsfileengine_p.h b/src/corelib/io/qfsfileengine_p.h
index 8ba05fa8b9..0a7f551672 100644
--- a/src/corelib/io/qfsfileengine_p.h
+++ b/src/corelib/io/qfsfileengine_p.h
@@ -199,7 +199,6 @@ public:
bool closeFileHandle;
mutable uint is_sequential : 2;
- mutable uint could_stat : 1;
mutable uint tried_stat : 1;
#if !defined(Q_OS_WINCE)
mutable uint need_lstat : 1;
diff --git a/src/corelib/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp
index 84a6a1d9cb..c80c78bd3b 100644
--- a/src/corelib/io/qiodevice.cpp
+++ b/src/corelib/io/qiodevice.cpp
@@ -83,6 +83,7 @@ void debugBinaryString(const char *data, qint64 maxlen)
static void checkWarnMessage(const QIODevice *device, const char *function, const char *what)
{
+#ifndef QT_NO_WARNING_OUTPUT
QDebug d = qWarning();
d.noquote();
d.nospace();
@@ -98,6 +99,11 @@ static void checkWarnMessage(const QIODevice *device, const char *function, cons
Q_UNUSED(device)
#endif // !QT_NO_QOBJECT
d << ": " << what;
+#else
+ Q_UNUSED(device);
+ Q_UNUSED(function);
+ Q_UNUSED(what);
+#endif // QT_NO_WARNING_OUTPUT
}
#define CHECK_MAXLEN(function, returnType) \
diff --git a/src/corelib/io/qlockfile_unix.cpp b/src/corelib/io/qlockfile_unix.cpp
index 27f8a97fd4..365f3e07ab 100644
--- a/src/corelib/io/qlockfile_unix.cpp
+++ b/src/corelib/io/qlockfile_unix.cpp
@@ -56,7 +56,13 @@
# include <cstdio>
#elif defined(Q_OS_BSD4) && !defined(Q_OS_IOS)
# include <sys/user.h>
+# if defined(__GLIBC__) && defined(__FreeBSD_kernel__)
+# include <sys/cdefs.h>
+# include <sys/param.h>
+# include <sys/sysctl.h>
+# else
# include <libutil.h>
+# endif
#endif
QT_BEGIN_NAMESPACE
@@ -165,8 +171,10 @@ QLockFile::LockError QLockFilePrivate::tryLock_sys()
}
}
// Ensure nobody else can delete the file while we have it
- if (!setNativeLocks(fd))
- qWarning() << "setNativeLocks failed:" << strerror(errno);
+ if (!setNativeLocks(fd)) {
+ const int errnoSaved = errno;
+ qWarning() << "setNativeLocks failed:" << qt_error_string(errnoSaved);
+ }
if (qt_write_loop(fd, fileData.constData(), fileData.size()) < fileData.size()) {
close(fd);
@@ -178,6 +186,13 @@ QLockFile::LockError QLockFilePrivate::tryLock_sys()
// We hold the lock, continue.
fileHandle = fd;
+ // Sync to disk if possible. Ignore errors (e.g. not supported).
+#if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0
+ fdatasync(fileHandle);
+#else
+ fsync(fileHandle);
+#endif
+
return QLockFile::NoError;
}
@@ -234,9 +249,27 @@ QString QLockFilePrivate::processNameByPid(qint64 pid)
buf[len] = 0;
return QFileInfo(QFile::decodeName(buf)).fileName();
#elif defined(Q_OS_BSD4) && !defined(Q_OS_IOS)
+# if defined(__GLIBC__) && defined(__FreeBSD_kernel__)
+ int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, pid };
+ size_t len = 0;
+ if (sysctl(mib, 4, NULL, &len, NULL, 0) < 0)
+ return QString();
+ kinfo_proc *proc = static_cast<kinfo_proc *>(malloc(len));
+# else
kinfo_proc *proc = kinfo_getproc(pid);
+# endif
if (!proc)
return QString();
+# if defined(__GLIBC__) && defined(__FreeBSD_kernel__)
+ if (sysctl(mib, 4, proc, &len, NULL, 0) < 0) {
+ free(proc);
+ return QString();
+ }
+ if (proc->ki_pid != pid) {
+ free(proc);
+ return QString();
+ }
+# endif
QString name = QFile::decodeName(proc->ki_comm);
free(proc);
return name;
diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp
index ecda86a91d..3539c75548 100644
--- a/src/corelib/io/qprocess.cpp
+++ b/src/corelib/io/qprocess.cpp
@@ -156,16 +156,8 @@ QStringList QProcessEnvironmentPrivate::toList() const
{
QStringList result;
result.reserve(hash.size());
- Hash::ConstIterator it = hash.constBegin(),
- end = hash.constEnd();
- for ( ; it != end; ++it) {
- QString data = nameToString(it.key());
- QString value = valueToString(it.value());
- data.reserve(data.length() + value.length() + 1);
- data.append(QLatin1Char('='));
- data.append(value);
- result << data;
- }
+ for (Hash::const_iterator it = hash.cbegin(), end = hash.cend(); it != end; ++it)
+ result << nameToString(it.key()) + QLatin1Char('=') + valueToString(it.value());
return result;
}
diff --git a/src/corelib/io/qresource.cpp b/src/corelib/io/qresource.cpp
index 4e6079306b..0674ef34e0 100644
--- a/src/corelib/io/qresource.cpp
+++ b/src/corelib/io/qresource.cpp
@@ -800,8 +800,8 @@ bool QResourceRoot::mappingRootSubdir(const QString &path, QString *match) const
{
const QString root = mappingRoot();
if(!root.isEmpty()) {
- const QStringList root_segments = root.split(QLatin1Char('/'), QString::SkipEmptyParts),
- path_segments = path.split(QLatin1Char('/'), QString::SkipEmptyParts);
+ const QVector<QStringRef> root_segments = root.splitRef(QLatin1Char('/'), QString::SkipEmptyParts),
+ path_segments = path.splitRef(QLatin1Char('/'), QString::SkipEmptyParts);
if(path_segments.size() <= root_segments.size()) {
int matched = 0;
for(int i = 0; i < path_segments.size(); ++i) {
@@ -811,7 +811,7 @@ bool QResourceRoot::mappingRootSubdir(const QString &path, QString *match) const
}
if(matched == path_segments.size()) {
if(match && root_segments.size() > matched)
- *match = root_segments.at(matched);
+ *match = root_segments.at(matched).toString();
return true;
}
}
diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp
index 654d688c53..3460753fbe 100644
--- a/src/corelib/io/qsettings.cpp
+++ b/src/corelib/io/qsettings.cpp
@@ -488,7 +488,7 @@ QVariant QSettingsPrivate::stringToVariant(const QString &s)
if (s.startsWith(QLatin1Char('@'))) {
if (s.endsWith(QLatin1Char(')'))) {
if (s.startsWith(QLatin1String("@ByteArray("))) {
- return QVariant(s.toLatin1().mid(11, s.size() - 12));
+ return QVariant(s.midRef(11, s.size() - 12).toLatin1());
} else if (s.startsWith(QLatin1String("@Variant("))
|| s.startsWith(QLatin1String("@DateTime("))) {
#ifndef QT_NO_DATASTREAM
@@ -501,7 +501,7 @@ QVariant QSettingsPrivate::stringToVariant(const QString &s)
version = QDataStream::Qt_4_0;
offset = 9;
}
- QByteArray a(s.toLatin1().mid(offset));
+ QByteArray a = s.midRef(offset).toLatin1();
QDataStream stream(&a, QIODevice::ReadOnly);
stream.setVersion(version);
QVariant result;
@@ -632,8 +632,9 @@ void QSettingsPrivate::iniEscapedString(const QString &str, QByteArray &result,
int startPos = result.size();
result.reserve(startPos + str.size() * 3 / 2);
+ const QChar *unicode = str.unicode();
for (i = 0; i < str.size(); ++i) {
- uint ch = str.at(i).unicode();
+ uint ch = unicode[i].unicode();
if (ch == ';' || ch == ',' || ch == '=')
needsQuotes = true;
@@ -687,7 +688,7 @@ void QSettingsPrivate::iniEscapedString(const QString &str, QByteArray &result,
#ifndef QT_NO_TEXTCODEC
} else if (useCodec) {
// slow
- result += codec->fromUnicode(str.at(i));
+ result += codec->fromUnicode(&unicode[i], 1);
#endif
} else {
result += (char)ch;
diff --git a/src/corelib/io/qsettings_mac.cpp b/src/corelib/io/qsettings_mac.cpp
index 1ad198b990..e0b317b4c2 100644
--- a/src/corelib/io/qsettings_mac.cpp
+++ b/src/corelib/io/qsettings_mac.cpp
@@ -386,7 +386,7 @@ QMacSettingsPrivate::QMacSettingsPrivate(QSettings::Scope scope, const QString &
if (main_bundle_identifier != NULL) {
QString bundle_identifier(qtKey(main_bundle_identifier));
// CFBundleGetIdentifier returns identifier separated by slashes rather than periods.
- QStringList bundle_identifier_components = bundle_identifier.split(QLatin1String("/"));
+ QStringList bundle_identifier_components = bundle_identifier.split(QLatin1Char('/'));
// pre-reverse them so that when they get reversed again below, they are in the com.company.product format.
QStringList bundle_identifier_components_reversed;
for (int i=0; i<bundle_identifier_components.size(); ++i) {
@@ -403,11 +403,11 @@ QMacSettingsPrivate::QMacSettingsPrivate(QSettings::Scope scope, const QString &
}
while ((nextDot = domainName.indexOf(QLatin1Char('.'), curPos)) != -1) {
- javaPackageName.prepend(domainName.mid(curPos, nextDot - curPos));
+ javaPackageName.prepend(domainName.midRef(curPos, nextDot - curPos));
javaPackageName.prepend(QLatin1Char('.'));
curPos = nextDot + 1;
}
- javaPackageName.prepend(domainName.mid(curPos));
+ javaPackageName.prepend(domainName.midRef(curPos));
javaPackageName = javaPackageName.toLower();
if (curPos == 0)
javaPackageName.prepend(QLatin1String("com."));
diff --git a/src/corelib/io/qstandardpaths_win.cpp b/src/corelib/io/qstandardpaths_win.cpp
index 0a13f94f05..ed1c14ad8a 100644
--- a/src/corelib/io/qstandardpaths_win.cpp
+++ b/src/corelib/io/qstandardpaths_win.cpp
@@ -200,7 +200,7 @@ QStringList QStandardPaths::standardLocations(StandardLocation type)
case AppDataLocation:
case AppLocalDataLocation:
case GenericDataLocation:
- if (SHGetSpecialFolderPath(0, path, clsidForAppDataLocation(type), FALSE)) {
+ if (SHGetSpecialFolderPath(0, path, CSIDL_COMMON_APPDATA, FALSE)) {
QString result = convertCharArray(path);
if (type != GenericDataLocation && type != GenericConfigLocation) {
#ifndef QT_BOOTSTRAPPED
diff --git a/src/corelib/io/qtemporarydir.cpp b/src/corelib/io/qtemporarydir.cpp
index c7150d7b33..71436c6497 100644
--- a/src/corelib/io/qtemporarydir.cpp
+++ b/src/corelib/io/qtemporarydir.cpp
@@ -49,6 +49,10 @@
#include <private/qfilesystemengine_p.h>
#endif
+#if !defined(Q_OS_WIN)
+#include <errno.h>
+#endif
+
QT_BEGIN_NAMESPACE
//************* QTemporaryDirPrivate
diff --git a/src/corelib/io/qtextstream.cpp b/src/corelib/io/qtextstream.cpp
index ca3be9b7e0..ccf832e2e8 100644
--- a/src/corelib/io/qtextstream.cpp
+++ b/src/corelib/io/qtextstream.cpp
@@ -2858,7 +2858,7 @@ QTextStream &endl(QTextStream &stream)
/*!
\relates QTextStream
- Calls \l{QTextStream::flush()}{flush()} on \a stream and returns \a stream.
+ Calls QTextStream::flush() on \a stream and returns \a stream.
\sa endl(), reset(), {QTextStream manipulators}
*/
diff --git a/src/corelib/io/qtldurl.cpp b/src/corelib/io/qtldurl.cpp
index d68d0ddf46..265055083e 100644
--- a/src/corelib/io/qtldurl.cpp
+++ b/src/corelib/io/qtldurl.cpp
@@ -99,19 +99,14 @@ Q_CORE_EXPORT bool qIsEffectiveTLD(const QString &domain)
if (containsTLDEntry(domain))
return true;
- if (domain.contains(QLatin1Char('.'))) {
- int count = domain.size() - domain.indexOf(QLatin1Char('.'));
- QString wildCardDomain;
- wildCardDomain.reserve(count + 1);
- wildCardDomain.append(QLatin1Char('*'));
- wildCardDomain.append(domain.right(count));
+ const int dot = domain.indexOf(QLatin1Char('.'));
+ if (dot >= 0) {
+ int count = domain.size() - dot;
+ QString wildCardDomain = QLatin1Char('*') + domain.rightRef(count);
// 2. if table contains '*.bar.com',
// test if table contains '!foo.bar.com'
if (containsTLDEntry(wildCardDomain)) {
- QString exceptionDomain;
- exceptionDomain.reserve(domain.size() + 1);
- exceptionDomain.append(QLatin1Char('!'));
- exceptionDomain.append(domain);
+ QString exceptionDomain = QLatin1Char('!') + domain;
return (! containsTLDEntry(exceptionDomain));
}
}
diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp
index 89f5aad97f..9bf359222a 100644
--- a/src/corelib/io/qurl.cpp
+++ b/src/corelib/io/qurl.cpp
@@ -2411,8 +2411,8 @@ void QUrl::setPort(int port)
d->clearError();
if (port < -1 || port > 65535) {
- port = -1;
d->setError(QUrlPrivate::InvalidPortError, QString::number(port), 0);
+ port = -1;
}
d->port = port;
diff --git a/src/corelib/io/qwindowspipereader.cpp b/src/corelib/io/qwindowspipereader.cpp
index 2cc5741250..a49fcdaf9f 100644
--- a/src/corelib/io/qwindowspipereader.cpp
+++ b/src/corelib/io/qwindowspipereader.cpp
@@ -187,7 +187,7 @@ void QWindowsPipeReader::notified(quint32 numberOfBytesRead, quint32 errorCode,
pipeBroken = true;
break;
default:
- emit winError(errorCode, QLatin1String("QWindowsPipeReader::completeAsyncRead"));
+ emit winError(errorCode, QLatin1String("QWindowsPipeReader::notified"));
pipeBroken = true;
break;
}
diff --git a/src/corelib/io/qwindowspipewriter.cpp b/src/corelib/io/qwindowspipewriter.cpp
index 57053f129a..fd14523d45 100644
--- a/src/corelib/io/qwindowspipewriter.cpp
+++ b/src/corelib/io/qwindowspipewriter.cpp
@@ -90,11 +90,38 @@ qint64 QWindowsPipeWriter::write(const char *ptr, qint64 maxlen)
return maxlen;
}
+class QPipeWriterOverlapped
+{
+public:
+ QPipeWriterOverlapped()
+ {
+ overlapped.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
+ }
+
+ ~QPipeWriterOverlapped()
+ {
+ CloseHandle(overlapped.hEvent);
+ }
+
+ void prepare()
+ {
+ const HANDLE hEvent = overlapped.hEvent;
+ ZeroMemory(&overlapped, sizeof overlapped);
+ overlapped.hEvent = hEvent;
+ }
+
+ OVERLAPPED *operator&()
+ {
+ return &overlapped;
+ }
+
+private:
+ OVERLAPPED overlapped;
+};
+
void QWindowsPipeWriter::run()
{
- OVERLAPPED overl;
- memset(&overl, 0, sizeof overl);
- overl.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
+ QPipeWriterOverlapped overl;
forever {
lock.lock();
while(data.isEmpty() && (!quitNow)) {
@@ -115,26 +142,24 @@ void QWindowsPipeWriter::run()
const char *ptrData = copy.data();
qint64 maxlen = copy.size();
qint64 totalWritten = 0;
- overl.Offset = 0;
- overl.OffsetHigh = 0;
+ overl.prepare();
while ((!quitNow) && totalWritten < maxlen) {
DWORD written = 0;
if (!WriteFile(writePipe, ptrData + totalWritten,
maxlen - totalWritten, &written, &overl)) {
-
- if (GetLastError() == 0xE8/*NT_STATUS_INVALID_USER_BUFFER*/) {
+ const DWORD writeError = GetLastError();
+ if (writeError == 0xE8/*NT_STATUS_INVALID_USER_BUFFER*/) {
// give the os a rest
msleep(100);
continue;
}
#ifndef Q_OS_WINCE
- if (GetLastError() == ERROR_IO_PENDING) {
- if (!GetOverlappedResult(writePipe, &overl, &written, TRUE)) {
- CloseHandle(overl.hEvent);
- return;
- }
- } else {
- CloseHandle(overl.hEvent);
+ if (writeError != ERROR_IO_PENDING) {
+ qErrnoWarning(writeError, "QWindowsPipeWriter: async WriteFile failed.");
+ return;
+ }
+ if (!GetOverlappedResult(writePipe, &overl, &written, TRUE)) {
+ qErrnoWarning(GetLastError(), "QWindowsPipeWriter: GetOverlappedResult failed.");
return;
}
#else
@@ -154,7 +179,6 @@ void QWindowsPipeWriter::run()
emit bytesWritten(totalWritten);
emit canWrite();
}
- CloseHandle(overl.hEvent);
}
#endif //QT_NO_THREAD
diff --git a/src/corelib/json/qjsondocument.cpp b/src/corelib/json/qjsondocument.cpp
index f5bad32233..3ef006d82d 100644
--- a/src/corelib/json/qjsondocument.cpp
+++ b/src/corelib/json/qjsondocument.cpp
@@ -574,7 +574,7 @@ QDebug operator<<(QDebug dbg, const QJsonDocument &o)
QJsonPrivate::Writer::objectToJson(static_cast<QJsonPrivate::Object *>(o.d->header->root()), json, 0, true);
dbg.nospace() << "QJsonDocument("
<< json.constData() // print as utf-8 string without extra quotation marks
- << ")";
+ << ')';
return dbg;
}
#endif
diff --git a/src/corelib/json/qjsonvalue.cpp b/src/corelib/json/qjsonvalue.cpp
index ae6a3678bd..4c7a44b4a0 100644
--- a/src/corelib/json/qjsonvalue.cpp
+++ b/src/corelib/json/qjsonvalue.cpp
@@ -738,23 +738,23 @@ QDebug operator<<(QDebug dbg, const QJsonValue &o)
dbg << "QJsonValue(null)";
break;
case QJsonValue::Bool:
- dbg.nospace() << "QJsonValue(bool, " << o.toBool() << ")";
+ dbg.nospace() << "QJsonValue(bool, " << o.toBool() << ')';
break;
case QJsonValue::Double:
- dbg.nospace() << "QJsonValue(double, " << o.toDouble() << ")";
+ dbg.nospace() << "QJsonValue(double, " << o.toDouble() << ')';
break;
case QJsonValue::String:
- dbg.nospace() << "QJsonValue(string, " << o.toString() << ")";
+ dbg.nospace() << "QJsonValue(string, " << o.toString() << ')';
break;
case QJsonValue::Array:
dbg.nospace() << "QJsonValue(array, ";
dbg << o.toArray();
- dbg << ")";
+ dbg << ')';
break;
case QJsonValue::Object:
dbg.nospace() << "QJsonValue(object, ";
dbg << o.toObject();
- dbg << ")";
+ dbg << ')';
break;
}
return dbg;
diff --git a/src/corelib/json/qjsonwriter.cpp b/src/corelib/json/qjsonwriter.cpp
index 99f83554c2..45a05e93a3 100644
--- a/src/corelib/json/qjsonwriter.cpp
+++ b/src/corelib/json/qjsonwriter.cpp
@@ -137,13 +137,13 @@ static void valueToJson(const QJsonPrivate::Base *b, const QJsonPrivate::Value &
json += compact ? "[" : "[\n";
arrayContentToJson(static_cast<QJsonPrivate::Array *>(v.base(b)), json, indent + (compact ? 0 : 1), compact);
json += QByteArray(4*indent, ' ');
- json += "]";
+ json += ']';
break;
case QJsonValue::Object:
json += compact ? "{" : "{\n";
objectContentToJson(static_cast<QJsonPrivate::Object *>(v.base(b)), json, indent + (compact ? 0 : 1), compact);
json += QByteArray(4*indent, ' ');
- json += "}";
+ json += '}';
break;
case QJsonValue::Null:
default:
diff --git a/src/corelib/kernel/qcore_unix_p.h b/src/corelib/kernel/qcore_unix_p.h
index c744873fce..f80dcb5a50 100644
--- a/src/corelib/kernel/qcore_unix_p.h
+++ b/src/corelib/kernel/qcore_unix_p.h
@@ -47,6 +47,7 @@
#include "qplatformdefs.h"
#include "qatomic.h"
+#include "qhash.h"
#ifndef Q_OS_UNIX
# error "qcore_unix_p.h included on a non-Unix system"
@@ -322,6 +323,19 @@ union qt_semun {
unsigned short *array; /* array for GETALL, SETALL */
};
+#ifndef QT_POSIX_IPC
+#ifndef QT_NO_SHAREDMEMORY
+#ifndef Q_OS_ANDROID
+static inline key_t qt_safe_ftok(const QByteArray &filename, int proj_id)
+{
+ // Unfortunately ftok can return colliding keys even for different files.
+ // Try to add some more entropy via qHash.
+ return ::ftok(filename.constData(), qHash(filename, proj_id));
+}
+#endif // !Q_OS_ANDROID
+#endif // !QT_NO_SHAREDMEMORY
+#endif // !QT_POSIX_IPC
+
QT_END_NAMESPACE
#endif
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index 3013db8b2e..53725c7f90 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -455,8 +455,8 @@ QCoreApplicationPrivate::QCoreApplicationPrivate(int &aargc, char **aargv, uint
qt_application_thread_id = QThread::currentThreadId();
# endif
- // note: this call to QThread::currentThread() may end up setting theMainThread!
- if (QThread::currentThread() != theMainThread)
+ QThread *cur = QThread::currentThread(); // note: this may end up setting theMainThread!
+ if (cur != theMainThread)
qWarning("WARNING: QApplication was not created in the main() thread.");
#endif
}
@@ -526,11 +526,11 @@ void QCoreApplicationPrivate::eventDispatcherReady()
{
}
-QThread *QCoreApplicationPrivate::theMainThread = 0;
+QBasicAtomicPointer<QThread> QCoreApplicationPrivate::theMainThread = Q_BASIC_ATOMIC_INITIALIZER(0);
QThread *QCoreApplicationPrivate::mainThread()
{
- Q_ASSERT(theMainThread != 0);
- return theMainThread;
+ Q_ASSERT(theMainThread.load() != 0);
+ return theMainThread.load();
}
bool QCoreApplicationPrivate::threadRequiresCoreApplication()
@@ -2759,7 +2759,7 @@ bool QCoreApplication::hasPendingEvents()
QAbstractEventDispatcher *QCoreApplication::eventDispatcher()
{
if (QCoreApplicationPrivate::theMainThread)
- return QCoreApplicationPrivate::theMainThread->eventDispatcher();
+ return QCoreApplicationPrivate::theMainThread.load()->eventDispatcher();
return 0;
}
diff --git a/src/corelib/kernel/qcoreapplication_p.h b/src/corelib/kernel/qcoreapplication_p.h
index 21f59d8197..9a9e8dd09a 100644
--- a/src/corelib/kernel/qcoreapplication_p.h
+++ b/src/corelib/kernel/qcoreapplication_p.h
@@ -105,7 +105,7 @@ public:
}
void maybeQuit();
- static QThread *theMainThread;
+ static QBasicAtomicPointer<QThread> theMainThread;
static QThread *mainThread();
static bool threadRequiresCoreApplication();
diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp
index e8ff8a7936..ecaa78cbbc 100644
--- a/src/corelib/kernel/qeventdispatcher_win.cpp
+++ b/src/corelib/kernel/qeventdispatcher_win.cpp
@@ -390,6 +390,8 @@ LRESULT QT_WIN_CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPA
QSockNot *sn = dict ? dict->value(wp) : 0;
if (sn) {
+ d->doWsaAsyncSelect(sn->fd, 0);
+ d->active_fd[sn->fd].selected = false;
if (type < 3) {
QEvent event(QEvent::SockAct);
QCoreApplication::sendEvent(sn->obj, &event);
@@ -632,19 +634,12 @@ void QEventDispatcherWin32Private::sendTimerEvent(int timerId)
}
}
-void QEventDispatcherWin32Private::doWsaAsyncSelect(int socket)
+void QEventDispatcherWin32Private::doWsaAsyncSelect(int socket, long event)
{
Q_ASSERT(internalHwnd);
- int sn_event = 0;
- if (sn_read.contains(socket))
- sn_event |= FD_READ | FD_CLOSE | FD_ACCEPT;
- if (sn_write.contains(socket))
- sn_event |= FD_WRITE | FD_CONNECT;
- if (sn_except.contains(socket))
- sn_event |= FD_OOB;
- // BoundsChecker may emit a warning for WSAAsyncSelect when sn_event == 0
+ // BoundsChecker may emit a warning for WSAAsyncSelect when event == 0
// This is a BoundsChecker bug and not a Qt bug
- WSAAsyncSelect(socket, internalHwnd, sn_event ? int(WM_QT_SOCKETNOTIFIER) : 0, sn_event);
+ WSAAsyncSelect(socket, internalHwnd, event ? int(WM_QT_SOCKETNOTIFIER) : 0, event);
}
void QEventDispatcherWin32::createInternalHwnd()
@@ -657,13 +652,6 @@ void QEventDispatcherWin32::createInternalHwnd()
installMessageHook();
- // register all socket notifiers
- QList<int> sockets = (d->sn_read.keys().toSet()
- + d->sn_write.keys().toSet()
- + d->sn_except.keys().toSet()).toList();
- for (int i = 0; i < sockets.count(); ++i)
- d->doWsaAsyncSelect(sockets.at(i));
-
// start all normal timers
for (int i = 0; i < d->timerVec.count(); ++i)
d->registerTimer(d->timerVec.at(i));
@@ -748,28 +736,40 @@ bool QEventDispatcherWin32::processEvents(QEventLoop::ProcessEventsFlags flags)
msg = d->queuedSocketEvents.takeFirst();
} else {
haveMessage = PeekMessage(&msg, 0, 0, 0, PM_REMOVE);
- if (haveMessage && (flags & QEventLoop::ExcludeUserInputEvents)
- && ((msg.message >= WM_KEYFIRST
- && msg.message <= WM_KEYLAST)
- || (msg.message >= WM_MOUSEFIRST
- && msg.message <= WM_MOUSELAST)
- || msg.message == WM_MOUSEWHEEL
- || msg.message == WM_MOUSEHWHEEL
- || msg.message == WM_TOUCH
+ if (haveMessage) {
+ if ((flags & QEventLoop::ExcludeUserInputEvents)
+ && ((msg.message >= WM_KEYFIRST
+ && msg.message <= WM_KEYLAST)
+ || (msg.message >= WM_MOUSEFIRST
+ && msg.message <= WM_MOUSELAST)
+ || msg.message == WM_MOUSEWHEEL
+ || msg.message == WM_MOUSEHWHEEL
+ || msg.message == WM_TOUCH
#ifndef QT_NO_GESTURES
- || msg.message == WM_GESTURE
- || msg.message == WM_GESTURENOTIFY
+ || msg.message == WM_GESTURE
+ || msg.message == WM_GESTURENOTIFY
#endif
- || msg.message == WM_CLOSE)) {
- // queue user input events for later processing
- haveMessage = false;
- d->queuedUserInputEvents.append(msg);
- }
- if (haveMessage && (flags & QEventLoop::ExcludeSocketNotifiers)
- && (msg.message == WM_QT_SOCKETNOTIFIER && msg.hwnd == d->internalHwnd)) {
- // queue socket events for later processing
- haveMessage = false;
- d->queuedSocketEvents.append(msg);
+ || msg.message == WM_CLOSE)) {
+ // queue user input events for later processing
+ d->queuedUserInputEvents.append(msg);
+ continue;
+ }
+ if ((flags & QEventLoop::ExcludeSocketNotifiers)
+ && (msg.message == WM_QT_SOCKETNOTIFIER && msg.hwnd == d->internalHwnd)) {
+ // queue socket events for later processing
+ d->queuedSocketEvents.append(msg);
+ continue;
+ }
+ } else if (!(flags & QEventLoop::ExcludeSocketNotifiers)) {
+ // register all socket notifiers
+ for (QSFDict::iterator it = d->active_fd.begin(), end = d->active_fd.end();
+ it != end; ++it) {
+ QSockFd &sd = it.value();
+ if (!sd.selected) {
+ d->doWsaAsyncSelect(it.key(), sd.event);
+ sd.selected = true;
+ }
+ }
}
}
if (!haveMessage) {
@@ -895,8 +895,25 @@ void QEventDispatcherWin32::registerSocketNotifier(QSocketNotifier *notifier)
sn->fd = sockfd;
dict->insert(sn->fd, sn);
- if (d->internalHwnd)
- d->doWsaAsyncSelect(sockfd);
+ long event = 0;
+ if (d->sn_read.contains(sockfd))
+ event |= FD_READ | FD_CLOSE | FD_ACCEPT;
+ if (d->sn_write.contains(sockfd))
+ event |= FD_WRITE | FD_CONNECT;
+ if (d->sn_except.contains(sockfd))
+ event |= FD_OOB;
+
+ QSFDict::iterator it = d->active_fd.find(sockfd);
+ if (it != d->active_fd.end()) {
+ QSockFd &sd = it.value();
+ if (sd.selected) {
+ d->doWsaAsyncSelect(sockfd, 0);
+ sd.selected = false;
+ }
+ sd.event |= event;
+ } else {
+ d->active_fd.insert(sockfd, QSockFd(event));
+ }
}
void QEventDispatcherWin32::unregisterSocketNotifier(QSocketNotifier *notifier)
@@ -915,6 +932,19 @@ void QEventDispatcherWin32::unregisterSocketNotifier(QSocketNotifier *notifier)
#endif
Q_D(QEventDispatcherWin32);
+ QSFDict::iterator it = d->active_fd.find(sockfd);
+ if (it != d->active_fd.end()) {
+ QSockFd &sd = it.value();
+ if (sd.selected)
+ d->doWsaAsyncSelect(sockfd, 0);
+ const long event[3] = { FD_READ | FD_CLOSE | FD_ACCEPT, FD_WRITE | FD_CONNECT, FD_OOB };
+ sd.event ^= event[type];
+ if (sd.event == 0)
+ d->active_fd.erase(it);
+ else
+ sd.selected = false;
+ }
+
QSNDict *sn_vec[3] = { &d->sn_read, &d->sn_write, &d->sn_except };
QSNDict *dict = sn_vec[type];
QSockNot *sn = dict->value(sockfd);
@@ -923,9 +953,6 @@ void QEventDispatcherWin32::unregisterSocketNotifier(QSocketNotifier *notifier)
dict->remove(sockfd);
delete sn;
-
- if (d->internalHwnd)
- d->doWsaAsyncSelect(sockfd);
}
void QEventDispatcherWin32::registerTimer(int timerId, int interval, Qt::TimerType timerType, QObject *object)
@@ -1163,6 +1190,7 @@ void QEventDispatcherWin32::closingDown()
unregisterSocketNotifier((*(d->sn_write.begin()))->obj);
while (!d->sn_except.isEmpty())
unregisterSocketNotifier((*(d->sn_except.begin()))->obj);
+ Q_ASSERT(d->active_fd.isEmpty());
// clean up any timers
for (int i = 0; i < d->timerVec.count(); ++i)
diff --git a/src/corelib/kernel/qeventdispatcher_win_p.h b/src/corelib/kernel/qeventdispatcher_win_p.h
index e59e29f1ff..8578110ee4 100644
--- a/src/corelib/kernel/qeventdispatcher_win_p.h
+++ b/src/corelib/kernel/qeventdispatcher_win_p.h
@@ -115,6 +115,14 @@ struct QSockNot {
};
typedef QHash<int, QSockNot *> QSNDict;
+struct QSockFd {
+ long event;
+ bool selected;
+
+ explicit inline QSockFd(long ev = 0) : event(ev), selected(false) { }
+};
+typedef QHash<int, QSockFd> QSFDict;
+
struct WinTimerInfo { // internal timer info
QObject *dispatcher;
int timerId;
@@ -169,7 +177,8 @@ public:
QSNDict sn_read;
QSNDict sn_write;
QSNDict sn_except;
- void doWsaAsyncSelect(int socket);
+ QSFDict active_fd;
+ void doWsaAsyncSelect(int socket, long event);
QList<QWinEventNotifier *> winEventNotifierList;
void activateEventNotifier(QWinEventNotifier * wen);
diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp
index 7ae9fef622..820af298c0 100644
--- a/src/corelib/kernel/qmetaobject.cpp
+++ b/src/corelib/kernel/qmetaobject.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
-** Copyright (C) 2014 Olivier Goffart <ogoffart@woboq.com>
+** Copyright (C) 2015 Olivier Goffart <ogoffart@woboq.com>
** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtCore module of the Qt Toolkit.
@@ -1547,12 +1547,13 @@ bool QMetaObject::invokeMethod(QObject *obj,
/*!
\fn QMetaObject::Connection &QMetaObject::Connection::operator=(Connection &&other)
- Move-assigns \a other to this object.
+ Move-assigns \a other to this object, and returns a reference.
*/
/*!
\fn QMetaObject::Connection::Connection(Connection &&o)
- Move-constructs a Connection instance, making it point to the same object that \a o was pointing to.
+ Move-constructs a Connection instance, making it point to the same object
+ that \a o was pointing to.
*/
/*!
@@ -3027,6 +3028,11 @@ QVariant QMetaProperty::read(const QObject *object) const
Writes \a value as the property's value to the given \a object. Returns
true if the write succeeded; otherwise returns \c false.
+ If \a value is not of the same type type as the property, a conversion
+ is attempted. An empty QVariant() is equivalent to a call to reset()
+ if this property is resetable, or setting a default-constructed object
+ otherwise.
+
\sa read(), reset(), isWritable()
*/
bool QMetaProperty::write(QObject *object, const QVariant &value) const
@@ -3067,8 +3073,15 @@ bool QMetaProperty::write(QObject *object, const QVariant &value) const
if (t == QMetaType::UnknownType)
return false;
}
- if (t != QMetaType::QVariant && t != (uint)value.userType() && (t < QMetaType::User && !v.convert((QVariant::Type)t)))
- return false;
+ if (t != QMetaType::QVariant && int(t) != value.userType()) {
+ if (!value.isValid()) {
+ if (isResettable())
+ return reset(object);
+ v = QVariant(t, 0);
+ } else if (!v.convert(t)) {
+ return false;
+ }
+ }
}
// the status variable is changed by qt_metacall to indicate what it did
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index d324b6f150..c9884cd76c 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -1485,7 +1485,7 @@ void QObject::moveToThread(QThread *targetThread)
} else if (d->threadData != currentData) {
qWarning("QObject::moveToThread: Current thread (%p) is not the object's thread (%p).\n"
"Cannot move to target thread (%p)\n",
- currentData->thread, d->threadData->thread, targetData ? targetData->thread : Q_NULLPTR);
+ currentData->thread.load(), d->threadData->thread.load(), targetData ? targetData->thread.load() : Q_NULLPTR);
#ifdef Q_OS_MAC
qWarning("You might be loading two sets of Qt binaries into the same process. "
@@ -3831,7 +3831,7 @@ int QObjectPrivate::signalIndex(const char *signalName,
\b{Note:} Dynamic properties starting with "_q_" are reserved for internal
purposes.
- \sa property(), metaObject(), dynamicPropertyNames()
+ \sa property(), metaObject(), dynamicPropertyNames(), QMetaProperty::write()
*/
bool QObject::setProperty(const char *name, const QVariant &value)
{
diff --git a/src/corelib/kernel/qsharedmemory_systemv.cpp b/src/corelib/kernel/qsharedmemory_systemv.cpp
index 29fee12c0b..0d2eea49e9 100644
--- a/src/corelib/kernel/qsharedmemory_systemv.cpp
+++ b/src/corelib/kernel/qsharedmemory_systemv.cpp
@@ -82,7 +82,7 @@ key_t QSharedMemoryPrivate::handle()
return 0;
}
- unix_key = ftok(QFile::encodeName(nativeKey).constData(), 'Q');
+ unix_key = qt_safe_ftok(QFile::encodeName(nativeKey), 'Q');
if (-1 == unix_key) {
errorString = QSharedMemory::tr("%1: ftok failed").arg(QLatin1String("QSharedMemory::handle:"));
error = QSharedMemory::KeyError;
diff --git a/src/corelib/kernel/qsocketnotifier.cpp b/src/corelib/kernel/qsocketnotifier.cpp
index d789af2fd9..3a5eff0c19 100644
--- a/src/corelib/kernel/qsocketnotifier.cpp
+++ b/src/corelib/kernel/qsocketnotifier.cpp
@@ -98,42 +98,6 @@ public:
QTcpSocket and QUdpSocket provide notification through signals, so
there is normally no need to use a QSocketNotifier on them.
- \section1 Notes for Windows Users
-
- The socket passed to QSocketNotifier will become non-blocking, even if
- it was created as a blocking socket.
- The activated() signal is sometimes triggered by high general activity
- on the host, even if there is nothing to read. A subsequent read from
- the socket can then fail, the error indicating that there is no data
- available (e.g., \c{WSAEWOULDBLOCK}). This is an operating system
- limitation, and not a bug in QSocketNotifier.
-
- To ensure that the socket notifier handles read notifications correctly,
- follow these steps when you receive a notification:
-
- \list 1
- \li Disable the notifier.
- \li Read data from the socket.
- \li Re-enable the notifier if you are interested in more data (such as after
- having written a new command to a remote server).
- \endlist
-
- To ensure that the socket notifier handles write notifications correctly,
- follow these steps when you receive a notification:
-
- \list 1
- \li Disable the notifier.
- \li Write as much data as you can (before \c EWOULDBLOCK is returned).
- \li Re-enable notifier if you have more data to write.
- \endlist
-
- \b{Further information:}
- On Windows, Qt always disables the notifier after getting a notification,
- and only re-enables it if more data is expected. For example, if data is
- read from the socket and it can be used to read more, or if reading or
- writing is not possible because the socket would block, in which case
- it is necessary to wait before attempting to read or write again.
-
\sa QFile, QProcess, QTcpSocket, QUdpSocket
*/
diff --git a/src/corelib/kernel/qsystemsemaphore_systemv.cpp b/src/corelib/kernel/qsystemsemaphore_systemv.cpp
index 32a4bdef51..490de5f9ee 100644
--- a/src/corelib/kernel/qsystemsemaphore_systemv.cpp
+++ b/src/corelib/kernel/qsystemsemaphore_systemv.cpp
@@ -85,7 +85,7 @@ key_t QSystemSemaphorePrivate::handle(QSystemSemaphore::AccessMode mode)
createdFile = (1 == built);
// Get the unix key for the created file
- unix_key = ftok(QFile::encodeName(fileName).constData(), 'Q');
+ unix_key = qt_safe_ftok(QFile::encodeName(fileName), 'Q');
if (-1 == unix_key) {
errorString = QCoreApplication::tr("%1: ftok failed", "QSystemSemaphore").arg(QLatin1String("QSystemSemaphore::handle:"));
error = QSystemSemaphore::KeyError;
diff --git a/src/corelib/kernel/qtimer.cpp b/src/corelib/kernel/qtimer.cpp
index b9109a96aa..af9a1be6ab 100644
--- a/src/corelib/kernel/qtimer.cpp
+++ b/src/corelib/kernel/qtimer.cpp
@@ -278,15 +278,10 @@ QSingleShotTimer::QSingleShotTimer(int msec, Qt::TimerType timerType, const QObj
{
timerId = startTimer(msec, timerType);
if (r && thread() != r->thread()) {
- // We need the invocation to happen in the receiver object's thread.
- // So, move QSingleShotTimer to the correct thread. Before that occurs, we
- // shall remove the parent from the object.
+ // Avoid leaking the QSingleShotTimer instance in case the application exits before the timer fires
+ connect(QCoreApplication::instance(), &QCoreApplication::aboutToQuit, this, &QObject::deleteLater);
setParent(0);
moveToThread(r->thread());
-
- // Given we're also parentless now, we should take defence against leaks
- // in case the application quits before we expire.
- connect(QCoreApplication::instance(), &QCoreApplication::aboutToQuit, this, &QObject::deleteLater);
}
}
diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp
index 35f178e6a9..fdcbdb1c45 100644
--- a/src/corelib/kernel/qvariant.cpp
+++ b/src/corelib/kernel/qvariant.cpp
@@ -413,7 +413,7 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok)
QString *str = static_cast<QString *>(result);
switch (d->type) {
case QVariant::Char:
- *str = QString(*v_cast<QChar>(d));
+ *str = *v_cast<QChar>(d);
break;
case QMetaType::Char:
case QMetaType::SChar:
diff --git a/src/corelib/mimetypes/qmimedatabase.cpp b/src/corelib/mimetypes/qmimedatabase.cpp
index 133933f9af..c1e17b9fc4 100644
--- a/src/corelib/mimetypes/qmimedatabase.cpp
+++ b/src/corelib/mimetypes/qmimedatabase.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author David Faure <david.faure@kdab.com>
** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtCore module of the Qt Toolkit.
diff --git a/src/corelib/mimetypes/qmimedatabase.h b/src/corelib/mimetypes/qmimedatabase.h
index 912d9b8443..fd19636e27 100644
--- a/src/corelib/mimetypes/qmimedatabase.h
+++ b/src/corelib/mimetypes/qmimedatabase.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author David Faure <david.faure@kdab.com>
** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtCore module of the Qt Toolkit.
diff --git a/src/corelib/mimetypes/qmimedatabase_p.h b/src/corelib/mimetypes/qmimedatabase_p.h
index 1308907b9b..1ac7264a9e 100644
--- a/src/corelib/mimetypes/qmimedatabase_p.h
+++ b/src/corelib/mimetypes/qmimedatabase_p.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author David Faure <david.faure@kdab.com>
** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtCore module of the Qt Toolkit.
diff --git a/src/corelib/mimetypes/qmimemagicrule.cpp b/src/corelib/mimetypes/qmimemagicrule.cpp
index c8508ac0d2..6a3a429179 100644
--- a/src/corelib/mimetypes/qmimemagicrule.cpp
+++ b/src/corelib/mimetypes/qmimemagicrule.cpp
@@ -38,6 +38,7 @@
#ifndef QT_NO_MIMETYPE
+#include "qmimetypeparser_p.h"
#include <QtCore/QList>
#include <QtCore/QDebug>
#include <qendian.h>
@@ -231,26 +232,53 @@ static inline QByteArray makePattern(const QByteArray &value)
return pattern;
}
-QMimeMagicRule::QMimeMagicRule(QMimeMagicRule::Type theType,
+// Evaluate a magic match rule like
+// <match value="must be converted with BinHex" type="string" offset="11"/>
+// <match value="0x9501" type="big16" offset="0:64"/>
+
+QMimeMagicRule::QMimeMagicRule(const QString &typeStr,
const QByteArray &theValue,
- int theStartPos,
- int theEndPos,
- const QByteArray &theMask) :
+ const QString &offsets,
+ const QByteArray &theMask,
+ QString *errorString) :
d(new QMimeMagicRulePrivate)
{
- Q_ASSERT(!theValue.isEmpty());
-
- d->type = theType;
d->value = theValue;
- d->startPos = theStartPos;
- d->endPos = theEndPos;
d->mask = theMask;
d->matchFunction = 0;
+ d->type = QMimeMagicRule::type(typeStr.toLatin1());
+ if (d->type == Invalid) {
+ *errorString = QStringLiteral("Type %s is not supported").arg(typeStr);
+ }
+
+ // Parse for offset as "1" or "1:10"
+ const int colonIndex = offsets.indexOf(QLatin1Char(':'));
+ const QString startPosStr = colonIndex == -1 ? offsets : offsets.mid(0, colonIndex);
+ const QString endPosStr = colonIndex == -1 ? offsets : offsets.mid(colonIndex + 1);
+ if (!QMimeTypeParserBase::parseNumber(startPosStr, &d->startPos, errorString) ||
+ !QMimeTypeParserBase::parseNumber(endPosStr, &d->endPos, errorString)) {
+ d->type = Invalid;
+ return;
+ }
+
+ if (d->value.isEmpty()) {
+ d->type = Invalid;
+ if (errorString)
+ *errorString = QLatin1String("Invalid empty magic rule value");
+ return;
+ }
+
if (d->type >= Host16 && d->type <= Byte) {
bool ok;
d->number = d->value.toUInt(&ok, 0); // autodetect
- Q_ASSERT(ok);
+ if (!ok) {
+ d->type = Invalid;
+ if (errorString)
+ *errorString = QString::fromLatin1("Invalid magic rule value \"%1\"").arg(
+ QString::fromLatin1(d->value));
+ return;
+ }
d->numberMask = !d->mask.isEmpty() ? d->mask.toUInt(&ok, 0) : 0; // autodetect
}
@@ -259,9 +287,23 @@ QMimeMagicRule::QMimeMagicRule(QMimeMagicRule::Type theType,
d->pattern = makePattern(d->value);
d->pattern.squeeze();
if (!d->mask.isEmpty()) {
- Q_ASSERT(d->mask.size() >= 4 && d->mask.startsWith("0x"));
- d->mask = QByteArray::fromHex(QByteArray::fromRawData(d->mask.constData() + 2, d->mask.size() - 2));
- Q_ASSERT(d->mask.size() == d->pattern.size());
+ if (d->mask.size() < 4 || !d->mask.startsWith("0x")) {
+ d->type = Invalid;
+ if (errorString)
+ *errorString = QString::fromLatin1("Invalid magic rule mask \"%1\"").arg(
+ QString::fromLatin1(d->mask));
+ return;
+ }
+ const QByteArray &tempMask = QByteArray::fromHex(QByteArray::fromRawData(
+ d->mask.constData() + 2, d->mask.size() - 2));
+ if (tempMask.size() != d->pattern.size()) {
+ d->type = Invalid;
+ if (errorString)
+ *errorString = QString::fromLatin1("Invalid magic rule mask size \"%1\"").arg(
+ QString::fromLatin1(d->mask));
+ return;
+ }
+ d->mask = tempMask;
} else {
d->mask.fill(char(-1), d->pattern.size());
}
diff --git a/src/corelib/mimetypes/qmimemagicrule_p.h b/src/corelib/mimetypes/qmimemagicrule_p.h
index 03ac1d1de9..6b64bfcc10 100644
--- a/src/corelib/mimetypes/qmimemagicrule_p.h
+++ b/src/corelib/mimetypes/qmimemagicrule_p.h
@@ -61,7 +61,8 @@ class QMimeMagicRule
public:
enum Type { Invalid = 0, String, Host16, Host32, Big16, Big32, Little16, Little32, Byte };
- QMimeMagicRule(Type type, const QByteArray &value, int startPos, int endPos, const QByteArray &mask = QByteArray());
+ QMimeMagicRule(const QString &typeStr, const QByteArray &value, const QString &offsets,
+ const QByteArray &mask, QString *errorString);
QMimeMagicRule(const QMimeMagicRule &other);
~QMimeMagicRule();
diff --git a/src/corelib/mimetypes/qmimeprovider.cpp b/src/corelib/mimetypes/qmimeprovider.cpp
index fa40b743d3..a8a1331053 100644
--- a/src/corelib/mimetypes/qmimeprovider.cpp
+++ b/src/corelib/mimetypes/qmimeprovider.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author David Faure <david.faure@kdab.com>
** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtCore module of the Qt Toolkit.
diff --git a/src/corelib/mimetypes/qmimeprovider_p.h b/src/corelib/mimetypes/qmimeprovider_p.h
index eaf95942f7..c0517d69a4 100644
--- a/src/corelib/mimetypes/qmimeprovider_p.h
+++ b/src/corelib/mimetypes/qmimeprovider_p.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author David Faure <david.faure@kdab.com>
** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtCore module of the Qt Toolkit.
diff --git a/src/corelib/mimetypes/qmimetype.cpp b/src/corelib/mimetypes/qmimetype.cpp
index 3206ff66e3..e3b01bbb89 100644
--- a/src/corelib/mimetypes/qmimetype.cpp
+++ b/src/corelib/mimetypes/qmimetype.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author David Faure <david.faure@kdab.com>
** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtCore module of the Qt Toolkit.
diff --git a/src/corelib/mimetypes/qmimetype.h b/src/corelib/mimetypes/qmimetype.h
index 3c153da21d..6a00541ebc 100644
--- a/src/corelib/mimetypes/qmimetype.h
+++ b/src/corelib/mimetypes/qmimetype.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author David Faure <david.faure@kdab.com>
** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtCore module of the Qt Toolkit.
@@ -44,7 +45,6 @@
QT_BEGIN_NAMESPACE
class QMimeTypePrivate;
-class QFileinfo;
class QStringList;
class QMimeType;
diff --git a/src/corelib/mimetypes/qmimetypeparser.cpp b/src/corelib/mimetypes/qmimetypeparser.cpp
index 9610162c4f..8a8b97655a 100644
--- a/src/corelib/mimetypes/qmimetypeparser.cpp
+++ b/src/corelib/mimetypes/qmimetypeparser.cpp
@@ -153,8 +153,8 @@ QMimeTypeParserBase::ParseState QMimeTypeParserBase::nextState(ParseState curren
return ParseError;
}
-// Parse int number from an (attribute) string)
-static bool parseNumber(const QString &n, int *target, QString *errorMessage)
+// Parse int number from an (attribute) string
+bool QMimeTypeParserBase::parseNumber(const QString &n, int *target, QString *errorMessage)
{
bool ok;
*target = n.toInt(&ok);
@@ -165,37 +165,14 @@ static bool parseNumber(const QString &n, int *target, QString *errorMessage)
return true;
}
-// Evaluate a magic match rule like
-// <match value="must be converted with BinHex" type="string" offset="11"/>
-// <match value="0x9501" type="big16" offset="0:64"/>
#ifndef QT_NO_XMLSTREAMREADER
-static bool createMagicMatchRule(const QXmlStreamAttributes &atts,
- QString *errorMessage, QMimeMagicRule *&rule)
+static QMimeMagicRule *createMagicMatchRule(const QXmlStreamAttributes &atts, QString *errorMessage)
{
const QString type = atts.value(QLatin1String(matchTypeAttributeC)).toString();
- QMimeMagicRule::Type magicType = QMimeMagicRule::type(type.toLatin1());
- if (magicType == QMimeMagicRule::Invalid) {
- qWarning("%s: match type %s is not supported.", Q_FUNC_INFO, type.toUtf8().constData());
- return true;
- }
const QString value = atts.value(QLatin1String(matchValueAttributeC)).toString();
- if (value.isEmpty()) {
- *errorMessage = QString::fromLatin1("Empty match value detected.");
- return false;
- }
- // Parse for offset as "1" or "1:10"
- int startPos, endPos;
- const QString offsetS = atts.value(QLatin1String(matchOffsetAttributeC)).toString();
- const int colonIndex = offsetS.indexOf(QLatin1Char(':'));
- const QString startPosS = colonIndex == -1 ? offsetS : offsetS.mid(0, colonIndex);
- const QString endPosS = colonIndex == -1 ? offsetS : offsetS.mid(colonIndex + 1);
- if (!parseNumber(startPosS, &startPos, errorMessage) || !parseNumber(endPosS, &endPos, errorMessage))
- return false;
+ const QString offsets = atts.value(QLatin1String(matchOffsetAttributeC)).toString();
const QString mask = atts.value(QLatin1String(matchMaskAttributeC)).toString();
-
- rule = new QMimeMagicRule(magicType, value.toUtf8(), startPos, endPos, mask.toLatin1());
-
- return true;
+ return new QMimeMagicRule(type, value.toUtf8(), offsets, mask.toLatin1(), errorMessage);
}
#endif
@@ -283,9 +260,10 @@ bool QMimeTypeParserBase::parse(QIODevice *dev, const QString &fileName, QString
}
break;
case ParseMagicMatchRule: {
- QMimeMagicRule *rule = 0;
- if (!createMagicMatchRule(atts, errorMessage, rule))
- return false;
+ QString magicErrorMessage;
+ QMimeMagicRule *rule = createMagicMatchRule(atts, &magicErrorMessage);
+ if (!rule->isValid())
+ qWarning("QMimeDatabase: Error parsing %s\n%s", qPrintable(fileName), qPrintable(magicErrorMessage));
QList<QMimeMagicRule> *ruleList;
if (currentRules.isEmpty())
ruleList = &rules;
diff --git a/src/corelib/mimetypes/qmimetypeparser_p.h b/src/corelib/mimetypes/qmimetypeparser_p.h
index 2be4380cee..3a2e6b8a14 100644
--- a/src/corelib/mimetypes/qmimetypeparser_p.h
+++ b/src/corelib/mimetypes/qmimetypeparser_p.h
@@ -66,6 +66,8 @@ public:
bool parse(QIODevice *dev, const QString &fileName, QString *errorMessage);
+ static bool parseNumber(const QString &n, int *target, QString *errorMessage);
+
protected:
virtual bool process(const QMimeType &t, QString *errorMessage) = 0;
virtual bool process(const QMimeGlobPattern &t, QString *errorMessage) = 0;
diff --git a/src/corelib/plugin/qelfparser_p.cpp b/src/corelib/plugin/qelfparser_p.cpp
index d93be439e0..3798231383 100644
--- a/src/corelib/plugin/qelfparser_p.cpp
+++ b/src/corelib/plugin/qelfparser_p.cpp
@@ -148,7 +148,7 @@ int QElfParser::parse(const char *dataStart, ulong fdlen, const QString &library
#endif
ElfSectionHeader strtab;
- qulonglong soff = e_shoff + e_shentsize * (e_shtrndx);
+ qulonglong soff = e_shoff + qelfword_t(e_shentsize) * qelfword_t(e_shtrndx);
if ((soff + e_shentsize) > fdlen || soff % 4 || soff == 0) {
if (lib)
diff --git a/src/corelib/plugin/qplugin.qdoc b/src/corelib/plugin/qplugin.qdoc
index 94f5bc8a30..00ecb30430 100644
--- a/src/corelib/plugin/qplugin.qdoc
+++ b/src/corelib/plugin/qplugin.qdoc
@@ -28,7 +28,7 @@
/*!
\headerfile <QtPlugin>
\title Defining Plugins
- \target qtplugin-defining-plugins
+ \keyword qtplugin-defining-plugins
\ingroup plugins
\brief The <QtPlugin> header file defines macros for defining plugins.
diff --git a/src/corelib/plugin/qpluginloader.cpp b/src/corelib/plugin/qpluginloader.cpp
index b95f7539f6..8264a27842 100644
--- a/src/corelib/plugin/qpluginloader.cpp
+++ b/src/corelib/plugin/qpluginloader.cpp
@@ -286,9 +286,9 @@ static QString locatePlugin(const QString& fileName)
suffixes.prepend(QString());
// Split up "subdir/filename"
- const int slash = fileName.lastIndexOf('/');
- const QString baseName = fileName.mid(slash + 1);
- const QString basePath = isAbsolute ? QString() : fileName.left(slash + 1); // keep the '/'
+ const int slash = fileName.lastIndexOf(QLatin1Char('/'));
+ const QStringRef baseName = fileName.midRef(slash + 1);
+ const QStringRef basePath = isAbsolute ? QStringRef() : fileName.leftRef(slash + 1); // keep the '/'
const bool debug = qt_debug_component();
diff --git a/src/corelib/statemachine/qhistorystate.cpp b/src/corelib/statemachine/qhistorystate.cpp
index a0ebb9d239..8887ce27e5 100644
--- a/src/corelib/statemachine/qhistorystate.cpp
+++ b/src/corelib/statemachine/qhistorystate.cpp
@@ -166,6 +166,8 @@ QHistoryState::~QHistoryState()
Returns this history state's default transition. The default transition is
taken when the history state has never been entered before. The target states
of the default transition therefore make up the default state.
+
+ \since 5.6
*/
QAbstractTransition *QHistoryState::defaultTransition() const
{
@@ -178,6 +180,8 @@ QAbstractTransition *QHistoryState::defaultTransition() const
This will set the source state of the \a transition to the history state.
Note that the eventTest method of the \a transition will never be called.
+
+ \since 5.6
*/
void QHistoryState::setDefaultTransition(QAbstractTransition *transition)
{
@@ -290,6 +294,15 @@ bool QHistoryState::event(QEvent *e)
\sa QHistoryState::historyType
*/
+/*!
+ \fn QHistoryState::defaultTransitionChanged()
+ \since 5.6
+
+ This signal is emitted when the defaultTransition property is changed.
+
+ \sa QHistoryState::defaultTransition
+*/
+
QT_END_NAMESPACE
#endif //QT_NO_STATEMACHINE
diff --git a/src/corelib/statemachine/qstatemachine.cpp b/src/corelib/statemachine/qstatemachine.cpp
index c5e251b37b..3ffe191093 100644
--- a/src/corelib/statemachine/qstatemachine.cpp
+++ b/src/corelib/statemachine/qstatemachine.cpp
@@ -1288,7 +1288,7 @@ QVariant QStateMachinePrivate::savedValueForRestorable(const QList<QAbstractStat
QObject *object, const QByteArray &propertyName) const
{
#ifdef QSTATEMACHINE_RESTORE_PROPERTIES_DEBUG
- qDebug() << q_func() << ": savedValueForRestorable(" << exitedStates_sorted << object << propertyName << ")";
+ qDebug() << q_func() << ": savedValueForRestorable(" << exitedStates_sorted << object << propertyName << ')';
#endif
for (int i = exitedStates_sorted.size() - 1; i >= 0; --i) {
QAbstractState *s = exitedStates_sorted.at(i);
@@ -1311,7 +1311,7 @@ void QStateMachinePrivate::registerRestorable(QAbstractState *state, QObject *ob
const QVariant &value)
{
#ifdef QSTATEMACHINE_RESTORE_PROPERTIES_DEBUG
- qDebug() << q_func() << ": registerRestorable(" << state << object << propertyName << value << ")";
+ qDebug() << q_func() << ": registerRestorable(" << state << object << propertyName << value << ')';
#endif
RestorableId id(object, propertyName);
QHash<RestorableId, QVariant> &restorables = registeredRestorablesForState[state];
@@ -1327,7 +1327,7 @@ void QStateMachinePrivate::unregisterRestorables(const QList<QAbstractState *> &
const QByteArray &propertyName)
{
#ifdef QSTATEMACHINE_RESTORE_PROPERTIES_DEBUG
- qDebug() << q_func() << ": unregisterRestorables(" << states << object << propertyName << ")";
+ qDebug() << q_func() << ": unregisterRestorables(" << states << object << propertyName << ')';
#endif
RestorableId id(object, propertyName);
for (int i = 0; i < states.size(); ++i) {
diff --git a/src/corelib/statemachine/qstatemachine_p.h b/src/corelib/statemachine/qstatemachine_p.h
index fe7a06d16b..45c6dfcb33 100644
--- a/src/corelib/statemachine/qstatemachine_p.h
+++ b/src/corelib/statemachine/qstatemachine_p.h
@@ -134,16 +134,16 @@ public:
virtual void beginMacrostep();
virtual void endMacrostep(bool didChange);
virtual void exitInterpreter();
- void exitStates(QEvent *event, const QList<QAbstractState *> &statesToExit_sorted,
- const QHash<QAbstractState*, QVector<QPropertyAssignment> > &assignmentsForEnteredStates);
+ virtual void exitStates(QEvent *event, const QList<QAbstractState *> &statesToExit_sorted,
+ const QHash<QAbstractState*, QVector<QPropertyAssignment> > &assignmentsForEnteredStates);
QList<QAbstractState*> computeExitSet(const QList<QAbstractTransition*> &enabledTransitions, CalculationCache *cache);
QSet<QAbstractState*> computeExitSet_Unordered(const QList<QAbstractTransition*> &enabledTransitions, CalculationCache *cache);
QSet<QAbstractState*> computeExitSet_Unordered(QAbstractTransition *t, CalculationCache *cache);
void executeTransitionContent(QEvent *event, const QList<QAbstractTransition*> &transitionList);
- void enterStates(QEvent *event, const QList<QAbstractState*> &exitedStates_sorted,
- const QList<QAbstractState*> &statesToEnter_sorted,
- const QSet<QAbstractState*> &statesForDefaultEntry,
- QHash<QAbstractState *, QVector<QPropertyAssignment> > &propertyAssignmentsForState
+ virtual void enterStates(QEvent *event, const QList<QAbstractState*> &exitedStates_sorted,
+ const QList<QAbstractState*> &statesToEnter_sorted,
+ const QSet<QAbstractState*> &statesForDefaultEntry,
+ QHash<QAbstractState *, QVector<QPropertyAssignment> > &propertyAssignmentsForState
#ifndef QT_NO_ANIMATION
, const QList<QAbstractAnimation*> &selectedAnimations
#endif
diff --git a/src/corelib/thread/qfuturewatcher.cpp b/src/corelib/thread/qfuturewatcher.cpp
index 3056216f6e..43eff83116 100644
--- a/src/corelib/thread/qfuturewatcher.cpp
+++ b/src/corelib/thread/qfuturewatcher.cpp
@@ -248,7 +248,7 @@ bool QFutureWatcherBase::isStarted() const
/*! \fn bool QFutureWatcher::isFinished() const
Returns \c true if the asynchronous computation represented by the future()
- has finished; otherwise returns \c false.
+ has finished, or if no future has been set; otherwise returns \c false.
*/
bool QFutureWatcherBase::isFinished() const
{
@@ -304,15 +304,6 @@ void QFutureWatcherBase::waitForFinished()
futureInterface().waitForFinished();
}
-/*! \fn void QFutureWatcher::setPendingResultsLimit(int limit)
-
- The setPendingResultsLimit() provides throttling control. When the number
- of pending resultReadyAt() or resultsReadyAt() signals exceeds the
- \a limit, the computation represented by the future will be throttled
- automatically. The computation will resume once the number of pending
- signals drops below the \a limit.
-*/
-
bool QFutureWatcherBase::event(QEvent *event)
{
Q_D(QFutureWatcherBase);
@@ -342,6 +333,14 @@ bool QFutureWatcherBase::event(QEvent *event)
return QObject::event(event);
}
+/*! \fn void QFutureWatcher::setPendingResultsLimit(int limit)
+
+ The setPendingResultsLimit() provides throttling control. When the number
+ of pending resultReadyAt() or resultsReadyAt() signals exceeds the
+ \a limit, the computation represented by the future will be throttled
+ automatically. The computation will resume once the number of pending
+ signals drops below the \a limit.
+*/
void QFutureWatcherBase::setPendingResultsLimit(int limit)
{
Q_D(QFutureWatcherBase);
@@ -379,7 +378,8 @@ void QFutureWatcherBase::disconnectNotify(const QMetaMethod &signal)
*/
QFutureWatcherBasePrivate::QFutureWatcherBasePrivate()
: maximumPendingResultsReady(QThread::idealThreadCount() * 2),
- resultAtConnected(0)
+ resultAtConnected(0),
+ finished(true) /* the initial m_future is a canceledResult(), with Finished set */
{ }
/*!
@@ -400,7 +400,7 @@ void QFutureWatcherBase::disconnectOutputInterface(bool pendingAssignment)
d->pendingResultsReady.store(0);
qDeleteAll(d->pendingCallOutEvents);
d->pendingCallOutEvents.clear();
- d->finished = false;
+ d->finished = false; /* May soon be amended, during connectOutputInterface() */
}
futureInterface().d->disconnectOutputInterface(d_func());
diff --git a/src/corelib/thread/qmutex.cpp b/src/corelib/thread/qmutex.cpp
index 3269ee3ae8..742a572bef 100644
--- a/src/corelib/thread/qmutex.cpp
+++ b/src/corelib/thread/qmutex.cpp
@@ -571,19 +571,26 @@ FreeList *freelist()
return &list;
}
#else
+static QBasicAtomicPointer<FreeList> freeListPtr;
+
FreeList *freelist()
{
- static QAtomicPointer<FreeList> list;
- FreeList *local = list.loadAcquire();
+ FreeList *local = freeListPtr.loadAcquire();
if (!local) {
local = new FreeList;
- if (!list.testAndSetRelease(0, local)) {
+ if (!freeListPtr.testAndSetRelease(0, local)) {
delete local;
- local = list.loadAcquire();
+ local = freeListPtr.loadAcquire();
}
}
return local;
}
+
+static void qFreeListDeleter()
+{
+ delete freeListPtr.load();
+}
+Q_DESTRUCTOR_FUNCTION(qFreeListDeleter)
#endif
}
diff --git a/src/corelib/thread/qthread_p.h b/src/corelib/thread/qthread_p.h
index ffefe0b1d1..a0d354acdc 100644
--- a/src/corelib/thread/qthread_p.h
+++ b/src/corelib/thread/qthread_p.h
@@ -276,7 +276,7 @@ public:
QStack<QEventLoop *> eventLoops;
QPostEventList postEventList;
- QThread *thread;
+ QAtomicPointer<QThread> thread;
Qt::HANDLE threadId;
QAtomicPointer<QAbstractEventDispatcher> eventDispatcher;
QVector<void *> tls;
diff --git a/src/corelib/thread/qthread_unix.cpp b/src/corelib/thread/qthread_unix.cpp
index 4b50936958..c340915d35 100644
--- a/src/corelib/thread/qthread_unix.cpp
+++ b/src/corelib/thread/qthread_unix.cpp
@@ -222,7 +222,7 @@ QThreadData *QThreadData::current(bool createIfNecessary)
data->isAdopted = true;
data->threadId = (Qt::HANDLE)pthread_self();
if (!QCoreApplicationPrivate::theMainThread)
- QCoreApplicationPrivate::theMainThread = data->thread;
+ QCoreApplicationPrivate::theMainThread = data->thread.load();
}
return data;
}
diff --git a/src/corelib/thread/qthread_win.cpp b/src/corelib/thread/qthread_win.cpp
index 72f04ff7af..1a4b41fee4 100644
--- a/src/corelib/thread/qthread_win.cpp
+++ b/src/corelib/thread/qthread_win.cpp
@@ -121,7 +121,7 @@ QThreadData *QThreadData::current(bool createIfNecessary)
threadData->threadId = reinterpret_cast<Qt::HANDLE>(quintptr(GetCurrentThreadId()));
if (!QCoreApplicationPrivate::theMainThread) {
- QCoreApplicationPrivate::theMainThread = threadData->thread;
+ QCoreApplicationPrivate::theMainThread = threadData->thread.load();
// TODO: is there a way to reflect the branch's behavior using
// WinRT API?
} else {
diff --git a/src/corelib/thread/qthreadstorage.cpp b/src/corelib/thread/qthreadstorage.cpp
index 05ab01cc54..37892233f3 100644
--- a/src/corelib/thread/qthreadstorage.cpp
+++ b/src/corelib/thread/qthreadstorage.cpp
@@ -121,7 +121,7 @@ void **QThreadStorageData::get() const
DEBUG_MSG("QThreadStorageData: Returning storage %d, data %p, for thread %p",
id,
*v,
- data->thread);
+ data->thread.load());
return *v ? v : 0;
}
@@ -143,7 +143,7 @@ void **QThreadStorageData::set(void *p)
DEBUG_MSG("QThreadStorageData: Deleting previous storage %d, data %p, for thread %p",
id,
value,
- data->thread);
+ data->thread.load());
QMutexLocker locker(&destructorsMutex);
DestructorMap *destr = destructors();
@@ -159,7 +159,7 @@ void **QThreadStorageData::set(void *p)
// store new data
value = p;
- DEBUG_MSG("QThreadStorageData: Set storage %d for thread %p to %p", id, data->thread, p);
+ DEBUG_MSG("QThreadStorageData: Set storage %d for thread %p to %p", id, data->thread.load(), p);
return &value;
}
diff --git a/src/corelib/tools/qalgorithms.qdoc b/src/corelib/tools/qalgorithms.qdoc
index dac353fa70..dac353fa70 100755..100644
--- a/src/corelib/tools/qalgorithms.qdoc
+++ b/src/corelib/tools/qalgorithms.qdoc
diff --git a/src/corelib/tools/qbitarray.h b/src/corelib/tools/qbitarray.h
index 4e5c26b86a..e686d53db4 100644
--- a/src/corelib/tools/qbitarray.h
+++ b/src/corelib/tools/qbitarray.h
@@ -48,7 +48,7 @@ class Q_CORE_EXPORT QBitArray
QByteArray d;
public:
- inline QBitArray() {}
+ inline QBitArray() Q_DECL_NOTHROW {}
explicit QBitArray(int size, bool val = false);
QBitArray(const QBitArray &other) : d(other.d) {}
inline QBitArray &operator=(const QBitArray &other) { d = other.d; return *this; }
diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp
index ac191ef265..c223c9de6c 100644
--- a/src/corelib/tools/qbytearray.cpp
+++ b/src/corelib/tools/qbytearray.cpp
@@ -578,8 +578,8 @@ QByteArray qUncompress(const uchar* data, int nbytes)
qWarning("qUncompress: Input data is corrupted");
return QByteArray();
}
- ulong expectedSize = (data[0] << 24) | (data[1] << 16) |
- (data[2] << 8) | (data[3] );
+ ulong expectedSize = uint((data[0] << 24) | (data[1] << 16) |
+ (data[2] << 8) | (data[3] ));
ulong len = qMax(expectedSize, 1ul);
QScopedPointer<QByteArray::Data, QScopedPointerPodDeleter> d;
diff --git a/src/corelib/tools/qcommandlineparser.cpp b/src/corelib/tools/qcommandlineparser.cpp
index 20e0688f45..15c7a0646f 100644
--- a/src/corelib/tools/qcommandlineparser.cpp
+++ b/src/corelib/tools/qcommandlineparser.cpp
@@ -325,13 +325,13 @@ void QCommandLineParser::setSingleDashWordOptionMode(QCommandLineParser::SingleD
\sa setOptionsAfterPositionalArgumentsMode()
- \since 5.5
+ \since 5.6
*/
/*!
Sets the parsing mode to \a parsingMode.
This must be called before process() or parse().
- \since 5.5
+ \since 5.6
*/
void QCommandLineParser::setOptionsAfterPositionalArgumentsMode(QCommandLineParser::OptionsAfterPositionalArgumentsMode parsingMode)
{
diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp
index 0d7225eea0..4854ceb5ca 100644
--- a/src/corelib/tools/qdatetime.cpp
+++ b/src/corelib/tools/qdatetime.cpp
@@ -3123,6 +3123,7 @@ QTimeZone QDateTime::timeZone() const
case Qt::UTC:
return QTimeZone::utc();
case Qt::OffsetFromUTC:
+ return QTimeZone(d->m_offsetFromUtc);
case Qt::TimeZone:
Q_ASSERT(d->m_timeZone.isValid());
return d->m_timeZone;
diff --git a/src/corelib/tools/qhash.h b/src/corelib/tools/qhash.h
index 8d65a018ae..a18dd74706 100644
--- a/src/corelib/tools/qhash.h
+++ b/src/corelib/tools/qhash.h
@@ -935,7 +935,7 @@ template <class Key, class T>
class QMultiHash : public QHash<Key, T>
{
public:
- QMultiHash() {}
+ QMultiHash() Q_DECL_NOTHROW {}
#ifdef Q_COMPILER_INITIALIZER_LISTS
inline QMultiHash(std::initializer_list<std::pair<Key,T> > list)
{
@@ -948,7 +948,10 @@ public:
// compiler-generated destructor is fine!
QMultiHash(const QHash<Key, T> &other) : QHash<Key, T>(other) {}
- void swap(QMultiHash &other) { QHash<Key, T>::swap(other); } // prevent QMultiHash<->QHash swaps
+#ifdef Q_COMPILER_RVALUE_REFS
+ QMultiHash(QHash<Key, T> &&other) Q_DECL_NOTHROW : QHash<Key, T>(std::move(other)) {}
+#endif
+ void swap(QMultiHash &other) Q_DECL_NOTHROW { QHash<Key, T>::swap(other); } // prevent QMultiHash<->QHash swaps
inline typename QHash<Key, T>::iterator replace(const Key &key, const T &value)
{ return QHash<Key, T>::insert(key, value); }
diff --git a/src/corelib/tools/qlinkedlist.cpp b/src/corelib/tools/qlinkedlist.cpp
index fbd263e88b..5d91bfe924 100644
--- a/src/corelib/tools/qlinkedlist.cpp
+++ b/src/corelib/tools/qlinkedlist.cpp
@@ -388,6 +388,52 @@ const QLinkedListData QLinkedListData::shared_null = {
\sa constBegin(), end()
*/
+/*! \fn QLinkedList::reverse_iterator QLinkedList::rbegin()
+ \since 5.6
+
+ Returns a \l{STL-style iterators}{STL-style} reverse iterator pointing to the first
+ item in the list, in reverse order.
+
+ \sa begin(), crbegin(), rend()
+*/
+
+/*! \fn QLinkedList::const_reverse_iterator QLinkedList::rbegin() const
+ \since 5.6
+ \overload
+*/
+
+/*! \fn QLinkedList::const_reverse_iterator QLinkedList::crbegin() const
+ \since 5.6
+
+ Returns a const \l{STL-style iterators}{STL-style} reverse iterator pointing to the first
+ item in the list, in reverse order.
+
+ \sa begin(), rbegin(), rend()
+*/
+
+/*! \fn QLinkedList::reverse_iterator QLinkedList::rend()
+ \since 5.6
+
+ Returns a \l{STL-style iterators}{STL-style} reverse iterator pointing to one past
+ the last item in the list, in reverse order.
+
+ \sa end(), crend(), rbegin()
+*/
+
+/*! \fn QLinkedList::const_reverse_iterator QLinkedList::rend() const
+ \since 5.6
+ \overload
+*/
+
+/*! \fn QLinkedList::const_reverse_iterator QLinkedList::crend() const
+ \since 5.6
+
+ Returns a const \l{STL-style iterators}{STL-style} reverse iterator pointing to one
+ past the last item in the list, in reverse order.
+
+ \sa end(), rend(), rbegin()
+*/
+
/*! \fn QLinkedList::iterator QLinkedList::insert(iterator before, const T &value)
Inserts \a value in front of the item pointed to by the iterator
@@ -423,6 +469,38 @@ const QLinkedListData QLinkedListData::shared_null = {
Qt-style synonym for QLinkedList::const_iterator.
*/
+/*! \typedef QLinkedList::reverse_iterator
+ \since 5.6
+
+ The QLinkedList::reverse_iterator typedef provides an STL-style non-const
+ reverse iterator for QLinkedList.
+
+ It is simply a typedef for \c{std::reverse_iterator<QLinkedList::iterator>}.
+
+ \warning Iterators on implicitly shared containers do not work
+ exactly like STL-iterators. You should avoid copying a container
+ while iterators are active on that container. For more information,
+ read \l{Implicit sharing iterator problem}.
+
+ \sa QLinkedList::rbegin(), QLinkedList::rend(), QLinkedList::const_reverse_iterator, QLinkedList::iterator
+*/
+
+/*! \typedef QLinkedList::const_reverse_iterator
+ \since 5.6
+
+ The QLinkedList::const_reverse_iterator typedef provides an STL-style const
+ reverse iterator for QLinkedList.
+
+ It is simply a typedef for \c{std::reverse_iterator<QLinkedList::const_iterator>}.
+
+ \warning Iterators on implicitly shared containers do not work
+ exactly like STL-iterators. You should avoid copying a container
+ while iterators are active on that container. For more information,
+ read \l{Implicit sharing iterator problem}.
+
+ \sa QLinkedList::rbegin(), QLinkedList::rend(), QLinkedList::reverse_iterator, QLinkedList::const_iterator
+*/
+
/*!
\typedef QLinkedList::size_type
diff --git a/src/corelib/tools/qlinkedlist.h b/src/corelib/tools/qlinkedlist.h
index f216aa121c..110529d843 100644
--- a/src/corelib/tools/qlinkedlist.h
+++ b/src/corelib/tools/qlinkedlist.h
@@ -74,7 +74,7 @@ class QLinkedList
union { QLinkedListData *d; QLinkedListNode<T> *e; };
public:
- inline QLinkedList() : d(const_cast<QLinkedListData *>(&QLinkedListData::shared_null)) { }
+ inline QLinkedList() Q_DECL_NOTHROW : d(const_cast<QLinkedListData *>(&QLinkedListData::shared_null)) { }
inline QLinkedList(const QLinkedList<T> &l) : d(l.d) { d->ref.ref(); if (!d->sharable) detach(); }
#if defined(Q_COMPILER_INITIALIZER_LISTS)
inline QLinkedList(std::initializer_list<T> list)
@@ -86,11 +86,12 @@ public:
~QLinkedList();
QLinkedList<T> &operator=(const QLinkedList<T> &);
#ifdef Q_COMPILER_RVALUE_REFS
- inline QLinkedList(QLinkedList<T> &&other) : d(other.d) { other.d = const_cast<QLinkedListData *>(&QLinkedListData::shared_null); }
- inline QLinkedList<T> &operator=(QLinkedList<T> &&other)
+ QLinkedList(QLinkedList<T> &&other) Q_DECL_NOTHROW
+ : d(other.d) { other.d = const_cast<QLinkedListData *>(&QLinkedListData::shared_null); }
+ QLinkedList<T> &operator=(QLinkedList<T> &&other) Q_DECL_NOTHROW
{ QLinkedList moved(std::move(other)); swap(moved); return *this; }
#endif
- inline void swap(QLinkedList<T> &other) { qSwap(d, other.d); }
+ inline void swap(QLinkedList<T> &other) Q_DECL_NOTHROW { qSwap(d, other.d); }
bool operator==(const QLinkedList<T> &l) const;
inline bool operator!=(const QLinkedList<T> &l) const { return !(*this == l); }
@@ -182,14 +183,25 @@ public:
friend class const_iterator;
// stl style
+ typedef std::reverse_iterator<iterator> reverse_iterator;
+ typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+
inline iterator begin() { detach(); return e->n; }
- inline const_iterator begin() const { return e->n; }
- inline const_iterator cbegin() const { return e->n; }
- inline const_iterator constBegin() const { return e->n; }
+ inline const_iterator begin() const Q_DECL_NOTHROW { return e->n; }
+ inline const_iterator cbegin() const Q_DECL_NOTHROW { return e->n; }
+ inline const_iterator constBegin() const Q_DECL_NOTHROW { return e->n; }
inline iterator end() { detach(); return e; }
- inline const_iterator end() const { return e; }
- inline const_iterator cend() const { return e; }
- inline const_iterator constEnd() const { return e; }
+ inline const_iterator end() const Q_DECL_NOTHROW { return e; }
+ inline const_iterator cend() const Q_DECL_NOTHROW { return e; }
+ inline const_iterator constEnd() const Q_DECL_NOTHROW { return e; }
+
+ reverse_iterator rbegin() { return reverse_iterator(end()); }
+ reverse_iterator rend() { return reverse_iterator(begin()); }
+ const_reverse_iterator rbegin() const Q_DECL_NOTHROW { return const_reverse_iterator(end()); }
+ const_reverse_iterator rend() const Q_DECL_NOTHROW { return const_reverse_iterator(begin()); }
+ const_reverse_iterator crbegin() const Q_DECL_NOTHROW { return const_reverse_iterator(end()); }
+ const_reverse_iterator crend() const Q_DECL_NOTHROW { return const_reverse_iterator(begin()); }
+
iterator insert(iterator before, const T &t);
iterator erase(iterator pos);
iterator erase(iterator first, iterator last);
diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h
index 32e0141d55..9a57a2c6a5 100644
--- a/src/corelib/tools/qlist.h
+++ b/src/corelib/tools/qlist.h
@@ -143,11 +143,12 @@ public:
~QList();
QList<T> &operator=(const QList<T> &l);
#ifdef Q_COMPILER_RVALUE_REFS
- inline QList(QList<T> &&other) : d(other.d) { other.d = const_cast<QListData::Data *>(&QListData::shared_null); }
- inline QList &operator=(QList<T> &&other)
+ inline QList(QList<T> &&other) Q_DECL_NOTHROW
+ : d(other.d) { other.d = const_cast<QListData::Data *>(&QListData::shared_null); }
+ inline QList &operator=(QList<T> &&other) Q_DECL_NOTHROW
{ QList moved(std::move(other)); swap(moved); return *this; }
#endif
- inline void swap(QList<T> &other) { qSwap(d, other.d); }
+ inline void swap(QList<T> &other) Q_DECL_NOTHROW { qSwap(d, other.d); }
#ifdef Q_COMPILER_INITIALIZER_LISTS
inline QList(std::initializer_list<T> args)
: d(const_cast<QListData::Data *>(&QListData::shared_null))
diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp
index 181daa04e4..57ef53eea4 100644
--- a/src/corelib/tools/qlocale.cpp
+++ b/src/corelib/tools/qlocale.cpp
@@ -89,9 +89,9 @@ QLocale::Language QLocalePrivate::codeToLanguage(const QString &code)
int len = code.length();
if (len != 2 && len != 3)
return QLocale::C;
- ushort uc1 = len-- > 0 ? code[0].toLower().unicode() : 0;
- ushort uc2 = len-- > 0 ? code[1].toLower().unicode() : 0;
- ushort uc3 = len-- > 0 ? code[2].toLower().unicode() : 0;
+ ushort uc1 = code[0].toLower().unicode();
+ ushort uc2 = code[1].toLower().unicode();
+ ushort uc3 = len > 2 ? code[2].toLower().unicode() : 0;
const unsigned char *c = language_code_list;
for (; *c != 0; c += 3) {
@@ -145,9 +145,9 @@ QLocale::Country QLocalePrivate::codeToCountry(const QString &code)
int len = code.length();
if (len != 2 && len != 3)
return QLocale::AnyCountry;
- ushort uc1 = len-- > 0 ? code[0].toUpper().unicode() : 0;
- ushort uc2 = len-- > 0 ? code[1].toUpper().unicode() : 0;
- ushort uc3 = len-- > 0 ? code[2].toUpper().unicode() : 0;
+ ushort uc1 = code[0].toUpper().unicode();
+ ushort uc2 = code[1].toUpper().unicode();
+ ushort uc3 = len > 2 ? code[2].toUpper().unicode() : 0;
const unsigned char *c = country_code_list;
for (; *c != 0; c += 3) {
diff --git a/src/corelib/tools/qmap.h b/src/corelib/tools/qmap.h
index b7bd268bda..fe9ddaaa32 100644
--- a/src/corelib/tools/qmap.h
+++ b/src/corelib/tools/qmap.h
@@ -321,7 +321,7 @@ class QMap
QMapData<Key, T> *d;
public:
- inline QMap() : d(static_cast<QMapData<Key, T> *>(const_cast<QMapDataBase *>(&QMapDataBase::shared_null))) { }
+ inline QMap() Q_DECL_NOTHROW : d(static_cast<QMapData<Key, T> *>(const_cast<QMapDataBase *>(&QMapDataBase::shared_null))) { }
#ifdef Q_COMPILER_INITIALIZER_LISTS
inline QMap(std::initializer_list<std::pair<Key,T> > list)
: d(static_cast<QMapData<Key, T> *>(const_cast<QMapDataBase *>(&QMapDataBase::shared_null)))
@@ -336,17 +336,17 @@ public:
QMap<Key, T> &operator=(const QMap<Key, T> &other);
#ifdef Q_COMPILER_RVALUE_REFS
- inline QMap(QMap<Key, T> &&other)
+ inline QMap(QMap<Key, T> &&other) Q_DECL_NOTHROW
: d(other.d)
{
other.d = static_cast<QMapData<Key, T> *>(
const_cast<QMapDataBase *>(&QMapDataBase::shared_null));
}
- inline QMap<Key, T> &operator=(QMap<Key, T> &&other)
+ inline QMap<Key, T> &operator=(QMap<Key, T> &&other) Q_DECL_NOTHROW
{ QMap moved(std::move(other)); swap(moved); return *this; }
#endif
- inline void swap(QMap<Key, T> &other) { qSwap(d, other.d); }
+ inline void swap(QMap<Key, T> &other) Q_DECL_NOTHROW { qSwap(d, other.d); }
explicit QMap(const typename std::map<Key, T> &other);
std::map<Key, T> toStdMap() const;
@@ -1168,7 +1168,7 @@ template <class Key, class T>
class QMultiMap : public QMap<Key, T>
{
public:
- QMultiMap() {}
+ QMultiMap() Q_DECL_NOTHROW {}
#ifdef Q_COMPILER_INITIALIZER_LISTS
inline QMultiMap(std::initializer_list<std::pair<Key,T> > list)
{
@@ -1177,7 +1177,10 @@ public:
}
#endif
QMultiMap(const QMap<Key, T> &other) : QMap<Key, T>(other) {}
- inline void swap(QMultiMap<Key, T> &other) { QMap<Key, T>::swap(other); }
+#ifdef Q_COMPILER_RVALUE_REFS
+ QMultiMap(QMap<Key, T> &&other) Q_DECL_NOTHROW : QMap<Key, T>(std::move(other)) {}
+#endif
+ void swap(QMultiMap<Key, T> &other) Q_DECL_NOTHROW { QMap<Key, T>::swap(other); }
inline typename QMap<Key, T>::iterator replace(const Key &key, const T &value)
{ return QMap<Key, T>::insert(key, value); }
diff --git a/src/corelib/tools/qqueue.h b/src/corelib/tools/qqueue.h
index 7a7abab070..0cb8353d0f 100644
--- a/src/corelib/tools/qqueue.h
+++ b/src/corelib/tools/qqueue.h
@@ -44,7 +44,7 @@ class QQueue : public QList<T>
{
public:
// compiler-generated special member functions are fine!
- inline void swap(QQueue<T> &other) { QList<T>::swap(other); } // prevent QList<->QQueue swaps
+ inline void swap(QQueue<T> &other) Q_DECL_NOTHROW { QList<T>::swap(other); } // prevent QList<->QQueue swaps
#ifndef Q_QDOC
// bring in QList::swap(int, int). We cannot say using QList<T>::swap,
// because we don't want to make swap(QList&) available.
diff --git a/src/corelib/tools/qregularexpression.cpp b/src/corelib/tools/qregularexpression.cpp
index d8b0bf6e9f..81b108059b 100644
--- a/src/corelib/tools/qregularexpression.cpp
+++ b/src/corelib/tools/qregularexpression.cpp
@@ -2479,7 +2479,7 @@ QDataStream &operator>>(QDataStream &in, QRegularExpression &re)
QDebug operator<<(QDebug debug, const QRegularExpression &re)
{
QDebugStateSaver saver(debug);
- debug.nospace() << "QRegularExpression(" << re.pattern() << ", " << re.patternOptions() << ")";
+ debug.nospace() << "QRegularExpression(" << re.pattern() << ", " << re.patternOptions() << ')';
return debug;
}
@@ -2521,7 +2521,7 @@ QDebug operator<<(QDebug debug, QRegularExpression::PatternOptions patternOption
flags.chop(1);
}
- debug.nospace() << "QRegularExpression::PatternOptions(" << flags << ")";
+ debug.nospace() << "QRegularExpression::PatternOptions(" << flags << ')';
return debug;
}
@@ -2550,7 +2550,7 @@ QDebug operator<<(QDebug debug, const QRegularExpressionMatch &match)
for (int i = 0; i <= match.lastCapturedIndex(); ++i) {
debug << i
<< ":(" << match.capturedStart(i) << ", " << match.capturedEnd(i)
- << ", " << match.captured(i) << ")";
+ << ", " << match.captured(i) << ')';
if (i < match.lastCapturedIndex())
debug << ", ";
}
@@ -2558,12 +2558,12 @@ QDebug operator<<(QDebug debug, const QRegularExpressionMatch &match)
debug << ", has partial match: ("
<< match.capturedStart(0) << ", "
<< match.capturedEnd(0) << ", "
- << match.captured(0) << ")";
+ << match.captured(0) << ')';
} else {
debug << ", no match";
}
- debug << ")";
+ debug << ')';
return debug;
}
diff --git a/src/corelib/tools/qset.h b/src/corelib/tools/qset.h
index aeba6cf68d..3f4208e8b3 100644
--- a/src/corelib/tools/qset.h
+++ b/src/corelib/tools/qset.h
@@ -39,6 +39,8 @@
#include <initializer_list>
#endif
+#include <iterator>
+
QT_BEGIN_NAMESPACE
@@ -48,7 +50,7 @@ class QSet
typedef QHash<T, QHashDummyValue> Hash;
public:
- inline QSet() {}
+ inline QSet() Q_DECL_NOTHROW {}
#ifdef Q_COMPILER_INITIALIZER_LISTS
inline QSet(std::initializer_list<T> list)
{
@@ -60,7 +62,7 @@ public:
// compiler-generated copy/move ctor/assignment operators are fine!
// compiler-generated destructor is fine!
- inline void swap(QSet<T> &other) { q_hash.swap(other.q_hash); }
+ inline void swap(QSet<T> &other) Q_DECL_NOTHROW { q_hash.swap(other.q_hash); }
inline bool operator==(const QSet<T> &other) const
{ return q_hash == other.q_hash; }
@@ -161,14 +163,25 @@ public:
};
// STL style
+ typedef std::reverse_iterator<iterator> reverse_iterator;
+ typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+
inline iterator begin() { return q_hash.begin(); }
- inline const_iterator begin() const { return q_hash.begin(); }
- inline const_iterator cbegin() const { return q_hash.begin(); }
- inline const_iterator constBegin() const { return q_hash.constBegin(); }
+ inline const_iterator begin() const Q_DECL_NOTHROW { return q_hash.begin(); }
+ inline const_iterator cbegin() const Q_DECL_NOTHROW { return q_hash.begin(); }
+ inline const_iterator constBegin() const Q_DECL_NOTHROW { return q_hash.constBegin(); }
inline iterator end() { return q_hash.end(); }
- inline const_iterator end() const { return q_hash.end(); }
- inline const_iterator cend() const { return q_hash.end(); }
- inline const_iterator constEnd() const { return q_hash.constEnd(); }
+ inline const_iterator end() const Q_DECL_NOTHROW { return q_hash.end(); }
+ inline const_iterator cend() const Q_DECL_NOTHROW { return q_hash.end(); }
+ inline const_iterator constEnd() const Q_DECL_NOTHROW { return q_hash.constEnd(); }
+
+ reverse_iterator rbegin() { return reverse_iterator(end()); }
+ reverse_iterator rend() { return reverse_iterator(begin()); }
+ const_reverse_iterator rbegin() const Q_DECL_NOTHROW { return const_reverse_iterator(end()); }
+ const_reverse_iterator rend() const Q_DECL_NOTHROW { return const_reverse_iterator(begin()); }
+ const_reverse_iterator crbegin() const Q_DECL_NOTHROW { return const_reverse_iterator(end()); }
+ const_reverse_iterator crend() const Q_DECL_NOTHROW { return const_reverse_iterator(begin()); }
+
iterator erase(iterator i)
{
Q_ASSERT_X(isValidIterator(i), "QSet::erase", "The specified const_iterator argument 'i' is invalid");
diff --git a/src/corelib/tools/qset.qdoc b/src/corelib/tools/qset.qdoc
index d91a589aa1..542def4651 100644
--- a/src/corelib/tools/qset.qdoc
+++ b/src/corelib/tools/qset.qdoc
@@ -384,6 +384,52 @@
\sa constBegin(), end()
*/
+/*! \fn QSet::reverse_iterator QSet::rbegin()
+ \since 5.6
+
+ Returns a \l{STL-style iterators}{STL-style} reverse iterator pointing to the first
+ item in the set, in reverse order.
+
+ \sa begin(), crbegin(), rend()
+*/
+
+/*! \fn QSet::const_reverse_iterator QSet::rbegin() const
+ \since 5.6
+ \overload
+*/
+
+/*! \fn QSet::const_reverse_iterator QSet::crbegin() const
+ \since 5.6
+
+ Returns a const \l{STL-style iterators}{STL-style} reverse iterator pointing to the first
+ item in the set, in reverse order.
+
+ \sa begin(), rbegin(), rend()
+*/
+
+/*! \fn QSet::reverse_iterator QSet::rend()
+ \since 5.6
+
+ Returns a \l{STL-style iterators}{STL-style} reverse iterator pointing to one past
+ the last item in the set, in reverse order.
+
+ \sa end(), crend(), rbegin()
+*/
+
+/*! \fn QSet::const_reverse_iterator QSet::rend() const
+ \since 5.6
+ \overload
+*/
+
+/*! \fn QSet::const_reverse_iterator QSet::crend() const
+ \since 5.6
+
+ Returns a const \l{STL-style iterators}{STL-style} reverse iterator pointing to one
+ past the last item in the set, in reverse order.
+
+ \sa end(), rend(), rbegin()
+*/
+
/*!
\typedef QSet::Iterator
\since 4.2
@@ -445,6 +491,38 @@
Typedef for T. Provided for STL compatibility.
*/
+/*! \typedef QSet::reverse_iterator
+ \since 5.6
+
+ The QSet::reverse_iterator typedef provides an STL-style non-const
+ reverse iterator for QSet.
+
+ It is simply a typedef for \c{std::reverse_iterator<QSet::iterator>}.
+
+ \warning Iterators on implicitly shared containers do not work
+ exactly like STL-iterators. You should avoid copying a container
+ while iterators are active on that container. For more information,
+ read \l{Implicit sharing iterator problem}.
+
+ \sa QSet::rbegin(), QSet::rend(), QSet::const_reverse_iterator, QSet::iterator
+*/
+
+/*! \typedef QSet::const_reverse_iterator
+ \since 5.6
+
+ The QSet::const_reverse_iterator typedef provides an STL-style const
+ reverse iterator for QSet.
+
+ It is simply a typedef for \c{std::reverse_iterator<QSet::const_iterator>}.
+
+ \warning Iterators on implicitly shared containers do not work
+ exactly like STL-iterators. You should avoid copying a container
+ while iterators are active on that container. For more information,
+ read \l{Implicit sharing iterator problem}.
+
+ \sa QSet::rbegin(), QSet::rend(), QSet::reverse_iterator, QSet::const_iterator
+*/
+
/*!
\fn QSet::const_iterator QSet::insert(const T &value)
diff --git a/src/corelib/tools/qsimd_p.h b/src/corelib/tools/qsimd_p.h
index c4deee36e4..96f5419af6 100644
--- a/src/corelib/tools/qsimd_p.h
+++ b/src/corelib/tools/qsimd_p.h
@@ -54,9 +54,9 @@
* for the x86 and ARM intrinsics:
* - GCC: the -mXXX or march=YYY flag is necessary before #include
* up to 4.8; GCC >= 4.9 can include unconditionally
- * - Clang: same as GCC, with unconditional inclusion with version 3.7
* - Intel CC: #include can happen unconditionally
* - MSVC: #include can happen unconditionally
+ * - RVCT: ???
*
* We will try to include all headers possible under this configuration.
*
@@ -139,8 +139,7 @@
#define QT_COMPILER_SUPPORTS(x) (QT_COMPILER_SUPPORTS_ ## x - 0)
#if (defined(Q_CC_INTEL) || defined(Q_CC_MSVC) \
- || (defined(Q_CC_GNU) && !defined(Q_CC_CLANG) && (__GNUC__-0) * 100 + (__GNUC_MINOR__-0) >= 409) \
- || (defined(Q_CC_CLANG) && Q_CC_CLANG >= 307)) \
+ || (defined(Q_CC_GNU) && !defined(Q_CC_CLANG) && (__GNUC__-0) * 100 + (__GNUC_MINOR__-0) >= 409)) \
&& !defined(QT_BOOTSTRAPPED)
# define QT_COMPILER_SUPPORTS_SIMD_ALWAYS
# define QT_COMPILER_SUPPORTS_HERE(x) QT_COMPILER_SUPPORTS(x)
@@ -151,7 +150,7 @@
# define QT_FUNCTION_TARGET(x)
# endif
#else
-# define QT_COMPILER_SUPPORTS_HERE(x) defined(__ ## x ## __)
+# define QT_COMPILER_SUPPORTS_HERE(x) (__ ## x ## __)
# define QT_FUNCTION_TARGET(x)
#endif
diff --git a/src/corelib/tools/qstack.h b/src/corelib/tools/qstack.h
index 278e89ca2f..cb72316c32 100644
--- a/src/corelib/tools/qstack.h
+++ b/src/corelib/tools/qstack.h
@@ -44,7 +44,7 @@ class QStack : public QVector<T>
{
public:
// compiler-generated special member functions are fine!
- inline void swap(QStack<T> &other) { QVector<T>::swap(other); } // prevent QVector<->QStack swaps
+ inline void swap(QStack<T> &other) Q_DECL_NOTHROW { QVector<T>::swap(other); } // prevent QVector<->QStack swaps
inline void push(const T &t) { QVector<T>::append(t); }
T pop();
T &top();
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index e3a3cc79c6..ea220ed557 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -1509,7 +1509,7 @@ QString::QString(const QChar *unicode, int size)
} else {
if (size < 0) {
size = 0;
- while (unicode[size] != 0)
+ while (!unicode[size].isNull())
++size;
}
if (!size) {
diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h
index ece86c5917..47c4272389 100644
--- a/src/corelib/tools/qstring.h
+++ b/src/corelib/tools/qstring.h
@@ -1244,13 +1244,13 @@ inline bool QByteArray::operator==(const QString &s) const
inline bool QByteArray::operator!=(const QString &s) const
{ return QString::compare_helper(s.constData(), s.size(), constData(), size()) != 0; }
inline bool QByteArray::operator<(const QString &s) const
-{ return QString::compare_helper(s.constData(), s.size(), constData(), size()) < 0; }
-inline bool QByteArray::operator>(const QString &s) const
{ return QString::compare_helper(s.constData(), s.size(), constData(), size()) > 0; }
+inline bool QByteArray::operator>(const QString &s) const
+{ return QString::compare_helper(s.constData(), s.size(), constData(), size()) < 0; }
inline bool QByteArray::operator<=(const QString &s) const
-{ return QString::compare_helper(s.constData(), s.size(), constData(), size()) <= 0; }
-inline bool QByteArray::operator>=(const QString &s) const
{ return QString::compare_helper(s.constData(), s.size(), constData(), size()) >= 0; }
+inline bool QByteArray::operator>=(const QString &s) const
+{ return QString::compare_helper(s.constData(), s.size(), constData(), size()) <= 0; }
#endif // !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII)
#ifndef QT_NO_CAST_TO_ASCII
diff --git a/src/corelib/tools/qstringalgorithms_p.h b/src/corelib/tools/qstringalgorithms_p.h
index 65901b0286..a12874f567 100644
--- a/src/corelib/tools/qstringalgorithms_p.h
+++ b/src/corelib/tools/qstringalgorithms_p.h
@@ -101,8 +101,6 @@ template <typename StringType> struct QStringAlgorithms
if (begin == str.cbegin() && end == str.cend())
return str;
- if (begin == end)
- return StringType();
if (!isConst && str.isDetached())
return trimmed_helper_inplace(str, begin, end);
return StringType(begin, end - begin);
diff --git a/src/corelib/tools/qversionnumber.cpp b/src/corelib/tools/qversionnumber.cpp
index 4197fc47b1..f432820252 100644
--- a/src/corelib/tools/qversionnumber.cpp
+++ b/src/corelib/tools/qversionnumber.cpp
@@ -202,7 +202,7 @@ QVector<int> QVersionNumber::segments() const
Returns an equivalent version number but with all trailing zeros removed.
To check if two numbers are equivalent, use normalized() on both version
- numbers before perforing the compare.
+ numbers before performing the compare.
\snippet qversionnumber/main.cpp 4
*/
diff --git a/src/corelib/xml/qxmlstream.cpp b/src/corelib/xml/qxmlstream.cpp
index 13c84db9ae..69e2e5d5c1 100644
--- a/src/corelib/xml/qxmlstream.cpp
+++ b/src/corelib/xml/qxmlstream.cpp
@@ -3013,7 +3013,8 @@ void QXmlStreamWriterPrivate::checkIfASCIICompatibleCodec()
#ifndef QT_NO_TEXTCODEC
Q_ASSERT(encoder);
// assumes ASCII-compatibility for all 8-bit encodings
- const QByteArray bytes = encoder->fromUnicode(QStringLiteral(" "));
+ QChar space = QLatin1Char(' ');
+ const QByteArray bytes = encoder->fromUnicode(&space, 1);
isCodecASCIICompatible = (bytes.count() == 1);
#else
isCodecASCIICompatible = true;
diff --git a/src/dbus/dbus_minimal_p.h b/src/dbus/dbus_minimal_p.h
index 7ebd82dbf8..f0a29540c8 100644
--- a/src/dbus/dbus_minimal_p.h
+++ b/src/dbus/dbus_minimal_p.h
@@ -34,6 +34,17 @@
#ifndef DBUS_MINIMAL_P_H
#define DBUS_MINIMAL_P_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
extern "C" {
// Equivalent to dbus-arch-deps.h
diff --git a/src/dbus/doc/src/qtdbus-module.qdoc b/src/dbus/doc/src/qtdbus-module.qdoc
index 498da43d7a..87d35386c8 100644
--- a/src/dbus/doc/src/qtdbus-module.qdoc
+++ b/src/dbus/doc/src/qtdbus-module.qdoc
@@ -34,7 +34,7 @@
\ingroup modules
\qtvariable dbus
- \target The QDBus compiler
+ \keyword The QDBus compiler
Applications using the Qt D-Bus module can provide services to
diff --git a/src/dbus/qdbusinternalfilters.cpp b/src/dbus/qdbusinternalfilters.cpp
index d9e5f7408b..fd6f91e65a 100644
--- a/src/dbus/qdbusinternalfilters.cpp
+++ b/src/dbus/qdbusinternalfilters.cpp
@@ -366,6 +366,9 @@ static int writeProperty(QObject *obj, const QByteArray &property_name, QVariant
value = other;
}
+ if (mp.userType() == qMetaTypeId<QDBusVariant>())
+ value = QVariant::fromValue(QDBusVariant(value));
+
// the property type here should match
return mp.write(obj, value) ? PropertyWriteSuccess : PropertyWriteFailed;
}
diff --git a/src/dbus/qdbusmessage.cpp b/src/dbus/qdbusmessage.cpp
index 302d94696d..32b7787514 100644
--- a/src/dbus/qdbusmessage.cpp
+++ b/src/dbus/qdbusmessage.cpp
@@ -378,10 +378,10 @@ QDBusMessage QDBusMessage::createSignal(const QString &path, const QString &inte
\since 5.6
Constructs a new DBus message with the given \a path, \a interface
- and \a name, representing a signal emission to \a destination.
+ and \a name, representing a signal emission to a specific destination.
A DBus signal is emitted from one application and is received only by
- the application owning the destination service name.
+ the application owning the destination \a service name.
The QDBusMessage object that is returned can be sent using the
QDBusConnection::send() function.
diff --git a/src/gui/doc/qtgui.qdocconf b/src/gui/doc/qtgui.qdocconf
index e2194839d2..436e2e0b34 100644
--- a/src/gui/doc/qtgui.qdocconf
+++ b/src/gui/doc/qtgui.qdocconf
@@ -37,7 +37,8 @@ depends += \
qtqml \
qtquick \
qtwidgets \
- qtdoc
+ qtdoc \
+ qmake
headerdirs += ..
diff --git a/src/gui/doc/snippets/qfontdatabase/main.cpp b/src/gui/doc/snippets/qfontdatabase/main.cpp
index e33ad5f539..aacd6f47fa 100644
--- a/src/gui/doc/snippets/qfontdatabase/main.cpp
+++ b/src/gui/doc/snippets/qfontdatabase/main.cpp
@@ -60,7 +60,7 @@ int main(int argc, char **argv)
QString sizes;
foreach (int points, database.smoothSizes(family, style))
- sizes += QString::number(points) + " ";
+ sizes += QString::number(points) + ' ';
styleItem->setText(1, sizes.trimmed());
}
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index 7f2504ddd9..a69aae87f1 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -313,7 +313,7 @@ bool QImageData::checkForAlphaPixels() const
sharing}. QImage objects can also be streamed and compared.
\note If you would like to load QImage objects in a static build of Qt,
- refer to the \l{How To Create Qt Plugins}{Plugin HowTo}.
+ refer to the \l{How to Create Qt Plugins}{Plugin HowTo}.
\warning Painting on a QImage with the format
QImage::Format_Indexed8 is not supported.
diff --git a/src/gui/image/qimagereader.cpp b/src/gui/image/qimagereader.cpp
index 618352d363..0ef587f333 100644
--- a/src/gui/image/qimagereader.cpp
+++ b/src/gui/image/qimagereader.cpp
@@ -1171,7 +1171,7 @@ QImageIOHandler::Transformations QImageReader::transformation() const
Determines that images returned by read() should have transformation metadata automatically
applied if \a enabled is \c true.
- \sa autoTransform(), read()
+ \sa autoTransform(), transformation(), read()
*/
void QImageReader::setAutoTransform(bool enabled)
{
diff --git a/src/gui/image/qjpeghandler.cpp b/src/gui/image/qjpeghandler.cpp
index e29f9783a6..7e9483e6f7 100644
--- a/src/gui/image/qjpeghandler.cpp
+++ b/src/gui/image/qjpeghandler.cpp
@@ -68,6 +68,7 @@ extern "C" {
}
QT_BEGIN_NAMESPACE
+QT_WARNING_DISABLE_GCC("-Wclobbered")
Q_GUI_EXPORT void QT_FASTCALL qt_convert_rgb888_to_rgb32(quint32 *dst, const uchar *src, int len);
typedef void (QT_FASTCALL *Rgb888ToRgb32Converter)(quint32 *dst, const uchar *src, int len);
diff --git a/src/gui/image/qpixmapcache.cpp b/src/gui/image/qpixmapcache.cpp
index 04e1d442b0..2df813367d 100644
--- a/src/gui/image/qpixmapcache.cpp
+++ b/src/gui/image/qpixmapcache.cpp
@@ -73,7 +73,7 @@ QT_BEGIN_NAMESPACE
memory.
The \e{Qt Quarterly} article
- \l{http://doc.qt.digia.com/qq/qq12-qpixmapcache.html}{Optimizing
+ \l{http://doc.qt.io/archives/qq/qq12-qpixmapcache.html}{Optimizing
with QPixmapCache} explains how to use QPixmapCache to speed up
applications by caching the results of painting.
diff --git a/src/gui/image/qppmhandler.cpp b/src/gui/image/qppmhandler.cpp
index 0f4256b740..f460431c2b 100644
--- a/src/gui/image/qppmhandler.cpp
+++ b/src/gui/image/qppmhandler.cpp
@@ -182,7 +182,8 @@ static bool read_pbm_body(QIODevice *device, char type, int w, int h, int mcc, Q
} else { // read ascii data
uchar *p;
int n;
- for (y=0; y<h; y++) {
+ char buf;
+ for (y = 0; (y < h) && (device->peek(&buf, 1) == 1); y++) {
p = outImage->scanLine(y);
n = pbm_bpl;
if (nbits == 1) {
diff --git a/src/gui/kernel/qcursor.cpp b/src/gui/kernel/qcursor.cpp
index dbf2b3c21f..c25f3c2665 100644
--- a/src/gui/kernel/qcursor.cpp
+++ b/src/gui/kernel/qcursor.cpp
@@ -393,7 +393,7 @@ QCursor::QCursor(const QPixmap &pixmap, int hotX, int hotY)
bmm.fill(Qt::color1);
}
- d = QCursorData::setBitmap(bm, bmm, hotX, hotY);
+ d = QCursorData::setBitmap(bm, bmm, hotX, hotY, pixmap.devicePixelRatio());
d->pixmap = pixmap;
}
@@ -436,7 +436,7 @@ QCursor::QCursor(const QPixmap &pixmap, int hotX, int hotY)
QCursor::QCursor(const QBitmap &bitmap, const QBitmap &mask, int hotX, int hotY)
: d(0)
{
- d = QCursorData::setBitmap(bitmap, mask, hotX, hotY);
+ d = QCursorData::setBitmap(bitmap, mask, hotX, hotY, 1.0);
}
/*!
@@ -656,7 +656,7 @@ void QCursorData::initialize()
QCursorData::initialized = true;
}
-QCursorData *QCursorData::setBitmap(const QBitmap &bitmap, const QBitmap &mask, int hotX, int hotY)
+QCursorData *QCursorData::setBitmap(const QBitmap &bitmap, const QBitmap &mask, int hotX, int hotY, qreal devicePixelRatio)
{
if (!QCursorData::initialized)
QCursorData::initialize();
@@ -670,8 +670,8 @@ QCursorData *QCursorData::setBitmap(const QBitmap &bitmap, const QBitmap &mask,
d->bm = new QBitmap(bitmap);
d->bmm = new QBitmap(mask);
d->cshape = Qt::BitmapCursor;
- d->hx = hotX >= 0 ? hotX : bitmap.width() / 2;
- d->hy = hotY >= 0 ? hotY : bitmap.height() / 2;
+ d->hx = hotX >= 0 ? hotX : bitmap.width() / 2 / devicePixelRatio;
+ d->hy = hotY >= 0 ? hotY : bitmap.height() / 2 / devicePixelRatio;
return d;
}
diff --git a/src/gui/kernel/qcursor_p.h b/src/gui/kernel/qcursor_p.h
index 0aaa62b891..188ea387b3 100644
--- a/src/gui/kernel/qcursor_p.h
+++ b/src/gui/kernel/qcursor_p.h
@@ -70,7 +70,8 @@ public:
short hx, hy;
static bool initialized;
void update();
- static QCursorData *setBitmap(const QBitmap &bitmap, const QBitmap &mask, int hotX, int hotY);
+ static QCursorData *setBitmap(const QBitmap &bitmap, const QBitmap &mask, int hotX, int hotY,
+ qreal devicePixelRatio);
};
extern QCursorData *qt_cursorTable[Qt::LastCursor + 1]; // qcursor.cpp
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index 27ea2ee5fa..233b9ef3f7 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -1030,8 +1030,10 @@ QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos,
when keys are pressed or released.
A key event contains a special accept flag that indicates whether
- the receiver will handle the key event. This flag is set by default,
- so there is no need to call accept() when acting on a key event.
+ the receiver will handle the key event. This flag is set by default
+ for QEvent::KeyPress and QEvent::KeyRelease, so there is no need to
+ call accept() when acting on a key event. For QEvent::ShortcutOverride
+ the receiver needs to explicitly accept the event to trigger the override.
Calling ignore() on a key event will propagate it to the parent widget.
The event is propagated up the parent widget chain until a widget
accepts it or an event filter consumes it.
@@ -1066,6 +1068,8 @@ QKeyEvent::QKeyEvent(Type type, int key, Qt::KeyboardModifiers modifiers, const
nScanCode(0), nVirtualKey(0), nModifiers(0),
c(count), autor(autorep)
{
+ if (type == QEvent::ShortcutOverride)
+ ignore();
}
/*!
@@ -1093,6 +1097,8 @@ QKeyEvent::QKeyEvent(Type type, int key, Qt::KeyboardModifiers modifiers,
nScanCode(nativeScanCode), nVirtualKey(nativeVirtualKey), nModifiers(nativeModifiers),
c(count), autor(autorep)
{
+ if (type == QEvent::ShortcutOverride)
+ ignore();
}
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index 902d60be85..b717585b54 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -1163,7 +1163,7 @@ void QGuiApplicationPrivate::createPlatformIntegration()
QHighDpiScaling::initHighDpiScaling();
// Load the platform integration
- QString platformPluginPath = QLatin1String(qgetenv("QT_QPA_PLATFORM_PLUGIN_PATH"));
+ QString platformPluginPath = QString::fromLocal8Bit(qgetenv("QT_QPA_PLATFORM_PLUGIN_PATH"));
QByteArray platformName;
@@ -1193,7 +1193,7 @@ void QGuiApplicationPrivate::createPlatformIntegration()
arg.remove(0, 1);
if (arg == "-platformpluginpath") {
if (++i < argc)
- platformPluginPath = QLatin1String(argv[i]);
+ platformPluginPath = QString::fromLocal8Bit(argv[i]);
} else if (arg == "-platform") {
if (++i < argc)
platformName = argv[i];
@@ -1947,19 +1947,6 @@ void QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyE
window = QGuiApplication::focusWindow();
}
-#if !defined(Q_OS_OSX)
- // On OS X the shortcut override is checked earlier, see: QWindowSystemInterface::handleKeyEvent()
- const bool checkShortcut = e->keyType == QEvent::KeyPress && window != 0;
- if (checkShortcut) {
- QKeyEvent override(QEvent::ShortcutOverride, e->key, e->modifiers,
- e->nativeScanCode, e->nativeVirtualKey, e->nativeModifiers,
- e->unicode, e->repeat, e->repeatCount);
- override.setTimestamp(e->timestamp);
- if (QWindowSystemInterface::tryHandleShortcutOverrideEvent(window, &override))
- return;
- }
-#endif // Q_OS_OSX
-
QKeyEvent ev(e->keyType, e->key, e->modifiers,
e->nativeScanCode, e->nativeVirtualKey, e->nativeModifiers,
e->unicode, e->repeat, e->repeatCount);
diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp
index ffa9b87147..881d7cc76a 100644
--- a/src/gui/kernel/qkeysequence.cpp
+++ b/src/gui/kernel/qkeysequence.cpp
@@ -291,6 +291,7 @@ void Q_GUI_EXPORT qt_set_sequence_auto_mnemonic(bool b) { qt_sequence_no_mnemoni
\row \li InsertParagraphSeparator \li Enter \li Enter \li Enter \li Enter
\row \li InsertLineSeparator \li Shift+Enter \li Meta+Enter, Meta+O \li Shift+Enter \li Shift+Enter
\row \li Backspace \li (none) \li Meta+H \li (none) \li (none)
+ \row \li Cancel \li Escape \li Escape, Ctrl+. \li Escape \li Escape
\endtable
Note that, since the key sequences used for the standard shortcuts differ
@@ -752,6 +753,7 @@ static const struct {
\value ZoomIn Zoom in.
\value ZoomOut Zoom out.
\value FullScreen Toggle the window state to/from full screen.
+ \value Cancel Cancel the current operation.
*/
/*!
diff --git a/src/gui/kernel/qkeysequence.h b/src/gui/kernel/qkeysequence.h
index d6171c86f2..98a611aab5 100644
--- a/src/gui/kernel/qkeysequence.h
+++ b/src/gui/kernel/qkeysequence.h
@@ -137,7 +137,8 @@ public:
FullScreen,
Deselect,
DeleteCompleteLine,
- Backspace
+ Backspace,
+ Cancel
};
Q_ENUM(StandardKey)
diff --git a/src/gui/kernel/qpaintdevicewindow_p.h b/src/gui/kernel/qpaintdevicewindow_p.h
index e234906fe0..071f2ee54c 100644
--- a/src/gui/kernel/qpaintdevicewindow_p.h
+++ b/src/gui/kernel/qpaintdevicewindow_p.h
@@ -34,6 +34,17 @@
#ifndef QPAINTDEVICEWINDOW_P_H
#define QPAINTDEVICEWINDOW_P_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include <QtGui/QPaintDeviceWindow>
#include <QtCore/QCoreApplication>
#include <QtGui/private/qwindow_p.h>
diff --git a/src/gui/kernel/qplatformtheme.cpp b/src/gui/kernel/qplatformtheme.cpp
index 36a71fe2da..ce8548f628 100644
--- a/src/gui/kernel/qplatformtheme.cpp
+++ b/src/gui/kernel/qplatformtheme.cpp
@@ -323,7 +323,9 @@ const QKeyBinding QPlatformThemePrivate::keyBindings[] = {
{QKeySequence::FullScreen, 1, Qt::Key_F11, KB_Win | KB_KDE},
{QKeySequence::Deselect, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_A, KB_X11},
{QKeySequence::DeleteCompleteLine, 0, Qt::CTRL | Qt::Key_U, KB_X11},
- {QKeySequence::Backspace, 0, Qt::META | Qt::Key_H, KB_Mac}
+ {QKeySequence::Backspace, 0, Qt::META | Qt::Key_H, KB_Mac},
+ {QKeySequence::Cancel, 0, Qt::Key_Escape, KB_All},
+ {QKeySequence::Cancel, 0, Qt::CTRL | Qt::Key_Period, KB_Mac}
};
const uint QPlatformThemePrivate::numberOfKeyBindings = sizeof(QPlatformThemePrivate::keyBindings)/(sizeof(QKeyBinding));
diff --git a/src/gui/kernel/qshapedpixmapdndwindow.cpp b/src/gui/kernel/qshapedpixmapdndwindow.cpp
index 8f80789fb0..5736c41e25 100644
--- a/src/gui/kernel/qshapedpixmapdndwindow.cpp
+++ b/src/gui/kernel/qshapedpixmapdndwindow.cpp
@@ -38,8 +38,8 @@
QT_BEGIN_NAMESPACE
-QShapedPixmapWindow::QShapedPixmapWindow()
- : QWindow(),
+QShapedPixmapWindow::QShapedPixmapWindow(QScreen *screen)
+ : QWindow(screen),
m_backingStore(0)
{
QSurfaceFormat format;
diff --git a/src/gui/kernel/qshapedpixmapdndwindow_p.h b/src/gui/kernel/qshapedpixmapdndwindow_p.h
index fc311cff92..7536c09165 100644
--- a/src/gui/kernel/qshapedpixmapdndwindow_p.h
+++ b/src/gui/kernel/qshapedpixmapdndwindow_p.h
@@ -55,7 +55,7 @@ class QShapedPixmapWindow : public QWindow
{
Q_OBJECT
public:
- QShapedPixmapWindow();
+ explicit QShapedPixmapWindow(QScreen *screen = 0);
~QShapedPixmapWindow();
void render();
diff --git a/src/gui/kernel/qshortcutmap.cpp b/src/gui/kernel/qshortcutmap.cpp
index 3e267f2e0b..3b2e6ffd29 100644
--- a/src/gui/kernel/qshortcutmap.cpp
+++ b/src/gui/kernel/qshortcutmap.cpp
@@ -309,59 +309,42 @@ QKeySequence::SequenceMatch QShortcutMap::state()
}
/*! \internal
- Uses ShortcutOverride event to see if any widgets want to override
- the event. If not, uses nextState(QKeyEvent) to check for a grabbed
- Shortcut, and dispatchEvent() is found and identical.
+ Uses nextState(QKeyEvent) to check for a grabbed shortcut.
- \note that this function should only be called from QWindowSystemInterface,
- otherwise it will result in duplicate events.
+ If so, it is dispatched using dispatchEvent().
+
+ Returns true if a shortcut handled the event.
\sa nextState, dispatchEvent
*/
-bool QShortcutMap::tryShortcutEvent(QObject *o, QKeyEvent *e)
+bool QShortcutMap::tryShortcut(QKeyEvent *e)
{
Q_D(QShortcutMap);
if (e->key() == Qt::Key_unknown)
return false;
- bool wasAccepted = e->isAccepted();
- bool wasSpontaneous = e->spont;
- if (d->currentState == QKeySequence::NoMatch) {
- ushort orgType = e->t;
- e->t = QEvent::ShortcutOverride;
- e->ignore();
- QCoreApplication::sendEvent(o, e);
- e->t = orgType;
- e->spont = wasSpontaneous;
- if (e->isAccepted()) {
- if (!wasAccepted)
- e->ignore();
- return false;
- }
- }
-
- QKeySequence::SequenceMatch result = nextState(e);
- bool stateWasAccepted = e->isAccepted();
- if (wasAccepted)
- e->accept();
- else
- e->ignore();
-
- int identicalMatches = d->identicals.count();
+ QKeySequence::SequenceMatch previousState = state();
- switch(result) {
+ switch (nextState(e)) {
case QKeySequence::NoMatch:
- return stateWasAccepted;
+ // In the case of going from a partial match to no match we handled the
+ // event, since we already stated that we did for the partial match. But
+ // in the normal case of directly going to no match we say we didn't.
+ return previousState == QKeySequence::PartialMatch;
+ case QKeySequence::PartialMatch:
+ // For a partial match we don't know yet if we will handle the shortcut
+ // but we need to say we did, so that we get the follow-up key-presses.
+ return true;
case QKeySequence::ExactMatch:
resetState();
dispatchEvent(e);
+ // If there are no identicals we've only found disabled shortcuts, and
+ // shouldn't say that we handled the event.
+ return d->identicals.count() > 0;
default:
- break;
+ Q_UNREACHABLE();
}
- // If nextState is QKeySequence::ExactMatch && identicals.count == 0
- // we've only found disabled shortcuts
- return identicalMatches > 0 || result == QKeySequence::PartialMatch;
}
/*! \internal
@@ -396,10 +379,6 @@ QKeySequence::SequenceMatch QShortcutMap::nextState(QKeyEvent *e)
}
}
- // Should we eat this key press?
- if (d->currentState == QKeySequence::PartialMatch
- || (d->currentState == QKeySequence::ExactMatch && d->identicals.count()))
- e->accept();
// Does the new state require us to clean up?
if (result == QKeySequence::NoMatch)
clearSequence(d->currentSequences);
diff --git a/src/gui/kernel/qshortcutmap_p.h b/src/gui/kernel/qshortcutmap_p.h
index 2376d27c78..16542b078a 100644
--- a/src/gui/kernel/qshortcutmap_p.h
+++ b/src/gui/kernel/qshortcutmap_p.h
@@ -75,7 +75,9 @@ public:
int setShortcutEnabled(bool enable, int id, QObject *owner, const QKeySequence &key = QKeySequence());
int setShortcutAutoRepeat(bool on, int id, QObject *owner, const QKeySequence &key = QKeySequence());
- bool tryShortcutEvent(QObject *o, QKeyEvent *e);
+ QKeySequence::SequenceMatch state();
+
+ bool tryShortcut(QKeyEvent *e);
bool hasShortcutForKeySequence(const QKeySequence &seq) const;
#ifdef Dump_QShortcutMap
@@ -85,7 +87,6 @@ public:
private:
void resetState();
QKeySequence::SequenceMatch nextState(QKeyEvent *e);
- QKeySequence::SequenceMatch state();
void dispatchEvent(QKeyEvent *e);
QKeySequence::SequenceMatch find(QKeyEvent *e, int ignoredModifiers = 0);
diff --git a/src/gui/kernel/qsimpledrag.cpp b/src/gui/kernel/qsimpledrag.cpp
index b02f1dd8bd..6acac4cade 100644
--- a/src/gui/kernel/qsimpledrag.cpp
+++ b/src/gui/kernel/qsimpledrag.cpp
@@ -203,25 +203,15 @@ void QBasicDrag::restoreCursor()
void QBasicDrag::startDrag()
{
- // ### TODO Check if its really necessary to have m_drag_icon_window
- // when QDrag is used without a pixmap - QDrag::setPixmap()
- if (!m_drag_icon_window)
- m_drag_icon_window = new QShapedPixmapWindow();
-
- m_drag_icon_window->setPixmap(m_drag->pixmap());
- m_drag_icon_window->setHotspot(m_drag->hotSpot());
-
+ QPoint pos;
#ifndef QT_NO_CURSOR
- QPoint pos = QCursor::pos();
+ pos = QCursor::pos();
if (pos.x() == int(qInf())) {
// ### fixme: no mouse pos registered. Get pos from touch...
pos = QPoint();
}
- m_drag_icon_window->updateGeometry(pos);
#endif
-
- m_drag_icon_window->setVisible(true);
-
+ recreateShapedPixmapWindow(Q_NULLPTR, pos);
enableEventFilter();
}
@@ -229,6 +219,19 @@ void QBasicDrag::endDrag()
{
}
+void QBasicDrag::recreateShapedPixmapWindow(QScreen *screen, const QPoint &pos)
+{
+ delete m_drag_icon_window;
+ // ### TODO Check if its really necessary to have m_drag_icon_window
+ // when QDrag is used without a pixmap - QDrag::setPixmap()
+ m_drag_icon_window = new QShapedPixmapWindow(screen);
+
+ m_drag_icon_window->setPixmap(m_drag->pixmap());
+ m_drag_icon_window->setHotspot(m_drag->hotSpot());
+ m_drag_icon_window->updateGeometry(pos);
+ m_drag_icon_window->setVisible(true);
+}
+
void QBasicDrag::cancel()
{
disableEventFilter();
diff --git a/src/gui/kernel/qsimpledrag_p.h b/src/gui/kernel/qsimpledrag_p.h
index a011475381..4c9edbae05 100644
--- a/src/gui/kernel/qsimpledrag_p.h
+++ b/src/gui/kernel/qsimpledrag_p.h
@@ -58,6 +58,7 @@ class QWindow;
class QEventLoop;
class QDropData;
class QShapedPixmapWindow;
+class QScreen;
class Q_GUI_EXPORT QBasicDrag : public QPlatformDrag, public QObject
{
@@ -80,6 +81,7 @@ protected:
void moveShapedPixmapWindow(const QPoint &deviceIndependentPosition);
QShapedPixmapWindow *shapedPixmapWindow() const { return m_drag_icon_window; }
+ void recreateShapedPixmapWindow(QScreen *screen, const QPoint &pos);
void updateCursor(Qt::DropAction action);
bool canDrop() const { return m_can_drop; }
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index 89bd119564..d4edc0fca1 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -1271,8 +1271,11 @@ void QWindow::setMinimumSize(const QSize &size)
*/
void QWindow::setX(int arg)
{
+ Q_D(QWindow);
if (x() != arg)
setGeometry(QRect(arg, y(), width(), height()));
+ else
+ d->positionAutomatic = false;
}
/*!
@@ -1281,8 +1284,11 @@ void QWindow::setX(int arg)
*/
void QWindow::setY(int arg)
{
+ Q_D(QWindow);
if (y() != arg)
setGeometry(QRect(x(), arg, width(), height()));
+ else
+ d->positionAutomatic = false;
}
/*!
diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp
index faa1ff8068..e7abff9ccc 100644
--- a/src/gui/kernel/qwindowsysteminterface.cpp
+++ b/src/gui/kernel/qwindowsysteminterface.cpp
@@ -41,6 +41,7 @@
#include <qpa/qplatformintegration.h>
#include <qdebug.h>
#include "qhighdpiscaling_p.h"
+#include <QtCore/qscopedvaluerollback.h>
QT_BEGIN_NAMESPACE
@@ -191,113 +192,50 @@ void QWindowSystemInterface::handleFrameStrutMouseEvent(QWindow *w, ulong timest
QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
}
-bool QWindowSystemInterface::tryHandleShortcutEvent(QWindow *w, int k, Qt::KeyboardModifiers mods,
- const QString & text, bool autorep, ushort count)
-{
- unsigned long timestamp = QWindowSystemInterfacePrivate::eventTime.elapsed();
- return tryHandleShortcutEvent(w, timestamp, k, mods, text, autorep, count);
-}
-
-bool QWindowSystemInterface::tryHandleShortcutEvent(QWindow *w, ulong timestamp, int k, Qt::KeyboardModifiers mods,
- const QString & text, bool autorep, ushort count)
-{
-#ifndef QT_NO_SHORTCUT
- QGuiApplicationPrivate::modifier_buttons = mods;
-
- if (!w)
- w = QGuiApplication::focusWindow();
- if (!w)
- return false;
-
- QObject *focus = w->focusObject();
- if (!focus)
- focus = w;
-
- QKeyEvent qevent(QEvent::ShortcutOverride, k, mods, text, autorep, count);
- qevent.setTimestamp(timestamp);
- return QGuiApplicationPrivate::instance()->shortcutMap.tryShortcutEvent(focus, &qevent);
-#else
- Q_UNUSED(w)
- Q_UNUSED(timestamp)
- Q_UNUSED(k)
- Q_UNUSED(mods)
- Q_UNUSED(text)
- Q_UNUSED(autorep)
- Q_UNUSED(count)
- return false;
-#endif
-}
-
-bool QWindowSystemInterface::tryHandleShortcutOverrideEvent(QWindow *w, QKeyEvent *ev)
-{
-#ifndef QT_NO_SHORTCUT
- Q_ASSERT(ev->type() == QKeyEvent::ShortcutOverride);
-
- QObject *focus = w->focusObject();
- if (!focus)
- focus = w;
- return QGuiApplicationPrivate::instance()->shortcutMap.tryShortcutEvent(focus, ev);
-#else
- Q_UNUSED(w)
- Q_UNUSED(ev)
- return false;
-#endif
-}
-
-// used by QTestLib to directly send shortcuts to objects
-bool QWindowSystemInterface::tryHandleShortcutEventToObject(QObject *o, ulong timestamp, int k, Qt::KeyboardModifiers mods,
- const QString &text, bool autorep, ushort count)
+bool QWindowSystemInterface::handleShortcutEvent(QWindow *window, ulong timestamp, int keyCode, Qt::KeyboardModifiers modifiers, quint32 nativeScanCode,
+ quint32 nativeVirtualKey, quint32 nativeModifiers, const QString &text, bool autorepeat, ushort count)
{
#ifndef QT_NO_SHORTCUT
- QGuiApplicationPrivate::modifier_buttons = mods;
-
- QKeyEvent qevent(QEvent::ShortcutOverride, k, mods, text, autorep, count);
- qevent.setTimestamp(timestamp);
- return QGuiApplicationPrivate::instance()->shortcutMap.tryShortcutEvent(o, &qevent);
-#else
- Q_UNUSED(w)
- Q_UNUSED(timestamp)
- Q_UNUSED(k)
- Q_UNUSED(mods)
- Q_UNUSED(text)
- Q_UNUSED(autorep)
- Q_UNUSED(count)
- return false;
-#endif
-}
-
-bool QWindowSystemInterface::tryHandleExtendedShortcutEvent(QWindow *w, int k, Qt::KeyboardModifiers mods,
- quint32 nativeScanCode, quint32 nativeVirtualKey, quint32 nativeModifiers,
- const QString &text, bool autorep, ushort count)
-{
- unsigned long timestamp = QWindowSystemInterfacePrivate::eventTime.elapsed();
- return tryHandleExtendedShortcutEvent(w, timestamp, k, mods, nativeScanCode, nativeVirtualKey, nativeModifiers, text, autorep, count);
-}
-
-bool QWindowSystemInterface::tryHandleExtendedShortcutEvent(QWindow *w, ulong timestamp, int k, Qt::KeyboardModifiers mods,
- quint32 nativeScanCode, quint32 nativeVirtualKey, quint32 nativeModifiers,
- const QString &text, bool autorep, ushort count)
-{
-#ifndef QT_NO_SHORTCUT
- QGuiApplicationPrivate::modifier_buttons = mods;
+ if (!window)
+ window = QGuiApplication::focusWindow();
+
+ QShortcutMap &shortcutMap = QGuiApplicationPrivate::instance()->shortcutMap;
+ if (shortcutMap.state() == QKeySequence::NoMatch) {
+ // Check if the shortcut is overridden by some object in the event delivery path (typically the focus object).
+ // If so, we should not look up the shortcut in the shortcut map, but instead deliver the event as a regular
+ // key event, so that the target that accepted the shortcut override event can handle it. Note that we only
+ // do this if the shortcut map hasn't found a partial shortcut match yet. If it has, the shortcut can not be
+ // overridden.
+ QWindowSystemInterfacePrivate::KeyEvent *shortcutOverrideEvent = new QWindowSystemInterfacePrivate::KeyEvent(window, timestamp,
+ QEvent::ShortcutOverride, keyCode, modifiers, nativeScanCode, nativeVirtualKey, nativeModifiers, text, autorepeat, count);
+
+ {
+ // FIXME: Template handleWindowSystemEvent to support both sync and async delivery
+ QScopedValueRollback<bool> syncRollback(QWindowSystemInterfacePrivate::synchronousWindowSystemEvents);
+ QWindowSystemInterfacePrivate::synchronousWindowSystemEvents = true;
+
+ if (QWindowSystemInterfacePrivate::handleWindowSystemEvent(shortcutOverrideEvent))
+ return false;
+ }
+ }
- QObject *focus = w->focusObject();
- if (!focus)
- focus = w;
+ // The shortcut event is dispatched as a QShortcutEvent, not a QKeyEvent, but we use
+ // the QKeyEvent as a container for the various properties that the shortcut map needs
+ // to inspect to determine if a shortcut matched the keys that were pressed.
+ QKeyEvent keyEvent(QEvent::ShortcutOverride, keyCode, modifiers, nativeScanCode,
+ nativeVirtualKey, nativeModifiers, text, autorepeat, count);
- QKeyEvent qevent(QEvent::ShortcutOverride, k, mods, nativeScanCode, nativeVirtualKey, nativeModifiers, text, autorep, count);
- qevent.setTimestamp(timestamp);
- return QGuiApplicationPrivate::instance()->shortcutMap.tryShortcutEvent(focus, &qevent);
+ return shortcutMap.tryShortcut(&keyEvent);
#else
- Q_UNUSED(w)
+ Q_UNUSED(window)
Q_UNUSED(timestamp)
- Q_UNUSED(k)
- Q_UNUSED(mods)
+ Q_UNUSED(key)
+ Q_UNUSED(modifiers)
Q_UNUSED(nativeScanCode)
Q_UNUSED(nativeVirtualKey)
Q_UNUSED(nativeModifiers)
Q_UNUSED(text)
- Q_UNUSED(autorep)
+ Q_UNUSED(autorepeat)
Q_UNUSED(count)
return false;
#endif
@@ -311,13 +249,8 @@ bool QWindowSystemInterface::handleKeyEvent(QWindow *w, QEvent::Type t, int k, Q
bool QWindowSystemInterface::handleKeyEvent(QWindow *tlw, ulong timestamp, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text, bool autorep, ushort count)
{
- // This is special handling needed for OS X which eventually will call sendEvent(), on other platforms
- // this might not be safe, e.g., on Android. See: QGuiApplicationPrivate::processKeyEvent() for
- // shortcut overriding on other platforms.
-#if defined(Q_OS_OSX)
- if (t == QEvent::KeyPress && QWindowSystemInterface::tryHandleShortcutEvent(tlw, timestamp, k, mods, text))
+ if (t == QEvent::KeyPress && QWindowSystemInterface::handleShortcutEvent(tlw, timestamp, k, mods, 0, 0, 0, text, autorep, count))
return true;
-#endif // Q_OS_OSX
QWindowSystemInterfacePrivate::KeyEvent * e =
new QWindowSystemInterfacePrivate::KeyEvent(tlw, timestamp, t, k, mods, text, autorep, count);
@@ -342,7 +275,9 @@ bool QWindowSystemInterface::handleExtendedKeyEvent(QWindow *tlw, ulong timestam
const QString& text, bool autorep,
ushort count, bool tryShortcutOverride)
{
- Q_UNUSED(tryShortcutOverride)
+ if (tryShortcutOverride && type == QEvent::KeyPress && QWindowSystemInterface::handleShortcutEvent(tlw, timestamp, key, modifiers, 0, 0, 0, text, autorep, count))
+ return true;
+
QWindowSystemInterfacePrivate::KeyEvent * e =
new QWindowSystemInterfacePrivate::KeyEvent(tlw, timestamp, type, key, modifiers,
nativeScanCode, nativeVirtualKey, nativeModifiers, text, autorep, count);
@@ -925,9 +860,41 @@ Q_GUI_EXPORT void qt_handleKeyEvent(QWindow *w, QEvent::Type t, int k, Qt::Keybo
QWindowSystemInterface::setSynchronousWindowSystemEvents(wasSynchronous);
}
-Q_GUI_EXPORT bool qt_sendShortcutOverrideEvent(QObject *o, ulong timestamp, int k, Qt::KeyboardModifiers mods, const QString &text = QString(), bool autorep = false, ushort count = 1)
+Q_GUI_EXPORT bool qt_handleShortcutEvent(QObject *o, ulong timestamp, int k, Qt::KeyboardModifiers mods, const QString &text = QString(), bool autorep = false, ushort count = 1)
{
- return QWindowSystemInterface::tryHandleShortcutEventToObject(o, timestamp, k, mods, text, autorep, count);
+#ifndef QT_NO_SHORTCUT
+
+ // FIXME: This method should not allow targeting a specific object, but should
+ // instead forward the event to a window, which then takes care of normal event
+ // propagation. We need to fix a lot of tests before we can refactor this (the
+ // window needs to be exposed and active and have a focus object), so we leave
+ // it as is for now. See QTBUG-48577.
+
+ QGuiApplicationPrivate::modifier_buttons = mods;
+
+ QKeyEvent qevent(QEvent::ShortcutOverride, k, mods, text, autorep, count);
+ qevent.setTimestamp(timestamp);
+
+ QShortcutMap &shortcutMap = QGuiApplicationPrivate::instance()->shortcutMap;
+ if (shortcutMap.state() == QKeySequence::NoMatch) {
+ // Try sending as QKeyEvent::ShortcutOverride first
+ QCoreApplication::sendEvent(o, &qevent);
+ if (qevent.isAccepted())
+ return false;
+ }
+
+ // Then as QShortcutEvent
+ return shortcutMap.tryShortcut(&qevent);
+#else
+ Q_UNUSED(o)
+ Q_UNUSED(timestamp)
+ Q_UNUSED(k)
+ Q_UNUSED(mods)
+ Q_UNUSED(text)
+ Q_UNUSED(autorep)
+ Q_UNUSED(count)
+ return false;
+#endif
}
static QWindowSystemInterface::TouchPoint touchPoint(const QTouchEvent::TouchPoint& pt)
diff --git a/src/gui/kernel/qwindowsysteminterface.h b/src/gui/kernel/qwindowsysteminterface.h
index 97bd087b53..387c1e00b9 100644
--- a/src/gui/kernel/qwindowsysteminterface.h
+++ b/src/gui/kernel/qwindowsysteminterface.h
@@ -78,22 +78,8 @@ public:
Qt::KeyboardModifiers mods = Qt::NoModifier,
Qt::MouseEventSource source = Qt::MouseEventNotSynthesized);
- static bool tryHandleShortcutOverrideEvent(QWindow *w, QKeyEvent *ev);
-
- static bool tryHandleShortcutEvent(QWindow *w, int k, Qt::KeyboardModifiers mods,
- const QString & text = QString(), bool autorep = false, ushort count = 1);
- static bool tryHandleShortcutEvent(QWindow *w, ulong timestamp, int k, Qt::KeyboardModifiers mods,
- const QString & text = QString(), bool autorep = false, ushort count = 1);
-
- static bool tryHandleShortcutEventToObject(QObject *o, ulong timestamp, int k, Qt::KeyboardModifiers mods,
- const QString & text = QString(), bool autorep = false, ushort count = 1);
-
- static bool tryHandleExtendedShortcutEvent(QWindow *w, int k, Qt::KeyboardModifiers mods,
- quint32 nativeScanCode, quint32 nativeVirtualKey, quint32 nativeModifiers,
- const QString & text = QString(), bool autorep = false, ushort count = 1);
- static bool tryHandleExtendedShortcutEvent(QWindow *w, ulong timestamp, int k, Qt::KeyboardModifiers mods,
- quint32 nativeScanCode, quint32 nativeVirtualKey, quint32 nativeModifiers,
- const QString & text = QString(), bool autorep = false, ushort count = 1);
+ static bool handleShortcutEvent(QWindow *w, ulong timestamp, int k, Qt::KeyboardModifiers mods, quint32 nativeScanCode,
+ quint32 nativeVirtualKey, quint32 nativeModifiers, const QString & text = QString(), bool autorep = false, ushort count = 1);
static bool handleKeyEvent(QWindow *w, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1);
static bool handleKeyEvent(QWindow *w, ulong timestamp, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1);
diff --git a/src/gui/math3d/qmatrix4x4.cpp b/src/gui/math3d/qmatrix4x4.cpp
index eb7c7f4b7a..9d363dc895 100644
--- a/src/gui/math3d/qmatrix4x4.cpp
+++ b/src/gui/math3d/qmatrix4x4.cpp
@@ -148,8 +148,6 @@ QMatrix4x4::QMatrix4x4(const float *values)
top-most 4 rows of \a matrix. If \a matrix has less than 4 columns
or rows, the remaining elements are filled with elements from the
identity matrix.
-
- \sa QMatrix4x4(const QGenericMatrix &)
*/
/*!
diff --git a/src/gui/opengl/qopenglframebufferobject.cpp b/src/gui/opengl/qopenglframebufferobject.cpp
index 0e162713ce..e0ef7c52a5 100644
--- a/src/gui/opengl/qopenglframebufferobject.cpp
+++ b/src/gui/opengl/qopenglframebufferobject.cpp
@@ -43,6 +43,7 @@
#include <qwindow.h>
#include <qlibrary.h>
#include <qimage.h>
+#include <QtCore/qbytearray.h>
QT_BEGIN_NAMESPACE
@@ -1275,9 +1276,19 @@ static inline QImage qt_gl_read_framebuffer_rgba8(const QSize &size, bool includ
#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
// Without GL_UNSIGNED_INT_8_8_8_8_REV, GL_BGRA only makes sense on little endian.
- const bool supports_bgra = context->isOpenGLES()
- ? context->hasExtension(QByteArrayLiteral("GL_EXT_read_format_bgra"))
- : context->hasExtension(QByteArrayLiteral("GL_EXT_bgra"));
+ const bool has_bgra_ext = context->isOpenGLES()
+ ? context->hasExtension(QByteArrayLiteral("GL_EXT_read_format_bgra"))
+ : context->hasExtension(QByteArrayLiteral("GL_EXT_bgra"));
+
+ const char *renderer = reinterpret_cast<const char *>(funcs->glGetString(GL_RENDERER));
+ const char *ver = reinterpret_cast<const char *>(funcs->glGetString(GL_VERSION));
+
+ // Blacklist PowerVR Rogue G6200 as it has problems with its BGRA support.
+ const bool blackListed = (qstrcmp(renderer, "PowerVR Rogue G6200") == 0
+ && ::strstr(ver, "1.3") != 0);
+
+ const bool supports_bgra = has_bgra_ext && !blackListed;
+
if (supports_bgra) {
QImage img(size, include_alpha ? QImage::Format_ARGB32_Premultiplied : QImage::Format_RGB32);
funcs->glReadPixels(0, 0, w, h, GL_BGRA, GL_UNSIGNED_BYTE, img.bits());
diff --git a/src/gui/painting/qcosmeticstroker.cpp b/src/gui/painting/qcosmeticstroker.cpp
index 61d57ca3f8..8c3fd2ce4f 100644
--- a/src/gui/painting/qcosmeticstroker.cpp
+++ b/src/gui/painting/qcosmeticstroker.cpp
@@ -720,10 +720,11 @@ static inline void capAdjust(int caps, int &x1, int &x2, int &y, int yinc)
template<DrawPixel drawPixel, class Dasher>
static bool drawLine(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx2, qreal ry2, int caps)
{
+ bool didDraw = qAbs(rx2 - rx1) + qAbs(ry2 - ry1) >= 1.0;
+
if (stroker->clipLine(rx1, ry1, rx2, ry2))
return true;
- bool didDraw = false;
const int half = stroker->legacyRounding ? 31 : 0;
int x1 = toF26Dot6(rx1) + half;
int y1 = toF26Dot6(ry1) + half;
diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp
index 0814e0494d..0f81f09f60 100644
--- a/src/gui/painting/qpdf.cpp
+++ b/src/gui/painting/qpdf.cpp
@@ -1793,7 +1793,7 @@ void QPdfEnginePrivate::printString(const QString &string) {
array.append(part[j]);
}
}
- array.append(")");
+ array.append(')');
write(array);
}
diff --git a/src/gui/painting/qpdfwriter.cpp b/src/gui/painting/qpdfwriter.cpp
index ca411ebe08..a8c1d8297c 100644
--- a/src/gui/painting/qpdfwriter.cpp
+++ b/src/gui/painting/qpdfwriter.cpp
@@ -151,7 +151,8 @@ QPdfWriter::QPdfWriter(const QString &filename)
Constructs a PDF writer that will write the pdf to \a device.
*/
QPdfWriter::QPdfWriter(QIODevice *device)
- : QObject(*new QPdfWriterPrivate)
+ : QObject(*new QPdfWriterPrivate),
+ QPagedPaintDevice(new QPdfPagedPaintDevicePrivate(d_func()))
{
Q_D(QPdfWriter);
diff --git a/src/gui/painting/qrgba64_p.h b/src/gui/painting/qrgba64_p.h
index c6cbe666ac..724658ad94 100644
--- a/src/gui/painting/qrgba64_p.h
+++ b/src/gui/painting/qrgba64_p.h
@@ -34,6 +34,17 @@
#ifndef QRGBA64_P_H
#define QRGBA64_P_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include <QtGui/qrgba64.h>
#include <QtGui/private/qdrawhelper_p.h>
#include <private/qsimd_p.h>
diff --git a/src/gui/painting/qtextureglyphcache.cpp b/src/gui/painting/qtextureglyphcache.cpp
index 44e14f656d..97f82d16d3 100644
--- a/src/gui/painting/qtextureglyphcache.cpp
+++ b/src/gui/painting/qtextureglyphcache.cpp
@@ -286,9 +286,9 @@ void QImageTextureGlyphCache::createTextureData(int width, int height)
case QFontEngine::Format_Mono:
m_image = QImage(width, height, QImage::Format_Mono);
break;
- case QFontEngine::Format_A8: {
+ case QFontEngine::Format_A8:
m_image = QImage(width, height, QImage::Format_Alpha8);
- break; }
+ break;
case QFontEngine::Format_A32:
m_image = QImage(width, height, QImage::Format_RGB32);
break;
diff --git a/src/gui/text/qtextengine_p.h b/src/gui/text/qtextengine_p.h
index 160daa0cfd..dbe8e1ee2b 100644
--- a/src/gui/text/qtextengine_p.h
+++ b/src/gui/text/qtextengine_p.h
@@ -367,8 +367,7 @@ struct Q_AUTOTEST_EXPORT QScriptLine
uint leadingIncluded : 1;
QFixed height() const { return ascent + descent
+ (leadingIncluded? qMax(QFixed(),leading) : QFixed()); }
- QFixed base() const { return ascent
- + (leadingIncluded ? qMax(QFixed(),leading) : QFixed()); }
+ QFixed base() const { return ascent; }
void setDefaultHeight(QTextEngine *eng);
void operator+=(const QScriptLine &other);
};
diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp
index c2d986ef3d..c4cb8e65c0 100644
--- a/src/network/access/qhttpnetworkconnection.cpp
+++ b/src/network/access/qhttpnetworkconnection.cpp
@@ -326,7 +326,7 @@ void QHttpNetworkConnectionPrivate::prepareRequest(HttpMessagePair &messagePair)
QByteArray host;
if (add.setAddress(hostName)) {
if (add.protocol() == QAbstractSocket::IPv6Protocol)
- host = "[" + hostName.toLatin1() + "]";//format the ipv6 in the standard way
+ host = '[' + hostName.toLatin1() + ']'; //format the ipv6 in the standard way
else
host = hostName.toLatin1();
@@ -888,8 +888,13 @@ void QHttpNetworkConnectionPrivate::removeReply(QHttpNetworkReply *reply)
// if HTTP mandates we should close
// or the reply is not finished yet, e.g. it was aborted
// we have to close that connection
- if (reply->d_func()->isConnectionCloseEnabled() || !reply->isFinished())
- channels[i].close();
+ if (reply->d_func()->isConnectionCloseEnabled() || !reply->isFinished()) {
+ if (reply->isAborted()) {
+ channels[i].abort();
+ } else {
+ channels[i].close();
+ }
+ }
QMetaObject::invokeMethod(q, "_q_startNextRequest", Qt::QueuedConnection);
return;
diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp
index 8980ed7a41..b4eda3477e 100644
--- a/src/network/access/qhttpnetworkconnectionchannel.cpp
+++ b/src/network/access/qhttpnetworkconnectionchannel.cpp
@@ -205,6 +205,26 @@ void QHttpNetworkConnectionChannel::close()
}
+void QHttpNetworkConnectionChannel::abort()
+{
+ if (!socket)
+ state = QHttpNetworkConnectionChannel::IdleState;
+ else if (socket->state() == QAbstractSocket::UnconnectedState)
+ state = QHttpNetworkConnectionChannel::IdleState;
+ else
+ state = QHttpNetworkConnectionChannel::ClosingState;
+
+ // pendingEncrypt must only be true in between connected and encrypted states
+ pendingEncrypt = false;
+
+ if (socket) {
+ // socket can be 0 since the host lookup is done from qhttpnetworkconnection.cpp while
+ // there is no socket yet.
+ socket->abort();
+ }
+}
+
+
bool QHttpNetworkConnectionChannel::sendRequest()
{
Q_ASSERT(!protocolHandler.isNull());
@@ -252,7 +272,12 @@ bool QHttpNetworkConnectionChannel::ensureConnection()
QAbstractSocket::SocketState socketState = socket->state();
// resend this request after we receive the disconnected signal
- if (socketState == QAbstractSocket::ClosingState) {
+ // If !socket->isOpen() then we have already called close() on the socket, but there was still a
+ // pending connectToHost() for which we hadn't seen a connected() signal, yet. The connected()
+ // has now arrived (as indicated by socketState != ClosingState), but we cannot send anything on
+ // such a socket anymore.
+ if (socketState == QAbstractSocket::ClosingState ||
+ (socketState != QAbstractSocket::UnconnectedState && !socket->isOpen())) {
if (reply)
resendCurrent = true;
return false;
@@ -1080,6 +1105,8 @@ void QHttpNetworkConnectionChannel::_q_sslErrors(const QList<QSslError> &errors)
connection->d_func()->pauseConnection();
if (pendingEncrypt && !reply)
connection->d_func()->dequeueRequest(socket);
+ if (reply) // a reply was actually dequeued.
+ reply->d_func()->connectionChannel = this; // set correct channel like in sendRequest() and queueRequest();
if (connection->connectionType() == QHttpNetworkConnection::ConnectionTypeHTTP) {
if (reply)
emit reply->sslErrors(errors);
diff --git a/src/network/access/qhttpnetworkconnectionchannel_p.h b/src/network/access/qhttpnetworkconnectionchannel_p.h
index 37ad6c9b0a..87329b7397 100644
--- a/src/network/access/qhttpnetworkconnectionchannel_p.h
+++ b/src/network/access/qhttpnetworkconnectionchannel_p.h
@@ -157,6 +157,7 @@ public:
void init();
void close();
+ void abort();
bool sendRequest();
diff --git a/src/network/access/qhttpnetworkreply.cpp b/src/network/access/qhttpnetworkreply.cpp
index dd108ad5c7..a0f05523e3 100644
--- a/src/network/access/qhttpnetworkreply.cpp
+++ b/src/network/access/qhttpnetworkreply.cpp
@@ -264,6 +264,17 @@ char* QHttpNetworkReply::userProvidedDownloadBuffer()
return d->userProvidedDownloadBuffer;
}
+void QHttpNetworkReply::abort()
+{
+ Q_D(QHttpNetworkReply);
+ d->state = QHttpNetworkReplyPrivate::Aborted;
+}
+
+bool QHttpNetworkReply::isAborted() const
+{
+ return d_func()->state == QHttpNetworkReplyPrivate::Aborted;
+}
+
bool QHttpNetworkReply::isFinished() const
{
return d_func()->state == QHttpNetworkReplyPrivate::AllDoneState;
diff --git a/src/network/access/qhttpnetworkreply_p.h b/src/network/access/qhttpnetworkreply_p.h
index 6e81663500..e8ed73fdac 100644
--- a/src/network/access/qhttpnetworkreply_p.h
+++ b/src/network/access/qhttpnetworkreply_p.h
@@ -121,6 +121,9 @@ public:
void setUserProvidedDownloadBuffer(char*);
char* userProvidedDownloadBuffer();
+ void abort();
+
+ bool isAborted() const;
bool isFinished() const;
bool isPipeliningUsed() const;
@@ -214,7 +217,8 @@ public:
SPDYSYNSent,
SPDYUploading,
SPDYHalfClosed,
- SPDYClosed
+ SPDYClosed,
+ Aborted
} state;
QHttpNetworkRequest request;
diff --git a/src/network/access/qhttpthreaddelegate.cpp b/src/network/access/qhttpthreaddelegate.cpp
index 3fc4fa9dee..c07064fd94 100644
--- a/src/network/access/qhttpthreaddelegate.cpp
+++ b/src/network/access/qhttpthreaddelegate.cpp
@@ -396,6 +396,7 @@ void QHttpThreadDelegate::abortRequest()
qDebug() << "QHttpThreadDelegate::abortRequest() thread=" << QThread::currentThreadId() << "sync=" << synchronous;
#endif
if (httpReply) {
+ httpReply->abort();
delete httpReply;
httpReply = 0;
}
diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp
index e6fb1a09a0..086140f967 100644
--- a/src/network/access/qnetworkaccessmanager.cpp
+++ b/src/network/access/qnetworkaccessmanager.cpp
@@ -278,7 +278,8 @@ static void ensureInitialized()
\snippet code/src_network_access_qnetworkaccessmanager.cpp 4
- Network requests can be reenabled again by calling
+ Network requests can be re-enabled again, and this property will resume to
+ reflect the actual device state by calling
\snippet code/src_network_access_qnetworkaccessmanager.cpp 5
@@ -467,16 +468,12 @@ QNetworkAccessManager::QNetworkAccessManager(QObject *parent)
#ifndef QT_NO_BEARERMANAGEMENT
Q_D(QNetworkAccessManager);
- if (!d->networkSessionRequired) {
- // if a session is required, we track online state through
- // the QNetworkSession's signals
- connect(&d->networkConfigurationManager, SIGNAL(onlineStateChanged(bool)),
- SLOT(_q_onlineStateChanged(bool)));
- }
- // we would need all active configurations to check for
- // d->networkConfigurationManager.isOnline(), which is asynchronous
- // and potentially expensive. We can just check the configuration here
- d->online = (d->networkConfiguration.state() & QNetworkConfiguration::Active);
+ // if a session is required, we track online state through
+ // the QNetworkSession's signals if a request is already made.
+ // we need to track current accessibility state by default
+ //
+ connect(&d->networkConfigurationManager, SIGNAL(onlineStateChanged(bool)),
+ SLOT(_q_onlineStateChanged(bool)));
#endif
}
@@ -946,7 +943,8 @@ QNetworkConfiguration QNetworkAccessManager::activeConfiguration() const
void QNetworkAccessManager::setNetworkAccessible(QNetworkAccessManager::NetworkAccessibility accessible)
{
Q_D(QNetworkAccessManager);
- d->defaultAccessControl = false;
+
+ d->defaultAccessControl = accessible == NotAccessible ? false : true;
if (d->networkAccessible != accessible) {
NetworkAccessibility previous = networkAccessible();
@@ -965,6 +963,10 @@ void QNetworkAccessManager::setNetworkAccessible(QNetworkAccessManager::NetworkA
QNetworkAccessManager::NetworkAccessibility QNetworkAccessManager::networkAccessible() const
{
Q_D(const QNetworkAccessManager);
+
+ if (d->networkConfiguration.state().testFlag(QNetworkConfiguration::Undefined))
+ return UnknownAccessibility;
+
if (d->networkSessionRequired) {
QSharedPointer<QNetworkSession> networkSession(d->getNetworkSession());
if (networkSession) {
@@ -1622,32 +1624,56 @@ void QNetworkAccessManagerPrivate::_q_networkSessionStateChanged(QNetworkSession
if (online) {
if (state != QNetworkSession::Connected && state != QNetworkSession::Roaming) {
online = false;
- networkAccessible = QNetworkAccessManager::NotAccessible;
- emit q->networkAccessibleChanged(networkAccessible);
+ if (networkAccessible != QNetworkAccessManager::NotAccessible) {
+ networkAccessible = QNetworkAccessManager::NotAccessible;
+ emit q->networkAccessibleChanged(networkAccessible);
+ }
}
} else {
if (state == QNetworkSession::Connected || state == QNetworkSession::Roaming) {
online = true;
if (defaultAccessControl)
- networkAccessible = QNetworkAccessManager::Accessible;
- emit q->networkAccessibleChanged(networkAccessible);
+ if (networkAccessible != QNetworkAccessManager::Accessible) {
+ networkAccessible = QNetworkAccessManager::Accessible;
+ emit q->networkAccessibleChanged(networkAccessible);
+ }
}
}
}
void QNetworkAccessManagerPrivate::_q_onlineStateChanged(bool isOnline)
{
- // if the user set a config, we only care whether this one is active.
+ Q_Q(QNetworkAccessManager);
+ // if the user set a config, we only care whether this one is active.
// Otherwise, this QNAM is online if there is an online config.
if (customNetworkConfiguration) {
online = (networkConfiguration.state() & QNetworkConfiguration::Active);
} else {
- if (isOnline && online != isOnline) {
- networkSessionStrongRef.clear();
- networkSessionWeakRef.clear();
+ if (online != isOnline) {
+ if (isOnline) {
+ networkSessionStrongRef.clear();
+ networkSessionWeakRef.clear();
+ }
+ online = isOnline;
+ }
+ }
+ if (online) {
+ if (defaultAccessControl) {
+ if (networkAccessible != QNetworkAccessManager::Accessible) {
+ networkAccessible = QNetworkAccessManager::Accessible;
+ emit q->networkAccessibleChanged(networkAccessible);
+ }
+ }
+ } else if (networkConfiguration.state().testFlag(QNetworkConfiguration::Undefined)) {
+ if (networkAccessible != QNetworkAccessManager::UnknownAccessibility) {
+ networkAccessible = QNetworkAccessManager::UnknownAccessibility;
+ emit q->networkAccessibleChanged(networkAccessible);
+ }
+ } else {
+ if (networkAccessible != QNetworkAccessManager::NotAccessible) {
+ networkAccessible = QNetworkAccessManager::NotAccessible;
+ emit q->networkAccessibleChanged(networkAccessible);
}
-
- online = isOnline;
}
}
@@ -1678,7 +1704,7 @@ QNetworkRequest QNetworkAccessManagerPrivate::prepareMultipart(const QNetworkReq
break;
}
// putting the boundary into quotes, recommended in RFC 2046 section 5.1.1
- contentType += "; boundary=\"" + multiPart->d_func()->boundary + "\"";
+ contentType += "; boundary=\"" + multiPart->d_func()->boundary + '"';
newRequest.setHeader(QNetworkRequest::ContentTypeHeader, QVariant(contentType));
}
diff --git a/src/network/access/qnetworkaccessmanager_p.h b/src/network/access/qnetworkaccessmanager_p.h
index c715da00c1..54ae114581 100644
--- a/src/network/access/qnetworkaccessmanager_p.h
+++ b/src/network/access/qnetworkaccessmanager_p.h
@@ -78,7 +78,6 @@ public:
customNetworkConfiguration(false),
networkSessionRequired(networkConfigurationManager.capabilities()
& QNetworkConfigurationManager::NetworkSessionRequired),
- networkAccessible(QNetworkAccessManager::Accessible),
activeReplyCount(0),
online(false),
initializeSession(true),
@@ -86,7 +85,18 @@ public:
cookieJarCreated(false),
defaultAccessControl(true),
authenticationManager(QSharedPointer<QNetworkAccessAuthenticationManager>::create())
- { }
+ {
+#ifndef QT_NO_BEARERMANAGEMENT
+ // we would need all active configurations to check for
+ // d->networkConfigurationManager.isOnline(), which is asynchronous
+ // and potentially expensive. We can just check the configuration here
+ online = (networkConfiguration.state().testFlag(QNetworkConfiguration::Active));
+ if (online)
+ networkAccessible = QNetworkAccessManager::Accessible;
+ else
+ networkAccessible = QNetworkAccessManager::NotAccessible;
+#endif
+ }
~QNetworkAccessManagerPrivate();
void _q_replyFinished();
diff --git a/src/network/access/qnetworkreplyhttpimpl.cpp b/src/network/access/qnetworkreplyhttpimpl.cpp
index 8c0c098147..63fca2bda2 100644
--- a/src/network/access/qnetworkreplyhttpimpl.cpp
+++ b/src/network/access/qnetworkreplyhttpimpl.cpp
@@ -1238,7 +1238,7 @@ void QNetworkReplyHttpImplPrivate::replyDownloadMetaData
if (statusCode == 304) {
#if defined(QNETWORKACCESSHTTPBACKEND_DEBUG)
- qDebug() << "Received a 304 from" << url();
+ qDebug() << "Received a 304 from" << request.url();
#endif
QAbstractNetworkCache *nc = managerPrivate->networkCache;
if (nc) {
@@ -1562,7 +1562,7 @@ QNetworkCacheMetaData QNetworkReplyHttpImplPrivate::fetchCacheMetaData(const QNe
}
#if defined(QNETWORKACCESSHTTPBACKEND_DEBUG)
- QByteArray n = rawHeader(header);
+ QByteArray n = q->rawHeader(header);
QByteArray o;
if (it != cacheHeaders.rawHeaders.constEnd())
o = (*it).second;
@@ -1782,6 +1782,11 @@ void QNetworkReplyHttpImplPrivate::_q_startOperation()
QMetaObject::invokeMethod(q, "_q_finished", synchronous ? Qt::DirectConnection : Qt::QueuedConnection);
return;
#endif
+ } else {
+#ifndef QT_NO_BEARERMANAGEMENT
+ QObject::connect(session.data(), SIGNAL(stateChanged(QNetworkSession::State)),
+ q, SLOT(_q_networkSessionStateChanged(QNetworkSession::State)), Qt::QueuedConnection);
+#endif
}
if (synchronous) {
@@ -1950,6 +1955,16 @@ void QNetworkReplyHttpImplPrivate::_q_networkSessionConnected()
}
}
+void QNetworkReplyHttpImplPrivate::_q_networkSessionStateChanged(QNetworkSession::State sessionState)
+{
+ if (sessionState == QNetworkSession::Disconnected
+ && (state != Idle || state != Reconnecting)) {
+ error(QNetworkReplyImpl::NetworkSessionFailedError,
+ QCoreApplication::translate("QNetworkReply", "Network session error."));
+ finished();
+ }
+}
+
void QNetworkReplyHttpImplPrivate::_q_networkSessionFailed()
{
// Abort waiting and working replies.
diff --git a/src/network/access/qnetworkreplyhttpimpl_p.h b/src/network/access/qnetworkreplyhttpimpl_p.h
index fff88f8f2d..44d51d82a4 100644
--- a/src/network/access/qnetworkreplyhttpimpl_p.h
+++ b/src/network/access/qnetworkreplyhttpimpl_p.h
@@ -96,6 +96,7 @@ public:
#ifndef QT_NO_BEARERMANAGEMENT
Q_PRIVATE_SLOT(d_func(), void _q_networkSessionConnected())
Q_PRIVATE_SLOT(d_func(), void _q_networkSessionFailed())
+ Q_PRIVATE_SLOT(d_func(), void _q_networkSessionStateChanged(QNetworkSession::State))
Q_PRIVATE_SLOT(d_func(), void _q_networkSessionUsagePoliciesChanged(QNetworkSession::UsagePolicies))
#endif
Q_PRIVATE_SLOT(d_func(), void _q_finished())
@@ -171,6 +172,7 @@ public:
#ifndef QT_NO_BEARERMANAGEMENT
void _q_networkSessionConnected();
void _q_networkSessionFailed();
+ void _q_networkSessionStateChanged(QNetworkSession::State);
void _q_networkSessionUsagePoliciesChanged(QNetworkSession::UsagePolicies);
#endif
void _q_finished();
diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp
index a73e0ea75e..c73e6162d1 100644
--- a/src/network/access/qnetworkreplyimpl.cpp
+++ b/src/network/access/qnetworkreplyimpl.cpp
@@ -125,6 +125,11 @@ void QNetworkReplyImplPrivate::_q_startOperation()
finished();
#endif
return;
+ } else {
+#ifndef QT_NO_BEARERMANAGEMENT
+ QObject::connect(session.data(), SIGNAL(stateChanged(QNetworkSession::State)),
+ q, SLOT(_q_networkSessionStateChanged(QNetworkSession::State)), Qt::QueuedConnection);
+#endif
}
#ifndef QT_NO_BEARERMANAGEMENT
@@ -309,6 +314,16 @@ void QNetworkReplyImplPrivate::_q_networkSessionConnected()
}
}
+void QNetworkReplyImplPrivate::_q_networkSessionStateChanged(QNetworkSession::State sessionState)
+{
+ if (sessionState == QNetworkSession::Disconnected
+ && (state != Idle || state != Reconnecting)) {
+ error(QNetworkReplyImpl::NetworkSessionFailedError,
+ QCoreApplication::translate("QNetworkReply", "Network session error."));
+ finished();
+ }
+}
+
void QNetworkReplyImplPrivate::_q_networkSessionFailed()
{
// Abort waiting and working replies.
diff --git a/src/network/access/qnetworkreplyimpl_p.h b/src/network/access/qnetworkreplyimpl_p.h
index 3e720ef597..209bf40b72 100644
--- a/src/network/access/qnetworkreplyimpl_p.h
+++ b/src/network/access/qnetworkreplyimpl_p.h
@@ -89,6 +89,7 @@ public:
#ifndef QT_NO_BEARERMANAGEMENT
Q_PRIVATE_SLOT(d_func(), void _q_networkSessionConnected())
Q_PRIVATE_SLOT(d_func(), void _q_networkSessionFailed())
+ Q_PRIVATE_SLOT(d_func(), void _q_networkSessionStateChanged(QNetworkSession::State))
Q_PRIVATE_SLOT(d_func(), void _q_networkSessionUsagePoliciesChanged(QNetworkSession::UsagePolicies))
#endif
@@ -122,6 +123,7 @@ public:
#ifndef QT_NO_BEARERMANAGEMENT
void _q_networkSessionConnected();
void _q_networkSessionFailed();
+ void _q_networkSessionStateChanged(QNetworkSession::State);
void _q_networkSessionUsagePoliciesChanged(QNetworkSession::UsagePolicies);
#endif
diff --git a/src/network/doc/qtnetwork.qdocconf b/src/network/doc/qtnetwork.qdocconf
index 522d71fd27..2a8e577dda 100644
--- a/src/network/doc/qtnetwork.qdocconf
+++ b/src/network/doc/qtnetwork.qdocconf
@@ -26,7 +26,7 @@ qhp.QtNetwork.subprojects.classes.sortPages = true
tagfile = ../../../doc/qtnetwork/qtnetwork.tags
-depends += qtcore qtgui qtdoc
+depends += qtcore qtgui qtdoc qmake
headerdirs += ..
diff --git a/src/network/kernel/qauthenticator.cpp b/src/network/kernel/qauthenticator.cpp
index abb47e9e29..95994653e6 100644
--- a/src/network/kernel/qauthenticator.cpp
+++ b/src/network/kernel/qauthenticator.cpp
@@ -85,6 +85,7 @@ static QByteArray qNtlmPhase3_SSPI(QAuthenticatorPrivate *ctx, const QByteArray&
\li Digest-MD5
\endlist
+ \target qauthenticator-options
\section1 Options
In addition to the username and password required for authentication, a
@@ -104,8 +105,8 @@ static QByteArray qNtlmPhase3_SSPI(QAuthenticatorPrivate *ctx, const QByteArray&
\section2 Basic
\table
- \header \li Option \li Direction \li Description
- \row \li \tt{realm} \li Incoming \li Contains the realm of the authentication, the same as realm()
+ \header \li Option \li Direction \li Type \li Description
+ \row \li \tt{realm} \li Incoming \li QString \li Contains the realm of the authentication, the same as realm()
\endtable
The Basic authentication mechanism supports no outgoing options.
@@ -119,8 +120,8 @@ static QByteArray qNtlmPhase3_SSPI(QAuthenticatorPrivate *ctx, const QByteArray&
\section2 Digest-MD5
\table
- \header \li Option \li Direction \li Description
- \row \li \tt{realm} \li Incoming \li Contains the realm of the authentication, the same as realm()
+ \header \li Option \li Direction \li Type \li Description
+ \row \li \tt{realm} \li Incoming \li QString \li Contains the realm of the authentication, the same as realm()
\endtable
The Digest-MD5 authentication mechanism supports no outgoing options.
@@ -130,7 +131,7 @@ static QByteArray qNtlmPhase3_SSPI(QAuthenticatorPrivate *ctx, const QByteArray&
/*!
- Constructs an empty authentication object
+ Constructs an empty authentication object.
*/
QAuthenticator::QAuthenticator()
: d(0)
@@ -138,7 +139,7 @@ QAuthenticator::QAuthenticator()
}
/*!
- Destructs the object
+ Destructs the object.
*/
QAuthenticator::~QAuthenticator()
{
@@ -207,7 +208,7 @@ bool QAuthenticator::operator==(const QAuthenticator &other) const
*/
/*!
- returns the user used for authentication.
+ Returns the user used for authentication.
*/
QString QAuthenticator::user() const
{
@@ -227,7 +228,7 @@ void QAuthenticator::setUser(const QString &user)
}
/*!
- returns the password used for authentication.
+ Returns the password used for authentication.
*/
QString QAuthenticator::password() const
{
@@ -260,7 +261,7 @@ void QAuthenticator::detach()
}
/*!
- returns the realm requiring authentication.
+ Returns the realm requiring authentication.
*/
QString QAuthenticator::realm() const
{
@@ -279,10 +280,11 @@ void QAuthenticator::setRealm(const QString &realm)
/*!
\since 4.7
Returns the value related to option \a opt if it was set by the server.
- See \l{QAuthenticator#Options} for more information on incoming options.
+ See the \l{QAuthenticator#qauthenticator-options}{Options section} for
+ more information on incoming options.
If option \a opt isn't found, an invalid QVariant will be returned.
- \sa options(), QAuthenticator#Options
+ \sa options(), {QAuthenticator#qauthenticator-options}{QAuthenticator options}
*/
QVariant QAuthenticator::option(const QString &opt) const
{
@@ -292,10 +294,10 @@ QVariant QAuthenticator::option(const QString &opt) const
/*!
\since 4.7
Returns all incoming options set in this QAuthenticator object by parsing
- the server reply. See \l{QAuthenticator#Options} for more information
- on incoming options.
+ the server reply. See the \l{QAuthenticator#qauthenticator-options}{Options section}
+ for more information on incoming options.
- \sa option(), QAuthenticator#Options
+ \sa option(), {QAuthenticator#qauthenticator-options}{QAuthenticator options}
*/
QVariantHash QAuthenticator::options() const
{
@@ -306,9 +308,9 @@ QVariantHash QAuthenticator::options() const
\since 4.7
Sets the outgoing option \a opt to value \a value.
- See \l{QAuthenticator#Options} for more information on outgoing options.
+ See the \l{QAuthenticator#qauthenticator-options}{Options section} for more information on outgoing options.
- \sa options(), option(), QAuthenticator#Options
+ \sa options(), option(), {QAuthenticator#qauthenticator-options}{QAuthenticator options}
*/
void QAuthenticator::setOption(const QString &opt, const QVariant &value)
{
@@ -318,7 +320,10 @@ void QAuthenticator::setOption(const QString &opt, const QVariant &value)
/*!
- Returns \c true if the authenticator is null.
+ Returns \c true if the object has not been initialized. Returns
+ \c false if non-const member functions have been called, or
+ the content was constructed or copied from another initialized
+ QAuthenticator object.
*/
bool QAuthenticator::isNull() const
{
@@ -688,13 +693,13 @@ QByteArray QAuthenticatorPrivate::digestMd5Response(const QByteArray &challenge,
credentials += "uri=\"" + path + "\", ";
if (!opaque.isEmpty())
credentials += "opaque=\"" + opaque + "\", ";
- credentials += "response=\"" + response + '\"';
+ credentials += "response=\"" + response + '"';
if (!options.value("algorithm").isEmpty())
credentials += ", algorithm=" + options.value("algorithm");
if (!options.value("qop").isEmpty()) {
credentials += ", qop=" + qop + ", ";
credentials += "nc=" + nonceCountString + ", ";
- credentials += "cnonce=\"" + cnonce + '\"';
+ credentials += "cnonce=\"" + cnonce + '"';
}
return credentials;
diff --git a/src/network/kernel/qnetworkproxy.cpp b/src/network/kernel/qnetworkproxy.cpp
index d219d72136..4c7c0c5442 100644
--- a/src/network/kernel/qnetworkproxy.cpp
+++ b/src/network/kernel/qnetworkproxy.cpp
@@ -1605,7 +1605,7 @@ QDebug operator<<(QDebug debug, const QNetworkProxy &proxy)
debug << "Unknown proxy " << int(type);
break;
}
- debug << "\"" << proxy.hostName() << ":" << proxy.port() << "\" ";
+ debug << '"' << proxy.hostName() << ':' << proxy.port() << "\" ";
QNetworkProxy::Capabilities caps = proxy.capabilities();
QStringList scaps;
if (caps & QNetworkProxy::TunnelingCapability)
@@ -1618,7 +1618,7 @@ QDebug operator<<(QDebug debug, const QNetworkProxy &proxy)
scaps << QStringLiteral("Caching");
if (caps & QNetworkProxy::HostNameLookupCapability)
scaps << QStringLiteral("NameLookup");
- debug << "[" << scaps.join(QLatin1Char(' ')) << "]";
+ debug << '[' << scaps.join(QLatin1Char(' ')) << ']';
return debug;
}
#endif
diff --git a/src/network/kernel/qnetworkproxy_generic.cpp b/src/network/kernel/qnetworkproxy_generic.cpp
index d3295376da..145ba18e3f 100644
--- a/src/network/kernel/qnetworkproxy_generic.cpp
+++ b/src/network/kernel/qnetworkproxy_generic.cpp
@@ -58,7 +58,7 @@ static bool ignoreProxyFor(const QNetworkProxyQuery &query)
QString peerHostName = query.peerHostName();
// Since we use suffix matching, "*" is our 'default' behaviour
- if (token.startsWith("*"))
+ if (token.startsWith('*'))
token = token.mid(1);
// Harmonize trailing dot notation
diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp
index b2426f5c00..08ccff83fa 100644
--- a/src/network/socket/qabstractsocket.cpp
+++ b/src/network/socket/qabstractsocket.cpp
@@ -742,15 +742,9 @@ bool QAbstractSocketPrivate::canReadNotification()
return true;
}
- if (socketEngine) {
- // turn the socket engine off if we've either:
- // - got pending datagrams
- // - reached the buffer size limit
- if (isBuffered)
- socketEngine->setReadNotificationEnabled(readBufferMaxSize == 0 || readBufferMaxSize > q->bytesAvailable());
- else if (socketType != QAbstractSocket::TcpSocket)
- socketEngine->setReadNotificationEnabled(!socketEngine->hasPendingDatagrams());
- }
+ // turn the socket engine off if we've reached the buffer size limit
+ if (socketEngine && isBuffered)
+ socketEngine->setReadNotificationEnabled(readBufferMaxSize == 0 || readBufferMaxSize > q->bytesAvailable());
// reset the read socket notifier state if we reentered inside the
// readyRead() connected slot.
@@ -2498,12 +2492,14 @@ qint64 QAbstractSocket::readLineData(char *data, qint64 maxlen)
qint64 QAbstractSocket::writeData(const char *data, qint64 size)
{
Q_D(QAbstractSocket);
- if (d->state == QAbstractSocket::UnconnectedState) {
+ if (d->state == QAbstractSocket::UnconnectedState
+ || (!d->socketEngine && d->socketType != TcpSocket && !d->isBuffered)) {
d->setError(UnknownSocketError, tr("Socket is not connected"));
return -1;
}
- if (!d->isBuffered && d->socketType == TcpSocket && d->writeBuffer.isEmpty()) {
+ if (!d->isBuffered && d->socketType == TcpSocket
+ && d->socketEngine && d->writeBuffer.isEmpty()) {
// This code is for the new Unbuffered QTcpSocket use case
qint64 written = d->socketEngine->write(data, size);
if (written < 0) {
@@ -2513,8 +2509,7 @@ qint64 QAbstractSocket::writeData(const char *data, qint64 size)
// Buffer what was not written yet
char *ptr = d->writeBuffer.reserve(size - written);
memcpy(ptr, data + written, size - written);
- if (d->socketEngine)
- d->socketEngine->setWriteNotificationEnabled(true);
+ d->socketEngine->setWriteNotificationEnabled(true);
}
return size; // size=actually written + what has been buffered
} else if (!d->isBuffered && d->socketType != TcpSocket) {
diff --git a/src/network/socket/qhttpsocketengine.cpp b/src/network/socket/qhttpsocketengine.cpp
index 1a90abd22c..92ca76b560 100644
--- a/src/network/socket/qhttpsocketengine.cpp
+++ b/src/network/socket/qhttpsocketengine.cpp
@@ -481,7 +481,7 @@ void QHttpSocketEngine::slotSocketConnected()
QUrl::toAce(d->peerName);
QByteArray path = peerAddress + ':' + QByteArray::number(d->peerPort);
QByteArray data = method;
- data += " ";
+ data += ' ';
data += path;
data += " HTTP/1.1\r\n";
data += "Proxy-Connection: keep-alive\r\n";
diff --git a/src/network/socket/qlocalserver_unix.cpp b/src/network/socket/qlocalserver_unix.cpp
index ef10b1e68d..a356e21214 100644
--- a/src/network/socket/qlocalserver_unix.cpp
+++ b/src/network/socket/qlocalserver_unix.cpp
@@ -85,7 +85,8 @@ bool QLocalServerPrivate::listen(const QString &requestedServerName)
}
serverName = requestedServerName;
- QString tempPath;
+ QByteArray encodedTempPath;
+ const QByteArray encodedFullServerName = QFile::encodeName(fullServerName);
QScopedPointer<QTemporaryDir> tempDir;
// Check any of the flags
@@ -96,8 +97,7 @@ bool QLocalServerPrivate::listen(const QString &requestedServerName)
setError(QLatin1String("QLocalServer::listen"));
return false;
}
- tempPath = tempDir->path();
- tempPath += QLatin1String("/s");
+ encodedTempPath = QFile::encodeName(tempDir->path() + QLatin1String("/s"));
}
// create the unix socket
@@ -111,23 +111,23 @@ bool QLocalServerPrivate::listen(const QString &requestedServerName)
// Construct the unix address
struct ::sockaddr_un addr;
addr.sun_family = PF_UNIX;
- if (sizeof(addr.sun_path) < (uint)fullServerName.toLatin1().size() + 1) {
+ if (sizeof(addr.sun_path) < (uint)encodedFullServerName.size() + 1) {
setError(QLatin1String("QLocalServer::listen"));
closeServer();
return false;
}
if (socketOptions & QLocalServer::WorldAccessOption) {
- if (sizeof(addr.sun_path) < (uint)tempPath.toLatin1().size() + 1) {
+ if (sizeof(addr.sun_path) < (uint)encodedTempPath.size() + 1) {
setError(QLatin1String("QLocalServer::listen"));
closeServer();
return false;
}
- ::memcpy(addr.sun_path, tempPath.toLatin1().data(),
- tempPath.toLatin1().size() + 1);
+ ::memcpy(addr.sun_path, encodedTempPath.constData(),
+ encodedTempPath.size() + 1);
} else {
- ::memcpy(addr.sun_path, fullServerName.toLatin1().data(),
- fullServerName.toLatin1().size() + 1);
+ ::memcpy(addr.sun_path, encodedFullServerName.constData(),
+ encodedFullServerName.size() + 1);
}
// bind
@@ -165,13 +165,13 @@ bool QLocalServerPrivate::listen(const QString &requestedServerName)
if (socketOptions & QLocalServer::OtherAccessOption)
mode |= S_IRWXO;
- if (::chmod(tempPath.toLatin1(), mode) == -1) {
+ if (::chmod(encodedTempPath.constData(), mode) == -1) {
setError(QLatin1String("QLocalServer::listen"));
closeServer();
return false;
}
- if (::rename(tempPath.toLatin1(), fullServerName.toLatin1()) == -1) {
+ if (::rename(encodedTempPath.constData(), encodedFullServerName.constData()) == -1) {
setError(QLatin1String("QLocalServer::listen"));
closeServer();
return false;
@@ -209,7 +209,7 @@ bool QLocalServerPrivate::listen(qintptr socketDescriptor)
QString name = QString::fromLatin1(addr.sun_path);
if (!name.isEmpty()) {
fullServerName = name;
- serverName = fullServerName.mid(fullServerName.lastIndexOf(QLatin1String("/"))+1);
+ serverName = fullServerName.mid(fullServerName.lastIndexOf(QLatin1Char('/')) + 1);
if (serverName.isEmpty()) {
serverName = fullServerName;
}
diff --git a/src/network/socket/qlocalsocket_unix.cpp b/src/network/socket/qlocalsocket_unix.cpp
index 77c5028fb3..bb0f11f038 100644
--- a/src/network/socket/qlocalsocket_unix.cpp
+++ b/src/network/socket/qlocalsocket_unix.cpp
@@ -268,15 +268,16 @@ void QLocalSocketPrivate::_q_connectToSocket()
connectingPathName += QLatin1Char('/') + connectingName;
}
+ const QByteArray encodedConnectingPathName = QFile::encodeName(connectingPathName);
struct sockaddr_un name;
name.sun_family = PF_UNIX;
- if (sizeof(name.sun_path) < (uint)connectingPathName.toLatin1().size() + 1) {
+ if (sizeof(name.sun_path) < (uint)encodedConnectingPathName.size() + 1) {
QString function = QLatin1String("QLocalSocket::connectToServer");
errorOccurred(QLocalSocket::ServerNotFoundError, function);
return;
}
- ::memcpy(name.sun_path, connectingPathName.toLatin1().data(),
- connectingPathName.toLatin1().size() + 1);
+ ::memcpy(name.sun_path, encodedConnectingPathName.constData(),
+ encodedConnectingPathName.size() + 1);
if (-1 == qt_safe_connect(connectingSocket, (struct sockaddr *)&name, sizeof(name))) {
QString function = QLatin1String("QLocalSocket::connectToServer");
switch (errno)
diff --git a/src/network/socket/qnativesocketengine_unix.cpp b/src/network/socket/qnativesocketengine_unix.cpp
index 0e14c175c5..c40eef769e 100644
--- a/src/network/socket/qnativesocketengine_unix.cpp
+++ b/src/network/socket/qnativesocketengine_unix.cpp
@@ -370,7 +370,7 @@ bool QNativeSocketEnginePrivate::setOption(QNativeSocketEngine::SocketOption opt
int n, level;
convertToLevelAndOption(opt, socketProtocol, level, n);
-#if defined(SO_REUSEPORT)
+#if defined(SO_REUSEPORT) && !defined(Q_OS_LINUX)
if (opt == QNativeSocketEngine::AddressReusable) {
// on OS X, SO_REUSEADDR isn't sufficient to allow multiple binds to the
// same port (which is useful for multicast UDP). SO_REUSEPORT is, but
diff --git a/src/network/socket/qnativesocketengine_win.cpp b/src/network/socket/qnativesocketengine_win.cpp
index 2e905ad610..9aed0caa25 100644
--- a/src/network/socket/qnativesocketengine_win.cpp
+++ b/src/network/socket/qnativesocketengine_win.cpp
@@ -1070,8 +1070,11 @@ qint64 QNativeSocketEnginePrivate::nativeBytesAvailable() const
buf.buf = &c;
buf.len = sizeof(c);
DWORD flags = MSG_PEEK;
- if (::WSARecvFrom(socketDescriptor, &buf, 1, 0, &flags, 0,0,0,0) == SOCKET_ERROR)
- return 0;
+ if (::WSARecvFrom(socketDescriptor, &buf, 1, 0, &flags, 0,0,0,0) == SOCKET_ERROR) {
+ int err = WSAGetLastError();
+ if (err != WSAECONNRESET && err != WSAENETRESET)
+ return 0;
+ }
}
return nbytes;
}
@@ -1099,14 +1102,7 @@ bool QNativeSocketEnginePrivate::nativeHasPendingDatagrams() const
int err = WSAGetLastError();
if (ret == SOCKET_ERROR && err != WSAEMSGSIZE) {
WS_ERROR_DEBUG(err);
- if (err == WSAECONNRESET || err == WSAENETRESET) {
- // Discard error message to prevent QAbstractSocket from
- // getting this message repeatedly after reenabling the
- // notifiers.
- flags = 0;
- ::WSARecvFrom(socketDescriptor, &buf, 1, &available, &flags,
- &storage.a, &storageSize, 0, 0);
- }
+ result = (err == WSAECONNRESET || err == WSAENETRESET);
} else {
// If there's no error, or if our buffer was too small, there must be
// a pending datagram.
@@ -1159,12 +1155,21 @@ qint64 QNativeSocketEnginePrivate::nativePendingDatagramSize() const
if (recvResult != SOCKET_ERROR) {
ret = qint64(bytesRead);
break;
- } else if (recvResult == SOCKET_ERROR && err == WSAEMSGSIZE) {
- bufferCount += 5;
- delete[] buf;
- } else if (recvResult == SOCKET_ERROR) {
- WS_ERROR_DEBUG(err);
- ret = -1;
+ } else {
+ switch (err) {
+ case WSAEMSGSIZE:
+ bufferCount += 5;
+ delete[] buf;
+ continue;
+ case WSAECONNRESET:
+ case WSAENETRESET:
+ ret = 0;
+ break;
+ default:
+ WS_ERROR_DEBUG(err);
+ ret = -1;
+ break;
+ }
break;
}
}
diff --git a/src/network/socket/qnativesocketengine_winrt.cpp b/src/network/socket/qnativesocketengine_winrt.cpp
index 025e3e5017..44de7f8526 100644
--- a/src/network/socket/qnativesocketengine_winrt.cpp
+++ b/src/network/socket/qnativesocketengine_winrt.cpp
@@ -285,23 +285,11 @@ bool QNativeSocketEngine::connectToHostByName(const QString &name, quint16 port)
return false;
}
d->socketState = QAbstractSocket::ConnectingState;
- hr = QWinRTFunctions::await(d->connectOp);
- RETURN_FALSE_IF_FAILED("Connection could not be established");
- bool connectionErrors = false;
- d->handleConnectionErrors(d->connectOp.Get(), &connectionErrors);
- if (connectionErrors)
- return false;
- d->connectOp.Reset();
-
- d->socketState = QAbstractSocket::ConnectedState;
- emit connectionReady();
+ hr = d->connectOp->put_Completed(Callback<IAsyncActionCompletedHandler>(
+ d, &QNativeSocketEnginePrivate::handleConnectToHost).Get());
+ Q_ASSERT_SUCCEEDED(hr);
- // Delay the reader so that the SSL socket can upgrade
- if (d->sslSocket)
- connect(d->sslSocket, SIGNAL(encrypted()), SLOT(establishRead()));
- else
- establishRead();
- return true;
+ return d->socketState == QAbstractSocket::ConnectedState;
}
bool QNativeSocketEngine::bind(const QHostAddress &address, quint16 port)
@@ -330,8 +318,7 @@ bool QNativeSocketEngine::bind(const QHostAddress &address, quint16 port)
return false;
}
- EventRegistrationToken token;
- d->tcpListener->add_ConnectionReceived(Callback<ClientConnectedHandler>(d, &QNativeSocketEnginePrivate::handleClientConnection).Get(), &token);
+ d->tcpListener->add_ConnectionReceived(Callback<ClientConnectedHandler>(d, &QNativeSocketEnginePrivate::handleClientConnection).Get(), &d->connectionToken);
hr = d->tcpListener->BindEndpointAsync(hostAddress.Get(), portString.Get(), &op);
if (FAILED(hr)) {
qErrnoWarning(hr, "Unable to bind socket."); // ### Set error message
@@ -688,6 +675,14 @@ bool QNativeSocketEngine::waitForWrite(int msecs, bool *timedOut)
{
Q_UNUSED(msecs);
Q_UNUSED(timedOut);
+ Q_D(QNativeSocketEngine);
+ if (d->socketState == QAbstractSocket::ConnectingState) {
+ HRESULT hr = QWinRTFunctions::await(d->connectOp, QWinRTFunctions::ProcessMainThreadEvents);
+ if (SUCCEEDED(hr)) {
+ d->handleConnectionEstablished(d->connectOp.Get());
+ return true;
+ }
+ }
return false;
}
@@ -728,7 +723,6 @@ void QNativeSocketEngine::setWriteNotificationEnabled(bool enable)
if (bytesToWrite())
return; // will be emitted as a result of bytes written
writeNotification();
- d->notifyOnWrite = false;
}
}
@@ -785,9 +779,8 @@ bool QNativeSocketEnginePrivate::createNewSocket(QAbstractSocket::SocketType soc
qWarning("Failed to create stream socket");
return false;
}
- EventRegistrationToken token;
socketDescriptor = qintptr(socket.Detach());
- udpSocket()->add_MessageReceived(Callback<DatagramReceivedHandler>(this, &QNativeSocketEnginePrivate::handleNewDatagram).Get(), &token);
+ udpSocket()->add_MessageReceived(Callback<DatagramReceivedHandler>(this, &QNativeSocketEnginePrivate::handleNewDatagram).Get(), &connectionToken);
break;
}
default:
@@ -815,11 +808,19 @@ QNativeSocketEnginePrivate::QNativeSocketEnginePrivate()
, closingDown(false)
, socketDescriptor(-1)
, sslSocket(Q_NULLPTR)
+ , connectionToken( { -1 } )
{
}
QNativeSocketEnginePrivate::~QNativeSocketEnginePrivate()
{
+ if (socketDescriptor == -1 || connectionToken.value == -1)
+ return;
+
+ if (socketType == QAbstractSocket::UdpSocket)
+ udpSocket()->remove_MessageReceived(connectionToken);
+ else if (socketType == QAbstractSocket::TcpSocket)
+ tcpListener->remove_ConnectionReceived(connectionToken);
}
void QNativeSocketEnginePrivate::setError(QAbstractSocket::SocketError error, ErrorString errorString) const
@@ -1119,10 +1120,19 @@ HRESULT QNativeSocketEnginePrivate::handleClientConnection(IStreamSocketListener
return S_OK;
}
-void QNativeSocketEnginePrivate::handleConnectionErrors(IAsyncAction *connectAction, bool *errorsOccured)
+HRESULT QNativeSocketEnginePrivate::handleConnectToHost(IAsyncAction *action, AsyncStatus)
+{
+ handleConnectionEstablished(action);
+ return S_OK;
+}
+
+void QNativeSocketEnginePrivate::handleConnectionEstablished(IAsyncAction *action)
{
- bool error = true;
- HRESULT hr = connectAction->GetResults();
+ Q_Q(QNativeSocketEngine);
+ if (wasDeleted || !connectOp) // Protect against a late callback
+ return;
+
+ HRESULT hr = action->GetResults();
switch (hr) {
case 0x8007274c: // A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
setError(QAbstractSocket::NetworkError, ConnectionTimeOutErrorString);
@@ -1140,13 +1150,32 @@ void QNativeSocketEnginePrivate::handleConnectionErrors(IAsyncAction *connectAct
if (FAILED(hr)) {
setError(QAbstractSocket::UnknownSocketError, UnknownSocketErrorString);
socketState = QAbstractSocket::UnconnectedState;
- } else {
- error = false;
}
break;
}
- if (errorsOccured)
- *errorsOccured = error;
+
+ // The callback might be triggered several times if we do not cancel/reset it here
+ if (connectOp) {
+ ComPtr<IAsyncInfo> info;
+ connectOp.As(&info);
+ if (info) {
+ info->Cancel();
+ info->Close();
+ }
+ connectOp.Reset();
+ }
+
+ socketState = QAbstractSocket::ConnectedState;
+ emit q->connectionReady();
+
+ if (socketType != QAbstractSocket::TcpSocket)
+ return;
+
+ // Delay the reader so that the SSL socket can upgrade
+ if (sslSocket)
+ QObject::connect(qobject_cast<QSslSocket *>(sslSocket), &QSslSocket::encrypted, q, &QNativeSocketEngine::establishRead);
+ else
+ q->establishRead();
}
HRESULT QNativeSocketEnginePrivate::handleReadyRead(IAsyncBufferOperation *asyncInfo, AsyncStatus status)
@@ -1166,7 +1195,7 @@ HRESULT QNativeSocketEnginePrivate::handleReadyRead(IAsyncBufferOperation *async
hr = buffer->get_Length(&bufferLength);
Q_ASSERT_SUCCEEDED(hr);
if (!bufferLength) {
- if (q->isReadNotificationEnabled())
+ if (notifyOnRead)
emit q->readReady();
return S_OK;
}
@@ -1190,7 +1219,7 @@ HRESULT QNativeSocketEnginePrivate::handleReadyRead(IAsyncBufferOperation *async
readBytes.seek(readPos);
readMutex.unlock();
- if (q->isReadNotificationEnabled())
+ if (notifyOnRead)
emit q->readReady();
ComPtr<IInputStream> stream;
diff --git a/src/network/socket/qnativesocketengine_winrt_p.h b/src/network/socket/qnativesocketengine_winrt_p.h
index 4286ff6373..912b7db973 100644
--- a/src/network/socket/qnativesocketengine_winrt_p.h
+++ b/src/network/socket/qnativesocketengine_winrt_p.h
@@ -207,13 +207,15 @@ private:
QList<ABI::Windows::Networking::Sockets::IStreamSocket *> currentConnections;
QEventLoop eventLoop;
QAbstractSocket *sslSocket;
+ EventRegistrationToken connectionToken;
HRESULT handleBindCompleted(ABI::Windows::Foundation::IAsyncAction *, ABI::Windows::Foundation::AsyncStatus);
HRESULT handleNewDatagram(ABI::Windows::Networking::Sockets::IDatagramSocket *socket,
ABI::Windows::Networking::Sockets::IDatagramSocketMessageReceivedEventArgs *args);
HRESULT handleClientConnection(ABI::Windows::Networking::Sockets::IStreamSocketListener *tcpListener,
ABI::Windows::Networking::Sockets::IStreamSocketListenerConnectionReceivedEventArgs *args);
- void handleConnectionErrors(ABI::Windows::Foundation::IAsyncAction *connectAction, bool *errorsOccured);
+ HRESULT handleConnectToHost(ABI::Windows::Foundation::IAsyncAction *, ABI::Windows::Foundation::AsyncStatus);
+ void handleConnectionEstablished(ABI::Windows::Foundation::IAsyncAction *action);
HRESULT handleReadyRead(ABI::Windows::Foundation::IAsyncOperationWithProgress<ABI::Windows::Storage::Streams::IBuffer *, UINT32> *asyncInfo, ABI::Windows::Foundation::AsyncStatus);
};
diff --git a/src/network/ssl/qsslellipticcurve.cpp b/src/network/ssl/qsslellipticcurve.cpp
index a16f726429..0824a61e8d 100644
--- a/src/network/ssl/qsslellipticcurve.cpp
+++ b/src/network/ssl/qsslellipticcurve.cpp
@@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE
elliptic-curve cipher algorithms.
Elliptic curves can be constructed from a "short name" (SN) (fromShortName()),
- and by a call to QSslSocket::supportedEllipticCurves().
+ and by a call to QSslConfiguration::supportedEllipticCurves().
QSslEllipticCurve instances can be compared for equality and can be used as keys
in QHash and QSet. They cannot be used as key in a QMap.
@@ -65,7 +65,7 @@ QT_BEGIN_NAMESPACE
Constructs an invalid elliptic curve.
- \sa isValid(), QSslSocket::supportedEllipticCurves()
+ \sa isValid(), QSslConfiguration::supportedEllipticCurves()
*/
/*!
@@ -136,7 +136,6 @@ QT_BEGIN_NAMESPACE
\relates QSslEllipticCurve
Returns true if the curve \a lhs represents the same curve of \a rhs;
- false otherwise.
*/
/*!
@@ -171,7 +170,7 @@ QDebug operator<<(QDebug debug, QSslEllipticCurve curve)
{
QDebugStateSaver saver(debug);
debug.resetFormat().nospace();
- debug << "QSslEllipticCurve(" << curve.shortName() << ")";
+ debug << "QSslEllipticCurve(" << curve.shortName() << ')';
return debug;
}
#endif
diff --git a/src/network/ssl/qsslpresharedkeyauthenticator.cpp b/src/network/ssl/qsslpresharedkeyauthenticator.cpp
index 4a3b1aa807..ab78aea1cd 100644
--- a/src/network/ssl/qsslpresharedkeyauthenticator.cpp
+++ b/src/network/ssl/qsslpresharedkeyauthenticator.cpp
@@ -257,7 +257,6 @@ int QSslPreSharedKeyAuthenticator::maximumPreSharedKeyLength() const
identity hint, identity, pre shared key, maximum length for the identity
and maximum length for the pre shared key.
- \sa operator!=(const QSslPreSharedKeyAuthenticator &lhs, const QSslPreSharedKeyAuthenticator &rhs)
*/
bool operator==(const QSslPreSharedKeyAuthenticator &lhs, const QSslPreSharedKeyAuthenticator &rhs)
{
@@ -277,7 +276,6 @@ bool operator==(const QSslPreSharedKeyAuthenticator &lhs, const QSslPreSharedKey
Returns true if the authenticator object \a lhs is different than \a rhs;
false otherwise.
- \sa operator==(const QSslPreSharedKeyAuthenticator &lhs, const QSslPreSharedKeyAuthenticator &rhs)
*/
QT_END_NAMESPACE
diff --git a/src/network/ssl/qsslpresharedkeyauthenticator_p.h b/src/network/ssl/qsslpresharedkeyauthenticator_p.h
index ba7a740907..c57b6b10ca 100644
--- a/src/network/ssl/qsslpresharedkeyauthenticator_p.h
+++ b/src/network/ssl/qsslpresharedkeyauthenticator_p.h
@@ -34,6 +34,17 @@
#ifndef QSSLPRESHAREDKEYAUTHENTICATOR_P_H
#define QSSLPRESHAREDKEYAUTHENTICATOR_P_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include <QSharedData>
QT_BEGIN_NAMESPACE
diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp
index b62cfd2fde..0472a9a198 100644
--- a/src/network/ssl/qsslsocket.cpp
+++ b/src/network/ssl/qsslsocket.cpp
@@ -1242,7 +1242,7 @@ void QSslSocket::setCiphers(const QString &ciphers)
{
Q_D(QSslSocket);
d->configuration.ciphers.clear();
- foreach (const QString &cipherName, ciphers.split(QLatin1String(":"),QString::SkipEmptyParts)) {
+ foreach (const QString &cipherName, ciphers.split(QLatin1Char(':'), QString::SkipEmptyParts)) {
QSslCipher cipher(cipherName);
if (!cipher.isNull())
d->configuration.ciphers << cipher;
diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp
index 0a4c68d7c0..a8e4c61e9a 100644
--- a/src/network/ssl/qsslsocket_openssl.cpp
+++ b/src/network/ssl/qsslsocket_openssl.cpp
@@ -225,7 +225,7 @@ QSslCipher QSslSocketBackendPrivate::QSslCipher_from_SSL_CIPHER(SSL_CIPHER *ciph
char buf [256];
QString descriptionOneLine = QString::fromLatin1(q_SSL_CIPHER_description(cipher, buf, sizeof(buf)));
- QStringList descriptionList = descriptionOneLine.split(QLatin1String(" "), QString::SkipEmptyParts);
+ QStringList descriptionList = descriptionOneLine.split(QLatin1Char(' '), QString::SkipEmptyParts);
if (descriptionList.size() > 5) {
// ### crude code.
ciph.d->isNull = false;
@@ -290,7 +290,7 @@ int q_X509Callback(int ok, X509_STORE_CTX *ctx)
<< "OU=" << cert.subjectInfo(QSslCertificate::OrganizationalUnitName)
<< "C=" << cert.subjectInfo(QSslCertificate::CountryName)
<< "ST=" << cert.subjectInfo(QSslCertificate::StateOrProvinceName);
- qCDebug(lcSsl) << "Valid:" << cert.effectiveDate() << "-" << cert.expiryDate();
+ qCDebug(lcSsl) << "Valid:" << cert.effectiveDate() << '-' << cert.expiryDate();
}
#endif
}
diff --git a/src/opengl/doc/qtopengl.qdocconf b/src/opengl/doc/qtopengl.qdocconf
index 5b6d09dfcd..6ff6cae2cb 100644
--- a/src/opengl/doc/qtopengl.qdocconf
+++ b/src/opengl/doc/qtopengl.qdocconf
@@ -19,7 +19,7 @@ exampledirs += ../../../examples/opengl \
imagedirs += images \
../../../examples/opengl/doc/images
-depends += qtdoc qtcore qtgui qtwidgets
+depends += qtdoc qtcore qtgui qtwidgets qmake
examplesinstallpath = opengl
diff --git a/src/platformsupport/accessibility/qaccessiblebridgeutils_p.h b/src/platformsupport/accessibility/qaccessiblebridgeutils_p.h
index fca3e16a68..4e52e4b6fc 100644
--- a/src/platformsupport/accessibility/qaccessiblebridgeutils_p.h
+++ b/src/platformsupport/accessibility/qaccessiblebridgeutils_p.h
@@ -34,6 +34,17 @@
#ifndef QACCESSIBLEBRIDGEUTILS_H
#define QACCESSIBLEBRIDGEUTILS_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include <QtCore/qstringlist.h>
#include <QtGui/qaccessible.h>
diff --git a/src/platformsupport/cfsocketnotifier/qcfsocketnotifier.cpp b/src/platformsupport/cfsocketnotifier/qcfsocketnotifier.cpp
index 2b5723d827..c58e0ea78d 100644
--- a/src/platformsupport/cfsocketnotifier/qcfsocketnotifier.cpp
+++ b/src/platformsupport/cfsocketnotifier/qcfsocketnotifier.cpp
@@ -55,11 +55,15 @@ void qt_mac_socket_callback(CFSocketRef s, CFSocketCallBackType callbackType, CF
// notifier is now gone. The upshot is we have to check the notifier
// every time.
if (callbackType == kCFSocketReadCallBack) {
- if (socketInfo->readNotifier)
+ if (socketInfo->readNotifier && socketInfo->readEnabled) {
+ socketInfo->readEnabled = false;
QGuiApplication::sendEvent(socketInfo->readNotifier, &notifierEvent);
+ }
} else if (callbackType == kCFSocketWriteCallBack) {
- if (socketInfo->writeNotifier)
+ if (socketInfo->writeNotifier && socketInfo->writeEnabled) {
+ socketInfo->writeEnabled = false;
QGuiApplication::sendEvent(socketInfo->writeNotifier, &notifierEvent);
+ }
}
if (cfSocketNotifier->maybeCancelWaitForMoreEvents)
@@ -88,12 +92,12 @@ void qt_mac_remove_socket_from_runloop(const CFSocketRef socket, CFRunLoopSource
CFRunLoopRemoveSource(CFRunLoopGetMain(), runloop, kCFRunLoopCommonModes);
CFSocketDisableCallBacks(socket, kCFSocketReadCallBack);
CFSocketDisableCallBacks(socket, kCFSocketWriteCallBack);
- CFRunLoopSourceInvalidate(runloop);
}
QCFSocketNotifier::QCFSocketNotifier()
-:eventDispatcher(0)
-, maybeCancelWaitForMoreEvents(0)
+ : eventDispatcher(0)
+ , maybeCancelWaitForMoreEvents(0)
+ , enableNotifiersObserver(0)
{
}
@@ -150,36 +154,34 @@ void QCFSocketNotifier::registerSocketNotifier(QSocketNotifier *notifier)
}
CFOptionFlags flags = CFSocketGetSocketFlags(socketInfo->socket);
- flags |= kCFSocketAutomaticallyReenableWriteCallBack; //QSocketNotifier stays enabled after a write
- flags &= ~kCFSocketCloseOnInvalidate; //QSocketNotifier doesn't close the socket upon destruction/invalidation
+ // QSocketNotifier doesn't close the socket upon destruction/invalidation
+ flags &= ~kCFSocketCloseOnInvalidate;
+ // Expicitly disable automatic re-enable, as we do that manually on each runloop pass
+ flags &= ~(kCFSocketAutomaticallyReenableWriteCallBack | kCFSocketAutomaticallyReenableReadCallBack);
CFSocketSetSocketFlags(socketInfo->socket, flags);
- // Add CFSocket to runloop.
- if (!(socketInfo->runloop = qt_mac_add_socket_to_runloop(socketInfo->socket))) {
- qWarning("QEventDispatcherMac::registerSocketNotifier: Failed to add CFSocket to runloop");
- CFSocketInvalidate(socketInfo->socket);
- CFRelease(socketInfo->socket);
- return;
- }
-
- // Disable both callback types by default. This must be done after
- // we add the CFSocket to the runloop, or else these calls will have
- // no effect.
- CFSocketDisableCallBacks(socketInfo->socket, kCFSocketReadCallBack);
- CFSocketDisableCallBacks(socketInfo->socket, kCFSocketWriteCallBack);
-
macSockets.insert(nativeSocket, socketInfo);
}
- // Increment read/write counters and select enable callbacks if necessary.
if (type == QSocketNotifier::Read) {
Q_ASSERT(socketInfo->readNotifier == 0);
socketInfo->readNotifier = notifier;
- CFSocketEnableCallBacks(socketInfo->socket, kCFSocketReadCallBack);
+ socketInfo->readEnabled = false;
} else if (type == QSocketNotifier::Write) {
Q_ASSERT(socketInfo->writeNotifier == 0);
socketInfo->writeNotifier = notifier;
- CFSocketEnableCallBacks(socketInfo->socket, kCFSocketWriteCallBack);
+ socketInfo->writeEnabled = false;
+ }
+
+ if (!enableNotifiersObserver) {
+ // Create a run loop observer which enables the socket notifiers on each
+ // pass of the run loop, before any sources are processed.
+ CFRunLoopObserverContext context = {};
+ context.info = this;
+ enableNotifiersObserver = CFRunLoopObserverCreate(kCFAllocatorDefault, kCFRunLoopBeforeSources,
+ true, 0, enableSocketNotifiers, &context);
+ Q_ASSERT(enableNotifiersObserver);
+ CFRunLoopAddObserver(CFRunLoopGetMain(), enableNotifiersObserver, kCFRunLoopCommonModes);
}
}
@@ -212,21 +214,18 @@ void QCFSocketNotifier::unregisterSocketNotifier(QSocketNotifier *notifier)
if (type == QSocketNotifier::Read) {
Q_ASSERT(notifier == socketInfo->readNotifier);
socketInfo->readNotifier = 0;
+ socketInfo->readEnabled = false;
CFSocketDisableCallBacks(socketInfo->socket, kCFSocketReadCallBack);
} else if (type == QSocketNotifier::Write) {
Q_ASSERT(notifier == socketInfo->writeNotifier);
socketInfo->writeNotifier = 0;
+ socketInfo->writeEnabled = false;
CFSocketDisableCallBacks(socketInfo->socket, kCFSocketWriteCallBack);
}
// Remove CFSocket from runloop if this was the last QSocketNotifier.
if (socketInfo->readNotifier == 0 && socketInfo->writeNotifier == 0) {
- if (CFSocketIsValid(socketInfo->socket))
- qt_mac_remove_socket_from_runloop(socketInfo->socket, socketInfo->runloop);
- CFRunLoopSourceInvalidate(socketInfo->runloop);
- CFRelease(socketInfo->runloop);
- CFSocketInvalidate(socketInfo->socket);
- CFRelease(socketInfo->socket);
+ unregisterSocketInfo(socketInfo);
delete socketInfo;
macSockets.remove(nativeSocket);
}
@@ -235,14 +234,70 @@ void QCFSocketNotifier::unregisterSocketNotifier(QSocketNotifier *notifier)
void QCFSocketNotifier::removeSocketNotifiers()
{
// Remove CFSockets from the runloop.
- for (MacSocketHash::ConstIterator it = macSockets.constBegin(); it != macSockets.constEnd(); ++it) {
- MacSocketInfo *socketInfo = (*it);
- if (CFSocketIsValid(socketInfo->socket)) {
+ foreach (MacSocketInfo *socketInfo, macSockets) {
+ unregisterSocketInfo(socketInfo);
+ delete socketInfo;
+ }
+
+ macSockets.clear();
+
+ destroyRunLoopObserver();
+}
+
+void QCFSocketNotifier::destroyRunLoopObserver()
+{
+ if (!enableNotifiersObserver)
+ return;
+
+ CFRunLoopObserverInvalidate(enableNotifiersObserver);
+ CFRelease(enableNotifiersObserver);
+ enableNotifiersObserver = 0;
+}
+
+void QCFSocketNotifier::unregisterSocketInfo(MacSocketInfo *socketInfo)
+{
+ if (socketInfo->runloop) {
+ if (CFSocketIsValid(socketInfo->socket))
qt_mac_remove_socket_from_runloop(socketInfo->socket, socketInfo->runloop);
- CFRunLoopSourceInvalidate(socketInfo->runloop);
- CFRelease(socketInfo->runloop);
- CFSocketInvalidate(socketInfo->socket);
- CFRelease(socketInfo->socket);
+ CFRunLoopSourceInvalidate(socketInfo->runloop);
+ CFRelease(socketInfo->runloop);
+ }
+ CFSocketInvalidate(socketInfo->socket);
+ CFRelease(socketInfo->socket);
+}
+
+void QCFSocketNotifier::enableSocketNotifiers(CFRunLoopObserverRef ref, CFRunLoopActivity activity, void *info)
+{
+ Q_UNUSED(ref);
+ Q_UNUSED(activity);
+
+ QCFSocketNotifier *that = static_cast<QCFSocketNotifier *>(info);
+
+ foreach (MacSocketInfo *socketInfo, that->macSockets) {
+ if (!CFSocketIsValid(socketInfo->socket))
+ continue;
+
+ if (!socketInfo->runloop) {
+ // Add CFSocket to runloop.
+ if (!(socketInfo->runloop = qt_mac_add_socket_to_runloop(socketInfo->socket))) {
+ qWarning("QEventDispatcherMac::registerSocketNotifier: Failed to add CFSocket to runloop");
+ CFSocketInvalidate(socketInfo->socket);
+ continue;
+ }
+
+ if (!socketInfo->readNotifier)
+ CFSocketDisableCallBacks(socketInfo->socket, kCFSocketReadCallBack);
+ if (!socketInfo->writeNotifier)
+ CFSocketDisableCallBacks(socketInfo->socket, kCFSocketWriteCallBack);
+ }
+
+ if (socketInfo->readNotifier && !socketInfo->readEnabled) {
+ socketInfo->readEnabled = true;
+ CFSocketEnableCallBacks(socketInfo->socket, kCFSocketReadCallBack);
+ }
+ if (socketInfo->writeNotifier && !socketInfo->writeEnabled) {
+ socketInfo->writeEnabled = true;
+ CFSocketEnableCallBacks(socketInfo->socket, kCFSocketWriteCallBack);
}
}
}
diff --git a/src/platformsupport/cfsocketnotifier/qcfsocketnotifier_p.h b/src/platformsupport/cfsocketnotifier/qcfsocketnotifier_p.h
index af8122f753..9bccc1bf98 100644
--- a/src/platformsupport/cfsocketnotifier/qcfsocketnotifier_p.h
+++ b/src/platformsupport/cfsocketnotifier/qcfsocketnotifier_p.h
@@ -53,11 +53,14 @@
QT_BEGIN_NAMESPACE
struct MacSocketInfo {
- MacSocketInfo() : socket(0), runloop(0), readNotifier(0), writeNotifier(0) {}
+ MacSocketInfo() : socket(0), runloop(0), readNotifier(0), writeNotifier(0),
+ readEnabled(false), writeEnabled(false) {}
CFSocketRef socket;
CFRunLoopSourceRef runloop;
QObject *readNotifier;
QObject *writeNotifier;
+ bool readEnabled;
+ bool writeEnabled;
};
typedef QHash<int, MacSocketInfo *> MacSocketHash;
@@ -83,9 +86,18 @@ public:
void unregisterSocketNotifier(QSocketNotifier *notifier);
void removeSocketNotifiers();
+private:
+ void destroyRunLoopObserver();
+
+ static void unregisterSocketInfo(MacSocketInfo *socketInfo);
+ static void enableSocketNotifiers(CFRunLoopObserverRef ref, CFRunLoopActivity activity, void *info);
+
MacSocketHash macSockets;
QAbstractEventDispatcher *eventDispatcher;
MaybeCancelWaitForMoreEventsFn maybeCancelWaitForMoreEvents;
+ CFRunLoopObserverRef enableNotifiersObserver;
+
+ friend void qt_mac_socket_callback(CFSocketRef, CFSocketCallBackType, CFDataRef, const void *, void *);
};
QT_END_NAMESPACE
diff --git a/src/platformsupport/dbusmenu/qdbusmenuadaptor_p.h b/src/platformsupport/dbusmenu/qdbusmenuadaptor_p.h
index 85b5bd8d49..41ab761f12 100644
--- a/src/platformsupport/dbusmenu/qdbusmenuadaptor_p.h
+++ b/src/platformsupport/dbusmenu/qdbusmenuadaptor_p.h
@@ -45,6 +45,17 @@
#ifndef DBUSMENUADAPTOR_H
#define DBUSMENUADAPTOR_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include <QtCore/QObject>
#include <QtDBus/QtDBus>
#include "qdbusmenutypes_p.h"
diff --git a/src/platformsupport/dbusmenu/qdbusmenutypes.cpp b/src/platformsupport/dbusmenu/qdbusmenutypes.cpp
index 94df0f53dd..8d5d96353c 100644
--- a/src/platformsupport/dbusmenu/qdbusmenutypes.cpp
+++ b/src/platformsupport/dbusmenu/qdbusmenutypes.cpp
@@ -247,7 +247,7 @@ QDebug operator<<(QDebug d, const QDBusMenuItem &item)
{
QDebugStateSaver saver(d);
d.nospace();
- d << "QDBusMenuItem(id=" << item.m_id << ", properties=" << item.m_properties << ")";
+ d << "QDBusMenuItem(id=" << item.m_id << ", properties=" << item.m_properties << ')';
return d;
}
diff --git a/src/platformsupport/dbusmenu/qdbusmenutypes_p.h b/src/platformsupport/dbusmenu/qdbusmenutypes_p.h
index 8dae75281c..bc9f064f88 100644
--- a/src/platformsupport/dbusmenu/qdbusmenutypes_p.h
+++ b/src/platformsupport/dbusmenu/qdbusmenutypes_p.h
@@ -34,6 +34,17 @@
#ifndef QDBUSMENUTYPES_H
#define QDBUSMENUTYPES_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include <QObject>
#include <QString>
#include <QDBusArgument>
diff --git a/src/platformsupport/dbusmenu/qdbusplatformmenu.cpp b/src/platformsupport/dbusmenu/qdbusplatformmenu.cpp
index a64e107e71..1dd2b462ed 100644
--- a/src/platformsupport/dbusmenu/qdbusplatformmenu.cpp
+++ b/src/platformsupport/dbusmenu/qdbusplatformmenu.cpp
@@ -59,6 +59,11 @@ QDBusPlatformMenuItem::QDBusPlatformMenuItem(quintptr tag)
menuItemsByID.insert(m_dbusID, this);
}
+QDBusPlatformMenuItem::~QDBusPlatformMenuItem()
+{
+ menuItemsByID.remove(m_dbusID);
+}
+
void QDBusPlatformMenuItem::setTag(quintptr tag)
{
m_tag = tag;
@@ -155,6 +160,7 @@ QDBusPlatformMenu::QDBusPlatformMenu(quintptr tag)
QDBusPlatformMenu::~QDBusPlatformMenu()
{
menusByID.remove(m_dbusID);
+ m_topLevelMenus.removeOne(this);
}
void QDBusPlatformMenu::insertMenuItem(QPlatformMenuItem *menuItem, QPlatformMenuItem *before)
diff --git a/src/platformsupport/dbusmenu/qdbusplatformmenu_p.h b/src/platformsupport/dbusmenu/qdbusplatformmenu_p.h
index 16bb4f195c..6d2d27463f 100644
--- a/src/platformsupport/dbusmenu/qdbusplatformmenu_p.h
+++ b/src/platformsupport/dbusmenu/qdbusplatformmenu_p.h
@@ -33,6 +33,17 @@
#ifndef QDBUSPLATFORMMENU_H
#define QDBUSPLATFORMMENU_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
//
// W A R N I N G
// -------------
@@ -57,6 +68,7 @@ class QDBusPlatformMenuItem : public QPlatformMenuItem
public:
QDBusPlatformMenuItem(quintptr tag = 0LL);
+ ~QDBusPlatformMenuItem();
quintptr tag()const Q_DECL_OVERRIDE { return m_tag; }
void setTag(quintptr tag) Q_DECL_OVERRIDE;
diff --git a/src/platformsupport/dbustray/qdbustraytypes_p.h b/src/platformsupport/dbustray/qdbustraytypes_p.h
index e6f200362f..d8e52b932d 100644
--- a/src/platformsupport/dbustray/qdbustraytypes_p.h
+++ b/src/platformsupport/dbustray/qdbustraytypes_p.h
@@ -35,6 +35,17 @@
#ifndef QDBUSTRAYTYPES_P_H
#define QDBUSTRAYTYPES_P_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#ifndef QT_NO_SYSTEMTRAYICON
#include <QObject>
diff --git a/src/platformsupport/dbustray/qstatusnotifieritemadaptor_p.h b/src/platformsupport/dbustray/qstatusnotifieritemadaptor_p.h
index 56fbb75d7a..c3849f0e03 100644
--- a/src/platformsupport/dbustray/qstatusnotifieritemadaptor_p.h
+++ b/src/platformsupport/dbustray/qstatusnotifieritemadaptor_p.h
@@ -45,6 +45,17 @@
#ifndef QSTATUSNOTIFIERITEMADAPTER_P_H
#define QSTATUSNOTIFIERITEMADAPTER_P_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#ifndef QT_NO_SYSTEMTRAYICON
#include <QtCore/QObject>
diff --git a/src/platformsupport/dbustray/qxdgnotificationproxy_p.h b/src/platformsupport/dbustray/qxdgnotificationproxy_p.h
index 3e573cb118..5c74405ae8 100644
--- a/src/platformsupport/dbustray/qxdgnotificationproxy_p.h
+++ b/src/platformsupport/dbustray/qxdgnotificationproxy_p.h
@@ -45,6 +45,17 @@
#ifndef QXDGNOTIFICATIONPROXY_P_H
#define QXDGNOTIFICATIONPROXY_P_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include <QtCore/QObject>
#include <QtCore/QByteArray>
#include <QtCore/QList>
diff --git a/src/platformsupport/devicediscovery/qdevicediscovery_static.cpp b/src/platformsupport/devicediscovery/qdevicediscovery_static.cpp
index 1bc834b5ef..3aab785b34 100644
--- a/src/platformsupport/devicediscovery/qdevicediscovery_static.cpp
+++ b/src/platformsupport/devicediscovery/qdevicediscovery_static.cpp
@@ -90,7 +90,7 @@ QStringList QDeviceDiscoveryStatic::scanConnectedDevices()
if (m_types & Device_InputMask) {
dir.setPath(QString::fromLatin1(QT_EVDEV_DEVICE_PATH));
foreach (const QString &deviceFile, dir.entryList()) {
- QString absoluteFilePath = dir.absolutePath() + QString::fromLatin1("/") + deviceFile;
+ QString absoluteFilePath = dir.absolutePath() + QLatin1Char('/') + deviceFile;
if (checkDeviceType(absoluteFilePath))
devices << absoluteFilePath;
}
@@ -100,7 +100,7 @@ QStringList QDeviceDiscoveryStatic::scanConnectedDevices()
if (m_types & Device_VideoMask) {
dir.setPath(QString::fromLatin1(QT_DRM_DEVICE_PATH));
foreach (const QString &deviceFile, dir.entryList()) {
- QString absoluteFilePath = dir.absolutePath() + QString::fromLatin1("/") + deviceFile;
+ QString absoluteFilePath = dir.absolutePath() + QLatin1Char('/') + deviceFile;
if (checkDeviceType(absoluteFilePath))
devices << absoluteFilePath;
}
diff --git a/src/platformsupport/devicediscovery/qdevicediscovery_udev.cpp b/src/platformsupport/devicediscovery/qdevicediscovery_udev.cpp
index 96fa058f78..334eb51a86 100644
--- a/src/platformsupport/devicediscovery/qdevicediscovery_udev.cpp
+++ b/src/platformsupport/devicediscovery/qdevicediscovery_udev.cpp
@@ -210,7 +210,7 @@ bool QDeviceDiscoveryUDev::checkDeviceType(udev_device *dev)
if ((m_types & Device_Keyboard) && (qstrcmp(udev_device_get_property_value(dev, "ID_INPUT_KEYBOARD"), "1") == 0 )) {
const char *capabilities_key = udev_device_get_sysattr_value(dev, "capabilities/key");
- QStringList val = QString::fromUtf8(capabilities_key).split(QString::fromUtf8(" "), QString::SkipEmptyParts);
+ QStringList val = QString::fromUtf8(capabilities_key).split(QLatin1Char(' '), QString::SkipEmptyParts);
if (!val.isEmpty()) {
bool ok;
unsigned long long keys = val.last().toULongLong(&ok, 16);
diff --git a/src/platformsupport/eglconvenience/qeglconvenience_p.h b/src/platformsupport/eglconvenience/qeglconvenience_p.h
index 59441d8c9a..ec6f668cba 100644
--- a/src/platformsupport/eglconvenience/qeglconvenience_p.h
+++ b/src/platformsupport/eglconvenience/qeglconvenience_p.h
@@ -88,7 +88,6 @@ public:
protected:
virtual bool filterConfig(EGLConfig config) const;
-private:
QSurfaceFormat m_format;
EGLDisplay m_display;
EGLint m_surfaceType;
diff --git a/src/platformsupport/eglconvenience/qeglpbuffer.cpp b/src/platformsupport/eglconvenience/qeglpbuffer.cpp
index 756609a641..d1a31642b2 100644
--- a/src/platformsupport/eglconvenience/qeglpbuffer.cpp
+++ b/src/platformsupport/eglconvenience/qeglpbuffer.cpp
@@ -49,13 +49,15 @@ QT_BEGIN_NAMESPACE
and return a new instance of this class.
*/
-QEGLPbuffer::QEGLPbuffer(EGLDisplay display, const QSurfaceFormat &format, QOffscreenSurface *offscreenSurface)
+QEGLPbuffer::QEGLPbuffer(EGLDisplay display, const QSurfaceFormat &format, QOffscreenSurface *offscreenSurface,
+ QEGLPlatformContext::Flags flags)
: QPlatformOffscreenSurface(offscreenSurface)
, m_format(format)
, m_display(display)
, m_pbuffer(EGL_NO_SURFACE)
{
- bool hasSurfaceless = q_hasEglExtension(display, "EGL_KHR_surfaceless_context");
+ bool hasSurfaceless = !flags.testFlag(QEGLPlatformContext::NoSurfaceless)
+ && q_hasEglExtension(display, "EGL_KHR_surfaceless_context");
// Disable surfaceless contexts on Mesa for now. As of 10.6.0 and Intel at least, some
// operations (glReadPixels) are unable to work without a surface since they at some
diff --git a/src/platformsupport/eglconvenience/qeglpbuffer_p.h b/src/platformsupport/eglconvenience/qeglpbuffer_p.h
index 3372c0735d..81fdab8901 100644
--- a/src/platformsupport/eglconvenience/qeglpbuffer_p.h
+++ b/src/platformsupport/eglconvenience/qeglpbuffer_p.h
@@ -47,13 +47,15 @@
#include <EGL/egl.h>
#include <qpa/qplatformoffscreensurface.h>
+#include <QtPlatformSupport/private/qeglplatformcontext_p.h>
QT_BEGIN_NAMESPACE
class QEGLPbuffer : public QPlatformOffscreenSurface
{
public:
- QEGLPbuffer(EGLDisplay display, const QSurfaceFormat &format, QOffscreenSurface *offscreenSurface);
+ QEGLPbuffer(EGLDisplay display, const QSurfaceFormat &format, QOffscreenSurface *offscreenSurface,
+ QEGLPlatformContext::Flags flags = 0);
~QEGLPbuffer();
QSurfaceFormat format() const Q_DECL_OVERRIDE { return m_format; }
diff --git a/src/platformsupport/eglconvenience/qeglplatformcontext.cpp b/src/platformsupport/eglconvenience/qeglplatformcontext.cpp
index 905f7695bb..acd6197ed5 100644
--- a/src/platformsupport/eglconvenience/qeglplatformcontext.cpp
+++ b/src/platformsupport/eglconvenience/qeglplatformcontext.cpp
@@ -39,6 +39,10 @@
#include <QtPlatformHeaders/QEGLNativeContext>
#include <QDebug>
+#ifdef Q_OS_ANDROID
+#include <QtCore/private/qjnihelpers_p.h>
+#endif
+
QT_BEGIN_NAMESPACE
/*!
@@ -102,11 +106,12 @@ QT_BEGIN_NAMESPACE
#endif
QEGLPlatformContext::QEGLPlatformContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display,
- EGLConfig *config, const QVariant &nativeHandle)
+ EGLConfig *config, const QVariant &nativeHandle, Flags flags)
: m_eglDisplay(display)
, m_swapInterval(-1)
, m_swapIntervalEnvChecked(false)
, m_swapIntervalFromEnv(-1)
+ , m_flags(flags)
{
if (nativeHandle.isNull()) {
m_eglConfig = config ? *config : q_configFromGLFormat(display, format);
@@ -287,7 +292,7 @@ void QEGLPlatformContext::updateFormatFromGL()
// drivers (Mesa) when certain attributes are present (multisampling).
EGLSurface tempSurface = EGL_NO_SURFACE;
EGLContext tempContext = EGL_NO_CONTEXT;
- if (!q_hasEglExtension(m_eglDisplay, "EGL_KHR_surfaceless_context"))
+ if (m_flags.testFlag(NoSurfaceless) || !q_hasEglExtension(m_eglDisplay, "EGL_KHR_surfaceless_context"))
tempSurface = createTemporaryOffscreenSurface();
EGLBoolean ok = eglMakeCurrent(m_eglDisplay, tempSurface, tempSurface, m_eglContext);
@@ -305,6 +310,14 @@ void QEGLPlatformContext::updateFormatFromGL()
QByteArray version = QByteArray(reinterpret_cast<const char *>(s));
int major, minor;
if (QPlatformOpenGLContext::parseOpenGLVersion(version, major, minor)) {
+#ifdef Q_OS_ANDROID
+ // Some Android 4.2.2 devices report OpenGL ES 3.0 without the functions being available.
+ static int apiLevel = QtAndroidPrivate::androidSdkVersion();
+ if (apiLevel <= 17 && major >= 3) {
+ major = 2;
+ minor = 0;
+ }
+#endif
m_format.setMajorVersion(major);
m_format.setMinorVersion(minor);
}
diff --git a/src/platformsupport/eglconvenience/qeglplatformcontext_p.h b/src/platformsupport/eglconvenience/qeglplatformcontext_p.h
index 2ab7ad28d0..2fa465556b 100644
--- a/src/platformsupport/eglconvenience/qeglplatformcontext_p.h
+++ b/src/platformsupport/eglconvenience/qeglplatformcontext_p.h
@@ -56,8 +56,14 @@ QT_BEGIN_NAMESPACE
class QEGLPlatformContext : public QPlatformOpenGLContext
{
public:
+ enum Flag {
+ NoSurfaceless = 0x01
+ };
+ Q_DECLARE_FLAGS(Flags, Flag)
+
QEGLPlatformContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display,
- EGLConfig *config = 0, const QVariant &nativeHandle = QVariant());
+ EGLConfig *config = 0, const QVariant &nativeHandle = QVariant(),
+ Flags flags = 0);
~QEGLPlatformContext();
void initialize() Q_DECL_OVERRIDE;
@@ -93,10 +99,13 @@ private:
int m_swapInterval;
bool m_swapIntervalEnvChecked;
int m_swapIntervalFromEnv;
+ Flags m_flags;
bool m_ownsContext;
QVector<EGLint> m_contextAttrs;
};
+Q_DECLARE_OPERATORS_FOR_FLAGS(QEGLPlatformContext::Flags)
+
QT_END_NAMESPACE
#endif //QEGLPLATFORMCONTEXT_H
diff --git a/src/platformsupport/eventdispatchers/qeventdispatcher_cf.mm b/src/platformsupport/eventdispatchers/qeventdispatcher_cf.mm
index 13b7dc4358..0273fe5ed4 100644
--- a/src/platformsupport/eventdispatchers/qeventdispatcher_cf.mm
+++ b/src/platformsupport/eventdispatchers/qeventdispatcher_cf.mm
@@ -41,8 +41,6 @@
#include <QtCore/private/qcore_mac_p.h>
#include <QtCore/private/qthread_p.h>
-#include <qpa/qwindowsysteminterface.h>
-
#include <limits>
#include <UIKit/UIApplication.h>
@@ -169,6 +167,7 @@ static const CFTimeInterval kCFTimeIntervalDistantFuture = std::numeric_limits<C
QEventDispatcherCoreFoundation::QEventDispatcherCoreFoundation(QObject *parent)
: QAbstractEventDispatcher(parent)
+ , m_processEvents(QEventLoop::EventLoopExec)
, m_postedEventsRunLoopSource(this, &QEventDispatcherCoreFoundation::processPostedEvents)
, m_runLoopActivityObserver(this, &QEventDispatcherCoreFoundation::handleRunLoopActivity,
#if DEBUG_EVENT_DISPATCHER
@@ -181,7 +180,6 @@ QEventDispatcherCoreFoundation::QEventDispatcherCoreFoundation(QObject *parent)
, m_runLoopTimer(0)
, m_blockedRunLoopTimer(0)
, m_overdueTimerScheduled(false)
- , m_processEvents(QEventLoop::EventLoopExec)
{
m_cfSocketNotifier.setHostEventDispatcher(this);
@@ -371,11 +369,11 @@ bool QEventDispatcherCoreFoundation::processEvents(QEventLoop::ProcessEventsFlag
return eventsProcessed;
}
-void QEventDispatcherCoreFoundation::processPostedEvents()
+bool QEventDispatcherCoreFoundation::processPostedEvents()
{
if (m_processEvents.processedPostedEvents && !(m_processEvents.flags & QEventLoop::EventLoopExec)) {
qEventDispatcherDebug() << "Already processed events this pass";
- return;
+ return false;
}
m_processEvents.processedPostedEvents = true;
@@ -384,9 +382,7 @@ void QEventDispatcherCoreFoundation::processPostedEvents()
QCoreApplication::sendPostedEvents();
qUnIndent();
- qEventDispatcherDebug() << "Sending window system events for " << m_processEvents.flags; qIndent();
- QWindowSystemInterface::sendWindowSystemEvents(m_processEvents.flags);
- qUnIndent();
+ return true;
}
void QEventDispatcherCoreFoundation::processTimers(CFRunLoopTimerRef timer)
diff --git a/src/platformsupport/eventdispatchers/qeventdispatcher_cf_p.h b/src/platformsupport/eventdispatchers/qeventdispatcher_cf_p.h
index 1cd9ae4ebf..2fe5dea3d8 100644
--- a/src/platformsupport/eventdispatchers/qeventdispatcher_cf_p.h
+++ b/src/platformsupport/eventdispatchers/qeventdispatcher_cf_p.h
@@ -101,7 +101,7 @@ template <class T = QEventDispatcherCoreFoundation>
class RunLoopSource
{
public:
- typedef void (T::*CallbackFunction) ();
+ typedef bool (T::*CallbackFunction)();
enum { kHighestPriority = 0 } RunLoopSourcePriority;
@@ -221,18 +221,8 @@ public:
void interrupt();
void flush();
-private:
- RunLoopSource<> m_postedEventsRunLoopSource;
- RunLoopObserver<> m_runLoopActivityObserver;
-
- RunLoopModeTracker *m_runLoopModeTracker;
-
- QTimerInfoList m_timerInfoList;
- CFRunLoopTimerRef m_runLoopTimer;
- CFRunLoopTimerRef m_blockedRunLoopTimer;
- bool m_overdueTimerScheduled;
-
- QCFSocketNotifier m_cfSocketNotifier;
+protected:
+ virtual bool processPostedEvents();
struct ProcessEventsState
{
@@ -251,7 +241,19 @@ private:
ProcessEventsState m_processEvents;
- void processPostedEvents();
+private:
+ RunLoopSource<> m_postedEventsRunLoopSource;
+ RunLoopObserver<> m_runLoopActivityObserver;
+
+ RunLoopModeTracker *m_runLoopModeTracker;
+
+ QTimerInfoList m_timerInfoList;
+ CFRunLoopTimerRef m_runLoopTimer;
+ CFRunLoopTimerRef m_blockedRunLoopTimer;
+ bool m_overdueTimerScheduled;
+
+ QCFSocketNotifier m_cfSocketNotifier;
+
void processTimers(CFRunLoopTimerRef);
void handleRunLoopActivity(CFRunLoopActivity activity);
diff --git a/src/platformsupport/fbconvenience/qfbvthandler.cpp b/src/platformsupport/fbconvenience/qfbvthandler.cpp
index c46e470c34..5e062b3f0a 100644
--- a/src/platformsupport/fbconvenience/qfbvthandler.cpp
+++ b/src/platformsupport/fbconvenience/qfbvthandler.cpp
@@ -79,87 +79,79 @@ static void setTTYCursor(bool enable)
}
#endif
+#ifdef VTH_ENABLED
+static QFbVtHandler *vth;
+
+void QFbVtHandler::signalHandler(int sigNo)
+{
+ char a = sigNo;
+ QT_WRITE(vth->m_sigFd[0], &a, sizeof(a));
+}
+#endif
+
QFbVtHandler::QFbVtHandler(QObject *parent)
: QObject(parent),
m_tty(-1),
- m_signalFd(-1),
m_signalNotifier(0)
{
#ifdef VTH_ENABLED
- setTTYCursor(false);
-
- if (isatty(0)) {
+ if (isatty(0))
m_tty = 0;
- ioctl(m_tty, KDGKBMODE, &m_oldKbdMode);
- if (!qEnvironmentVariableIntValue("QT_QPA_ENABLE_TERMINAL_KEYBOARD")) {
- // Disable the tty keyboard.
- ioctl(m_tty, KDSKBMUTE, 1);
- ioctl(m_tty, KDSKBMODE, KBD_OFF_MODE);
- }
+ if (::socketpair(AF_UNIX, SOCK_STREAM, 0, m_sigFd)) {
+ qErrnoWarning(errno, "QFbVtHandler: socketpair() failed");
+ return;
}
- // SIGSEGV and such cannot safely be blocked. We cannot handle them in an
- // async-safe manner either. Restoring the keyboard, video mode, etc. may
- // all contain calls that cannot safely be made from a signal handler.
-
- // Other signals: block them and use signalfd.
- sigset_t mask;
- sigemptyset(&mask);
-
- // Catch Ctrl+C.
- sigaddset(&mask, SIGINT);
-
- // Ctrl+Z. Up to the platform plugins to handle it in a meaningful way.
- sigaddset(&mask, SIGTSTP);
- sigaddset(&mask, SIGCONT);
-
- // Default signal used by kill. To overcome the common issue of no cleaning
- // up when killing a locally started app via a remote session.
- sigaddset(&mask, SIGTERM);
-
- m_signalFd = signalfd(-1, &mask, SFD_CLOEXEC);
- if (m_signalFd < 0) {
- qErrnoWarning(errno, "signalfd() failed");
- } else {
- m_signalNotifier = new QSocketNotifier(m_signalFd, QSocketNotifier::Read, this);
- connect(m_signalNotifier, &QSocketNotifier::activated, this, &QFbVtHandler::handleSignal);
-
- // Block the signals that are handled via signalfd. Applies only to the current
- // thread, but new threads will inherit the creator's signal mask.
- pthread_sigmask(SIG_BLOCK, &mask, 0);
- }
+ vth = this;
+ setTTYCursor(false);
+ setKeyboardEnabled(false);
+
+ m_signalNotifier = new QSocketNotifier(m_sigFd[1], QSocketNotifier::Read, this);
+ connect(m_signalNotifier, &QSocketNotifier::activated, this, &QFbVtHandler::handleSignal);
+
+ struct sigaction sa;
+ sa.sa_flags = 0;
+ sa.sa_handler = signalHandler;
+ sigemptyset(&sa.sa_mask);
+ sigaction(SIGINT, &sa, 0); // Ctrl+C
+ sigaction(SIGTSTP, &sa, 0); // Ctrl+Z
+ sigaction(SIGCONT, &sa, 0);
+ sigaction(SIGTERM, &sa, 0); // default signal used by kill
#endif
}
QFbVtHandler::~QFbVtHandler()
{
#ifdef VTH_ENABLED
- restoreKeyboard();
+ setKeyboardEnabled(true);
setTTYCursor(true);
- if (m_signalFd != -1)
- close(m_signalFd);
+ if (m_signalNotifier) {
+ close(m_sigFd[0]);
+ close(m_sigFd[1]);
+ }
#endif
}
-void QFbVtHandler::restoreKeyboard()
+void QFbVtHandler::setKeyboardEnabled(bool enable)
{
#ifdef VTH_ENABLED
if (m_tty == -1)
return;
- ioctl(m_tty, KDSKBMUTE, 0);
- ioctl(m_tty, KDSKBMODE, m_oldKbdMode);
-#endif
-}
-
-// To be called from the slot connected to suspendRequested() in case the
-// platform plugin does in fact allow suspending on Ctrl+Z.
-void QFbVtHandler::suspend()
-{
-#ifdef VTH_ENABLED
- kill(getpid(), SIGSTOP);
+ if (enable) {
+ ::ioctl(m_tty, KDSKBMUTE, 0);
+ ::ioctl(m_tty, KDSKBMODE, m_oldKbdMode);
+ } else {
+ ::ioctl(m_tty, KDGKBMODE, &m_oldKbdMode);
+ if (!qEnvironmentVariableIntValue("QT_QPA_ENABLE_TERMINAL_KEYBOARD")) {
+ ::ioctl(m_tty, KDSKBMUTE, 1);
+ ::ioctl(m_tty, KDSKBMODE, KBD_OFF_MODE);
+ }
+ }
+#else
+ Q_UNUSED(enable);
#endif
}
@@ -168,17 +160,22 @@ void QFbVtHandler::handleSignal()
#ifdef VTH_ENABLED
m_signalNotifier->setEnabled(false);
- signalfd_siginfo sig;
- if (read(m_signalFd, &sig, sizeof(sig)) == sizeof(sig)) {
- switch (sig.ssi_signo) {
+ char sigNo;
+ if (QT_READ(m_sigFd[1], &sigNo, sizeof(sigNo)) == sizeof(sigNo)) {
+ switch (sigNo) {
case SIGINT: // fallthrough
case SIGTERM:
handleInt();
break;
case SIGTSTP:
- emit suspendRequested();
+ emit aboutToSuspend();
+ setKeyboardEnabled(true);
+ setTTYCursor(true);
+ ::kill(getpid(), SIGSTOP);
break;
case SIGCONT:
+ setTTYCursor(false);
+ setKeyboardEnabled(false);
emit resumed();
break;
default:
@@ -194,7 +191,7 @@ void QFbVtHandler::handleInt()
{
#ifdef VTH_ENABLED
emit interrupted();
- restoreKeyboard();
+ setKeyboardEnabled(true);
setTTYCursor(true);
_exit(1);
#endif
diff --git a/src/platformsupport/fbconvenience/qfbvthandler_p.h b/src/platformsupport/fbconvenience/qfbvthandler_p.h
index 3681def9f0..91eba248fe 100644
--- a/src/platformsupport/fbconvenience/qfbvthandler_p.h
+++ b/src/platformsupport/fbconvenience/qfbvthandler_p.h
@@ -59,23 +59,22 @@ public:
QFbVtHandler(QObject *parent = 0);
~QFbVtHandler();
- void suspend();
-
signals:
void interrupted();
- void suspendRequested();
+ void aboutToSuspend();
void resumed();
private slots:
void handleSignal();
private:
- void restoreKeyboard();
+ void setKeyboardEnabled(bool enable);
void handleInt();
+ static void signalHandler(int sigNo);
int m_tty;
int m_oldKbdMode;
- int m_signalFd;
+ int m_sigFd[2];
QSocketNotifier *m_signalNotifier;
};
diff --git a/src/platformsupport/fontdatabases/basic/qbasicfontdatabase.cpp b/src/platformsupport/fontdatabases/basic/qbasicfontdatabase.cpp
index b04ae8ee52..728b166b71 100644
--- a/src/platformsupport/fontdatabases/basic/qbasicfontdatabase.cpp
+++ b/src/platformsupport/fontdatabases/basic/qbasicfontdatabase.cpp
@@ -188,7 +188,7 @@ QStringList QBasicFontDatabase::addTTFile(const QByteArray &fontData, const QByt
error = FT_New_Face(library, file.constData(), index, &face);
}
if (error != FT_Err_Ok) {
- qDebug() << "FT_New_Face failed with index" << index << ":" << hex << error;
+ qDebug() << "FT_New_Face failed with index" << index << ':' << hex << error;
break;
}
numFaces = face->num_faces;
diff --git a/src/platformsupport/input/evdevmouse/qevdevmousehandler.cpp b/src/platformsupport/input/evdevmouse/qevdevmousehandler.cpp
index 2e9723329e..c4ebc5c51d 100644
--- a/src/platformsupport/input/evdevmouse/qevdevmousehandler.cpp
+++ b/src/platformsupport/input/evdevmouse/qevdevmousehandler.cpp
@@ -148,7 +148,7 @@ bool QEvdevMouseHandler::getHardwareMaximum()
qCDebug(qLcEvdevMouse) << "Absolute pointing device"
<< "hardware max x" << m_hardwareWidth
<< "hardware max y" << m_hardwareHeight
- << "hardware scalers x" << m_hardwareScalerX << "y" << m_hardwareScalerY;
+ << "hardware scalers x" << m_hardwareScalerX << 'y' << m_hardwareScalerY;
return true;
}
diff --git a/src/platformsupport/input/tslib/qtslib_p.h b/src/platformsupport/input/tslib/qtslib_p.h
index c3ee6697fa..b6448c67d7 100644
--- a/src/platformsupport/input/tslib/qtslib_p.h
+++ b/src/platformsupport/input/tslib/qtslib_p.h
@@ -34,6 +34,17 @@
#ifndef QTSLIB_H
#define QTSLIB_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include <QObject>
struct tsdev;
diff --git a/src/platformsupport/linuxaccessibility/atspiadaptor.cpp b/src/platformsupport/linuxaccessibility/atspiadaptor.cpp
index d155cecd89..0293c74fb9 100644
--- a/src/platformsupport/linuxaccessibility/atspiadaptor.cpp
+++ b/src/platformsupport/linuxaccessibility/atspiadaptor.cpp
@@ -2312,7 +2312,7 @@ bool AtSpiAdaptor::tableInterface(QAccessibleInterface *interface, const QString
(column < 0) ||
(row >= interface->tableInterface()->rowCount()) ||
(column >= interface->tableInterface()->columnCount())) {
- qAtspiDebug() << "WARNING: invalid index for tableInterface GetAccessibleAt (" << row << ", " << column << ")";
+ qAtspiDebug() << "WARNING: invalid index for tableInterface GetAccessibleAt (" << row << ", " << column << ')';
return false;
}
@@ -2331,7 +2331,7 @@ bool AtSpiAdaptor::tableInterface(QAccessibleInterface *interface, const QString
int column = message.arguments().at(1).toInt();
QAccessibleInterface *cell = interface->tableInterface()->cellAt(row, column);
if (!cell) {
- qAtspiDebug() << "WARNING: AtSpiAdaptor::GetIndexAt(" << row << "," << column << ") did not find a cell. " << interface;
+ qAtspiDebug() << "WARNING: AtSpiAdaptor::GetIndexAt(" << row << ',' << column << ") did not find a cell. " << interface;
return false;
}
int index = interface->indexOfChild(cell);
diff --git a/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp b/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp
index fe03c7ac06..26d815d7ff 100644
--- a/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp
+++ b/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp
@@ -243,8 +243,13 @@ void QKdeThemePrivate::refresh()
toolButtonStyle = Qt::ToolButtonTextBesideIcon;
toolBarIconSize = 0;
styleNames.clear();
+ if (kdeVersion >= 5)
+ styleNames << QStringLiteral("breeze");
styleNames << QStringLiteral("Oxygen") << QStringLiteral("fusion") << QStringLiteral("windows");
- iconFallbackThemeName = iconThemeName = QStringLiteral("oxygen");
+ if (kdeVersion >= 5)
+ iconFallbackThemeName = iconThemeName = QStringLiteral("breeze");
+ else
+ iconFallbackThemeName = iconThemeName = QStringLiteral("oxygen");
QHash<QString, QSettings*> kdeSettings;
diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp
index 7258877eb7..3b8a85a26b 100644
--- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp
+++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp
@@ -845,7 +845,7 @@ QNetworkConfigurationPrivate *QNetworkManagerEngine::parseConnection(const QStri
QHashIterator<QString, QOfonoDataConnectionManagerInterface*> i(ofonoContextManagers);
while (i.hasNext()) {
i.next();
- const QString path = i.key() +"/"+contextPart;
+ const QString path = i.key() + QLatin1Char('/') +contextPart;
if (isActiveContext(path)) {
cpPriv->state |= QNetworkConfiguration::Active;
break;
@@ -1024,7 +1024,7 @@ QNetworkConfiguration::BearerType QNetworkManagerEngine::currentBearerType(const
QHashIterator<QString, QOfonoDataConnectionManagerInterface*> i(ofonoContextManagers);
while (i.hasNext()) {
i.next();
- QString contextPath = i.key() +"/"+contextPart;
+ QString contextPath = i.key() + QLatin1Char('/') +contextPart;
if (i.value()->contexts().contains(contextPath)) {
diff --git a/src/plugins/generic/tuiotouch/qtuiohandler.cpp b/src/plugins/generic/tuiotouch/qtuiohandler.cpp
index bc43a38bd8..2598bc5caf 100644
--- a/src/plugins/generic/tuiotouch/qtuiohandler.cpp
+++ b/src/plugins/generic/tuiotouch/qtuiohandler.cpp
@@ -203,7 +203,7 @@ void QTuioHandler::process2DCurAlive(const QOscMessage &message)
for (int i = 1; i < arguments.count(); ++i) {
if (QMetaType::Type(arguments.at(i).type()) != QMetaType::Int) {
- qWarning() << "Ignoring malformed TUIO alive message (bad argument on position" << i << arguments << ")";
+ qWarning() << "Ignoring malformed TUIO alive message (bad argument on position" << i << arguments << ')';
return;
}
diff --git a/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp
index 9a41244c63..f69bc5e401 100644
--- a/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp
+++ b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp
@@ -73,13 +73,18 @@ public:
delete connection;
}
+ static QString getSocketPath();
static QDBusConnection *createConnection();
+ void initBus();
+ void createBusProxy();
+
QDBusConnection *connection;
QIBusProxy *bus;
QIBusInputContextProxy *context;
bool valid;
+ bool busConnected;
QString predit;
bool needsSurroundingText;
};
@@ -88,12 +93,21 @@ public:
QIBusPlatformInputContext::QIBusPlatformInputContext ()
: d(new QIBusPlatformInputContextPrivate())
{
- if (d->context) {
- connect(d->context, SIGNAL(CommitText(QDBusVariant)), SLOT(commitText(QDBusVariant)));
- connect(d->context, SIGNAL(UpdatePreeditText(QDBusVariant,uint,bool)), this, SLOT(updatePreeditText(QDBusVariant,uint,bool)));
- connect(d->context, SIGNAL(DeleteSurroundingText(int,uint)), this, SLOT(deleteSurroundingText(int,uint)));
- connect(d->context, SIGNAL(RequireSurroundingText()), this, SLOT(surroundingTextRequired()));
+ QString socketPath = QIBusPlatformInputContextPrivate::getSocketPath();
+ QFile file(socketPath);
+ if (file.open(QFile::ReadOnly)) {
+ // If KDE session save is used or restart ibus-daemon,
+ // the applications could run before ibus-daemon runs.
+ // We watch the getSocketPath() to get the launching ibus-daemon.
+ m_socketWatcher.addPath(socketPath);
+ connect(&m_socketWatcher, SIGNAL(fileChanged(QString)), this, SLOT(socketChanged(QString)));
}
+
+ m_timer.setSingleShot(true);
+ connect(&m_timer, SIGNAL(timeout()), this, SLOT(connectToBus()));
+
+ connectToContextSignals();
+
QInputMethod *p = qApp->inputMethod();
connect(p, SIGNAL(cursorRectangleChanged()), this, SLOT(cursorRectChanged()));
m_eventFilterUseSynchronousMode = false;
@@ -117,7 +131,7 @@ bool QIBusPlatformInputContext::isValid() const
void QIBusPlatformInputContext::invokeAction(QInputMethod::Action a, int)
{
- if (!d->valid)
+ if (!d->busConnected)
return;
if (a == QInputMethod::Click)
@@ -128,7 +142,7 @@ void QIBusPlatformInputContext::reset()
{
QPlatformInputContext::reset();
- if (!d->valid)
+ if (!d->busConnected)
return;
d->context->Reset();
@@ -139,7 +153,7 @@ void QIBusPlatformInputContext::commit()
{
QPlatformInputContext::commit();
- if (!d->valid)
+ if (!d->busConnected)
return;
QObject *input = qApp->focusObject();
@@ -193,7 +207,7 @@ void QIBusPlatformInputContext::update(Qt::InputMethodQueries q)
void QIBusPlatformInputContext::cursorRectChanged()
{
- if (!d->valid)
+ if (!d->busConnected)
return;
QRect r = qApp->inputMethod()->cursorRectangle().toRect();
@@ -211,7 +225,7 @@ void QIBusPlatformInputContext::cursorRectChanged()
void QIBusPlatformInputContext::setFocusObject(QObject *object)
{
- if (!d->valid)
+ if (!d->busConnected)
return;
if (debug)
@@ -291,7 +305,7 @@ void QIBusPlatformInputContext::deleteSurroundingText(int offset, uint n_chars)
bool QIBusPlatformInputContext::filterEvent(const QEvent *event)
{
- if (!d->valid)
+ if (!d->busConnected)
return false;
if (!inputMethodAccepted())
@@ -400,13 +414,66 @@ void QIBusPlatformInputContext::filterEventFinished(QDBusPendingCallWatcher *cal
call->deleteLater();
}
+void QIBusPlatformInputContext::socketChanged(const QString &str)
+{
+ qCDebug(qtQpaInputMethods) << "socketChanged";
+ Q_UNUSED (str);
+
+ m_timer.stop();
+
+ if (d->context)
+ disconnect(d->context);
+ if (d->connection)
+ d->connection->disconnectFromBus(QLatin1String("QIBusProxy"));
+
+ m_timer.start(100);
+}
+
+// When getSocketPath() is modified, the bus is not established yet
+// so use m_timer.
+void QIBusPlatformInputContext::connectToBus()
+{
+ qCDebug(qtQpaInputMethods) << "QIBusPlatformInputContext::connectToBus";
+ d->initBus();
+ connectToContextSignals();
+
+ if (m_socketWatcher.files().size() == 0)
+ m_socketWatcher.addPath(QIBusPlatformInputContextPrivate::getSocketPath());
+}
+
+void QIBusPlatformInputContext::connectToContextSignals()
+{
+ if (d->context) {
+ connect(d->context, SIGNAL(CommitText(QDBusVariant)), SLOT(commitText(QDBusVariant)));
+ connect(d->context, SIGNAL(UpdatePreeditText(QDBusVariant,uint,bool)), this, SLOT(updatePreeditText(QDBusVariant,uint,bool)));
+ connect(d->context, SIGNAL(DeleteSurroundingText(int,uint)), this, SLOT(deleteSurroundingText(int,uint)));
+ connect(d->context, SIGNAL(RequireSurroundingText()), this, SLOT(surroundingTextRequired()));
+ }
+}
+
QIBusPlatformInputContextPrivate::QIBusPlatformInputContextPrivate()
- : connection(createConnection()),
+ : connection(0),
bus(0),
context(0),
valid(false),
+ busConnected(false),
needsSurroundingText(false)
{
+ valid = !QStandardPaths::findExecutable(QString::fromLocal8Bit("ibus-daemon"), QStringList()).isEmpty();
+ if (!valid)
+ return;
+ initBus();
+}
+
+void QIBusPlatformInputContextPrivate::initBus()
+{
+ connection = createConnection();
+ busConnected = false;
+ createBusProxy();
+}
+
+void QIBusPlatformInputContextPrivate::createBusProxy()
+{
if (!connection || !connection->isConnected())
return;
@@ -442,11 +509,11 @@ QIBusPlatformInputContextPrivate::QIBusPlatformInputContextPrivate()
context->SetCapabilities(IBUS_CAP_PREEDIT_TEXT|IBUS_CAP_FOCUS|IBUS_CAP_SURROUNDING_TEXT);
if (debug)
- qDebug(">>>> valid!");
- valid = true;
+ qDebug(">>>> bus connected!");
+ busConnected = true;
}
-QDBusConnection *QIBusPlatformInputContextPrivate::createConnection()
+QString QIBusPlatformInputContextPrivate::getSocketPath()
{
QByteArray display(qgetenv("DISPLAY"));
QByteArray host = "unix";
@@ -464,9 +531,14 @@ QDBusConnection *QIBusPlatformInputContextPrivate::createConnection()
if (debug)
qDebug() << "host=" << host << "displayNumber" << displayNumber;
- QFile file(QDir::homePath() + QLatin1String("/.config/ibus/bus/") +
+ return QDir::homePath() + QLatin1String("/.config/ibus/bus/") +
QLatin1String(QDBusConnection::localMachineId()) +
- QLatin1Char('-') + QString::fromLocal8Bit(host) + QLatin1Char('-') + QString::fromLocal8Bit(displayNumber));
+ QLatin1Char('-') + QString::fromLocal8Bit(host) + QLatin1Char('-') + QString::fromLocal8Bit(displayNumber);
+}
+
+QDBusConnection *QIBusPlatformInputContextPrivate::createConnection()
+{
+ QFile file(getSocketPath());
if (!file.open(QFile::ReadOnly))
return 0;
diff --git a/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.h b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.h
index 127db7df8b..a8efd9deb3 100644
--- a/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.h
+++ b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.h
@@ -37,7 +37,9 @@
#include <QtCore/qpointer.h>
#include <QtDBus/qdbuspendingreply.h>
+#include <QFileSystemWatcher>
#include <QLoggingCategory>
+#include <QTimer>
#include <QWindow>
QT_BEGIN_NAMESPACE
@@ -96,10 +98,16 @@ public Q_SLOTS:
void deleteSurroundingText(int offset, uint n_chars);
void surroundingTextRequired();
void filterEventFinished(QDBusPendingCallWatcher *call);
+ void socketChanged(const QString &str);
+ void connectToBus();
private:
QIBusPlatformInputContextPrivate *d;
bool m_eventFilterUseSynchronousMode;
+ QFileSystemWatcher m_socketWatcher;
+ QTimer m_timer;
+
+ void connectToContextSignals();
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/android/androidjniinput.cpp b/src/plugins/platforms/android/androidjniinput.cpp
index b410e5f68e..8982787ec9 100644
--- a/src/plugins/platforms/android/androidjniinput.cpp
+++ b/src/plugins/platforms/android/androidjniinput.cpp
@@ -278,7 +278,7 @@ namespace QtAndroidInput
}
#ifdef QT_DEBUG_ANDROID_STYLUS
- qDebug() << action << pointerType << buttonState << "@" << x << y << "pressure" << pressure << ": buttons" << buttons;
+ qDebug() << action << pointerType << buttonState << '@' << x << y << "pressure" << pressure << ": buttons" << buttons;
#endif
QWindowSystemInterface::handleTabletEvent(tlw, ulong(time),
@@ -681,7 +681,7 @@ namespace QtAndroidInput
return Qt::Key_AudioCycleTrack;
default:
- qWarning() << "Unhandled key code " << key << "!";
+ qWarning() << "Unhandled key code " << key << '!';
return 0;
}
}
diff --git a/src/plugins/platforms/android/androidjnimain.cpp b/src/plugins/platforms/android/androidjnimain.cpp
index cd40b7eec2..c7c82e255c 100644
--- a/src/plugins/platforms/android/androidjnimain.cpp
+++ b/src/plugins/platforms/android/androidjnimain.cpp
@@ -292,7 +292,7 @@ namespace QtAndroid
QString manufacturer = QJNIObjectPrivate::getStaticObjectField("android/os/Build", "MANUFACTURER", "Ljava/lang/String;").toString();
QString model = QJNIObjectPrivate::getStaticObjectField("android/os/Build", "MODEL", "Ljava/lang/String;").toString();
- return manufacturer + QStringLiteral(" ") + model;
+ return manufacturer + QLatin1Char(' ') + model;
}
int createSurface(AndroidSurfaceClient *client, const QRect &geometry, bool onTop, int imageDepth)
diff --git a/src/plugins/platforms/android/qandroidassetsfileenginehandler.cpp b/src/plugins/platforms/android/qandroidassetsfileenginehandler.cpp
index 64be75b63f..6ad3d2dc9a 100644
--- a/src/plugins/platforms/android/qandroidassetsfileenginehandler.cpp
+++ b/src/plugins/platforms/android/qandroidassetsfileenginehandler.cpp
@@ -122,8 +122,8 @@ public:
m_assetFile = 0;
m_assetDir = asset;
m_fileName = fileName;
- if (!m_fileName.endsWith(QChar(QLatin1Char('/'))))
- m_fileName += "/";
+ if (!m_fileName.endsWith(QLatin1Char('/')))
+ m_fileName += QLatin1Char('/');
}
~AndroidAbstractFileEngine()
@@ -231,8 +231,8 @@ public:
return;
m_fileName = file;
- if (!m_fileName.endsWith(QChar(QLatin1Char('/'))))
- m_fileName += "/";
+ if (!m_fileName.endsWith(QLatin1Char('/')))
+ m_fileName += QLatin1Char('/');
close();
}
diff --git a/src/plugins/platforms/android/qandroidinputcontext.cpp b/src/plugins/platforms/android/qandroidinputcontext.cpp
index b44340106d..e3ea048e84 100644
--- a/src/plugins/platforms/android/qandroidinputcontext.cpp
+++ b/src/plugins/platforms/android/qandroidinputcontext.cpp
@@ -342,7 +342,7 @@ QAndroidInputContext::QAndroidInputContext()
if (clazz == NULL) {
qCritical() << "Native registration unable to find class '"
<< QtNativeInputConnectionClassName
- << "'";
+ << '\'';
return;
}
@@ -350,7 +350,7 @@ QAndroidInputContext::QAndroidInputContext()
if (env->RegisterNatives(clazz, methods, sizeof(methods) / sizeof(methods[0])) < 0) {
qCritical() << "RegisterNatives failed for '"
<< QtNativeInputConnectionClassName
- << "'";
+ << '\'';
return;
}
@@ -358,7 +358,7 @@ QAndroidInputContext::QAndroidInputContext()
if (clazz == NULL) {
qCritical() << "Native registration unable to find class '"
<< QtExtractedTextClassName
- << "'";
+ << '\'';
return;
}
diff --git a/src/plugins/platforms/android/qandroidplatformfontdatabase.cpp b/src/plugins/platforms/android/qandroidplatformfontdatabase.cpp
index be1a3d7bdf..a8bbec9400 100644
--- a/src/plugins/platforms/android/qandroidplatformfontdatabase.cpp
+++ b/src/plugins/platforms/android/qandroidplatformfontdatabase.cpp
@@ -69,11 +69,11 @@ QStringList QAndroidPlatformFontDatabase::fallbacksForFamily(const QString &fami
{
QStringList result;
if (styleHint == QFont::Monospace || styleHint == QFont::Courier)
- result.append(QString(qgetenv("QT_ANDROID_FONTS_MONOSPACE")).split(";"));
+ result.append(QString(qgetenv("QT_ANDROID_FONTS_MONOSPACE")).split(QLatin1Char(';')));
else if (styleHint == QFont::Serif)
- result.append(QString(qgetenv("QT_ANDROID_FONTS_SERIF")).split(";"));
+ result.append(QString(qgetenv("QT_ANDROID_FONTS_SERIF")).split(QLatin1Char(';')));
else
- result.append(QString(qgetenv("QT_ANDROID_FONTS")).split(";"));
+ result.append(QString(qgetenv("QT_ANDROID_FONTS")).split(QLatin1Char(';')));
result.append(QPlatformFontDatabase::fallbacksForFamily(family, style, styleHint, script));
return result;
diff --git a/src/plugins/platforms/cocoa/qcocoacursor.mm b/src/plugins/platforms/cocoa/qcocoacursor.mm
index 2098f0dc8c..8e38181c29 100644
--- a/src/plugins/platforms/cocoa/qcocoacursor.mm
+++ b/src/plugins/platforms/cocoa/qcocoacursor.mm
@@ -303,7 +303,7 @@ NSCursor *QCocoaCursor::createCursorFromPixmap(const QPixmap pixmap, const QPoin
NSImage *nsimage;
if (pixmap.devicePixelRatio() > 1.0) {
QSize layoutSize = pixmap.size() / pixmap.devicePixelRatio();
- QPixmap scaledPixmap = pixmap.scaled(layoutSize);
+ QPixmap scaledPixmap = pixmap.scaled(layoutSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
nsimage = static_cast<NSImage *>(qt_mac_create_nsimage(scaledPixmap));
CGImageRef cgImage = qt_mac_toCGImage(pixmap.toImage());
NSBitmapImageRep *imageRep = [[NSBitmapImageRep alloc] initWithCGImage:cgImage];
diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.mm b/src/plugins/platforms/cocoa/qcocoahelpers.mm
index bb493ef2be..8ad80333f8 100644
--- a/src/plugins/platforms/cocoa/qcocoahelpers.mm
+++ b/src/plugins/platforms/cocoa/qcocoahelpers.mm
@@ -622,7 +622,7 @@ QString qt_mac_applicationName()
if (appName.isEmpty()) {
QString arg0 = QGuiApplicationPrivate::instance()->appName();
if (arg0.contains("/")) {
- QStringList parts = arg0.split("/");
+ QStringList parts = arg0.split(QLatin1Char('/'));
appName = parts.at(parts.count() - 1);
} else {
appName = arg0;
diff --git a/src/plugins/platforms/cocoa/qcocoamenu.mm b/src/plugins/platforms/cocoa/qcocoamenu.mm
index 57739f3a58..aa7a09805a 100644
--- a/src/plugins/platforms/cocoa/qcocoamenu.mm
+++ b/src/plugins/platforms/cocoa/qcocoamenu.mm
@@ -463,6 +463,13 @@ void QCocoaMenu::showPopup(const QWindow *parentWindow, const QRect &targetRect,
NSView *view = cocoaWindow ? cocoaWindow->contentView() : nil;
NSMenuItem *nsItem = item ? ((QCocoaMenuItem *)item)->nsItem() : nil;
+ QScreen *screen = 0;
+ if (parentWindow)
+ screen = parentWindow->screen();
+ if (!screen && !QGuiApplication::screens().isEmpty())
+ screen = QGuiApplication::screens().at(0);
+ Q_ASSERT(screen);
+
// Ideally, we would call -popUpMenuPositioningItem:atLocation:inView:.
// However, this showed not to work with modal windows where the menu items
// would appear disabled. So, we resort to a more artisanal solution. Note
@@ -479,6 +486,21 @@ void QCocoaMenu::showPopup(const QWindow *parentWindow, const QRect &targetRect,
[popupCell setTransparent:YES];
[popupCell setMenu:m_nativeMenu];
[popupCell selectItem:nsItem];
+
+ int availableHeight = screen->availableSize().height();
+ const QPoint &globalPos = parentWindow->mapToGlobal(pos);
+ int menuHeight = m_nativeMenu.size.height;
+ if (globalPos.y() + menuHeight > availableHeight) {
+ // Maybe we need to fix the vertical popup position but we don't know the
+ // exact popup height at the moment (and Cocoa is just guessing) nor its
+ // position. So, instead of translating by the popup's full height, we need
+ // to estimate where the menu will show up and translate by the remaining height.
+ float idx = ([m_nativeMenu indexOfItem:nsItem] + 1.0f) / m_nativeMenu.numberOfItems;
+ float heightBelowPos = (1.0 - idx) * menuHeight;
+ if (globalPos.y() + heightBelowPos > availableHeight)
+ pos.setY(pos.y() - globalPos.y() + availableHeight - heightBelowPos);
+ }
+
NSRect cellFrame = NSMakeRect(pos.x(), pos.y(), m_nativeMenu.minimumWidth, 10);
[popupCell performClickWithFrame:cellFrame inView:view];
} else {
@@ -487,22 +509,21 @@ void QCocoaMenu::showPopup(const QWindow *parentWindow, const QRect &targetRect,
if (view) {
// convert coordinates from view to the view's window
nsPos = [view convertPoint:nsPos toView:nil];
- } else if (!QGuiApplication::screens().isEmpty()) {
- QScreen *screen = QGuiApplication::screens().at(0);
+ } else {
nsPos.y = screen->availableVirtualSize().height() - nsPos.y;
}
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];
+ 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];
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.h b/src/plugins/platforms/cocoa/qcocoawindow.h
index f78a27614e..e830be212a 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.h
+++ b/src/plugins/platforms/cocoa/qcocoawindow.h
@@ -270,7 +270,6 @@ public: // for QNSView
QPointer<QWindow> m_enterLeaveTargetWindow;
bool m_windowUnderMouse;
- bool m_ignoreWindowShouldClose;
bool m_inConstructor;
bool m_inSetVisible;
bool m_inSetGeometry;
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
index f790259f0e..adfef81117 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
@@ -345,7 +345,6 @@ QCocoaWindow::QCocoaWindow(QWindow *tlw)
, m_synchedWindowState(Qt::WindowActive)
, m_windowModality(Qt::NonModal)
, m_windowUnderMouse(false)
- , m_ignoreWindowShouldClose(false)
, m_inConstructor(true)
, m_inSetVisible(false)
, m_inSetGeometry(false)
@@ -809,13 +808,10 @@ NSUInteger QCocoaWindow::windowStyleMask(Qt::WindowFlags flags)
return styleMask;
if ((type & Qt::Popup) == Qt::Popup) {
if (!windowIsPopupType(type)) {
- styleMask = NSUtilityWindowMask;
+ styleMask = NSUtilityWindowMask | NSResizableWindowMask;
if (!(flags & Qt::CustomizeWindowHint)) {
- styleMask |= NSResizableWindowMask | NSClosableWindowMask |
- NSMiniaturizableWindowMask | NSTitledWindowMask;
+ styleMask |= NSClosableWindowMask | NSMiniaturizableWindowMask | NSTitledWindowMask;
} else {
- if (flags & Qt::WindowMaximizeButtonHint)
- styleMask |= NSResizableWindowMask;
if (flags & Qt::WindowTitleHint)
styleMask |= NSTitledWindowMask;
if (flags & Qt::WindowCloseButtonHint)
@@ -1228,9 +1224,10 @@ void QCocoaWindow::windowDidEndLiveResize()
bool QCocoaWindow::windowShouldClose()
{
- // might have been set from qnsview.mm
- if (m_ignoreWindowShouldClose)
- return false;
+ // This callback should technically only determine if the window
+ // should (be allowed to) close, but since our QPA API to determine
+ // that also involves actually closing the window we do both at the
+ // same time, instead of doing the latter in windowWillClose.
bool accepted = false;
QWindowSystemInterface::handleCloseEvent(window(), &accepted);
QWindowSystemInterface::flushWindowSystemEvents();
@@ -1364,6 +1361,9 @@ void QCocoaWindow::recreateWindow(const QPlatformWindow *parentWindow)
[m_contentView setHidden: YES];
}
+ m_nsWindow.ignoresMouseEvents =
+ (window()->flags() & Qt::WindowTransparentForInput) == Qt::WindowTransparentForInput;
+
const qreal opacity = qt_window_private(window())->opacity;
if (!qFuzzyCompare(opacity, qreal(1.0)))
setOpacity(opacity);
diff --git a/src/plugins/platforms/cocoa/qnsview.h b/src/plugins/platforms/cocoa/qnsview.h
index a49a42378d..d7b9c3831b 100644
--- a/src/plugins/platforms/cocoa/qnsview.h
+++ b/src/plugins/platforms/cocoa/qnsview.h
@@ -76,6 +76,7 @@ Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper));
bool m_resendKeyEvent;
bool m_scrolling;
bool m_exposedOnMoveToWindow;
+ NSEvent *m_currentlyInterpretedKeyEvent;
}
- (id)init;
@@ -131,7 +132,6 @@ Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper));
- (void)handleKeyEvent:(NSEvent *)theEvent eventType:(int)eventType;
- (void)keyDown:(NSEvent *)theEvent;
- (void)keyUp:(NSEvent *)theEvent;
-- (BOOL)performKeyEquivalent:(NSEvent *)theEvent;
- (void)registerDragTypes;
- (NSDragOperation)handleDrag:(id <NSDraggingInfo>)sender;
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm
index 4db55c1b73..8c22e51fe2 100644
--- a/src/plugins/platforms/cocoa/qnsview.mm
+++ b/src/plugins/platforms/cocoa/qnsview.mm
@@ -152,6 +152,7 @@ static NSString *_q_NSWindowDidChangeOcclusionStateNotification = nil;
m_mouseMoveHelper = [[QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper) alloc] initWithView:self];
m_resendKeyEvent = false;
m_scrolling = false;
+ m_currentlyInterpretedKeyEvent = 0;
if (!touchDevice) {
touchDevice = new QTouchDevice;
@@ -709,8 +710,12 @@ QT_WARNING_POP
// Popups implicitly grap mouse events; forward to the active popup if there is one
if (QCocoaWindow *popup = QCocoaIntegration::instance()->activePopupWindow()) {
- if (QNSView *popupView = popup->qtView())
- targetView = popupView;
+ // Tooltips must be transparent for mouse events
+ // The bug reference is QTBUG-46379
+ if (!popup->m_windowFlags.testFlag(Qt::ToolTip)) {
+ if (QNSView *popupView = popup->qtView())
+ targetView = popupView;
+ }
}
[targetView convertFromScreen:[self screenMousePoint:theEvent] toWindowPoint:&qtWindowPoint andScreenPoint:&qtScreenPoint];
@@ -1436,41 +1441,40 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
if (!(modifiers & (Qt::ControlModifier | Qt::MetaModifier)) && (ch.unicode() < 0xf700 || ch.unicode() > 0xf8ff))
text = QCFString::toQString(characters);
- QWindow *focusWindow = [self topLevelWindow];
+ QWindow *window = [self topLevelWindow];
+
+ // Popups implicitly grab key events; forward to the active popup if there is one.
+ // This allows popups to e.g. intercept shortcuts and close the popup in response.
+ if (QCocoaWindow *popup = QCocoaIntegration::instance()->activePopupWindow())
+ window = popup->window();
if (eventType == QEvent::KeyPress) {
if (m_composingText.isEmpty()) {
- QKeyEvent override(QEvent::ShortcutOverride, keyCode, modifiers,
- nativeScanCode, nativeVirtualKey, nativeModifiers, text, [nsevent isARepeat], 1);
- override.setTimestamp(timestamp);
- m_sendKeyEvent = !QWindowSystemInterface::tryHandleShortcutOverrideEvent(focusWindow, &override);
+ m_sendKeyEvent = !QWindowSystemInterface::handleShortcutEvent(window, timestamp, keyCode,
+ modifiers, nativeScanCode, nativeVirtualKey, nativeModifiers, text, [nsevent isARepeat], 1);
}
QObject *fo = QGuiApplication::focusObject();
if (m_sendKeyEvent && fo) {
- // if escape is pressed we don't want interpretKeyEvents to close a dialog. This will be done via QWindowSystemInterface
- if (keyCode == Qt::Key_Escape)
- m_platformWindow->m_ignoreWindowShouldClose = true;
-
QInputMethodQueryEvent queryEvent(Qt::ImEnabled | Qt::ImHints);
if (QCoreApplication::sendEvent(fo, &queryEvent)) {
bool imEnabled = queryEvent.value(Qt::ImEnabled).toBool();
Qt::InputMethodHints hints = static_cast<Qt::InputMethodHints>(queryEvent.value(Qt::ImHints).toUInt());
if (imEnabled && !(hints & Qt::ImhDigitsOnly || hints & Qt::ImhFormattedNumbersOnly || hints & Qt::ImhHiddenText)) {
// pass the key event to the input method. note that m_sendKeyEvent may be set to false during this call
+ m_currentlyInterpretedKeyEvent = nsevent;
[self interpretKeyEvents:[NSArray arrayWithObject:nsevent]];
+ m_currentlyInterpretedKeyEvent = 0;
}
}
-
- m_platformWindow->m_ignoreWindowShouldClose = false;;
}
if (m_resendKeyEvent)
m_sendKeyEvent = true;
}
if (m_sendKeyEvent && m_composingText.isEmpty())
- QWindowSystemInterface::handleExtendedKeyEvent(focusWindow, timestamp, QEvent::Type(eventType), keyCode, modifiers,
+ QWindowSystemInterface::handleExtendedKeyEvent(window, timestamp, QEvent::Type(eventType), keyCode, modifiers,
nativeScanCode, nativeVirtualKey, nativeModifiers, text, [nsevent isARepeat], 1, false);
m_sendKeyEvent = false;
@@ -1491,21 +1495,23 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
[self handleKeyEvent:nsevent eventType:int(QEvent::KeyRelease)];
}
-- (BOOL)performKeyEquivalent:(NSEvent *)nsevent
+- (void)cancelOperation:(id)sender
{
- NSString *chars = [nsevent charactersIgnoringModifiers];
+ Q_UNUSED(sender);
- if ([nsevent type] == NSKeyDown && [chars length] > 0) {
- QChar ch = [chars characterAtIndex:0];
- Qt::Key qtKey = qt_mac_cocoaKey2QtKey(ch);
- // check for Command + Key_Period
- if ([nsevent modifierFlags] & NSCommandKeyMask
- && qtKey == Qt::Key_Period) {
- [self handleKeyEvent:nsevent eventType:int(QEvent::KeyPress)];
- return YES;
- }
- }
- return [super performKeyEquivalent:nsevent];
+ NSEvent *currentEvent = [NSApp currentEvent];
+ if (!currentEvent || currentEvent.type != NSKeyDown)
+ return;
+
+ // Handling the key event may recurse back here through interpretKeyEvents
+ // (when IM is enabled), so we need to guard against that.
+ if (currentEvent == m_currentlyInterpretedKeyEvent)
+ return;
+
+ // Send Command+Key_Period and Escape as normal keypresses so that
+ // the key sequence is delivered through Qt. That way clients can
+ // intercept the shortcut and override its effect.
+ [self handleKeyEvent:currentEvent eventType:int(QEvent::KeyPress)];
}
- (void)flagsChanged:(NSEvent *)nsevent
diff --git a/src/plugins/platforms/directfb/qdirectfbblitter.cpp b/src/plugins/platforms/directfb/qdirectfbblitter.cpp
index 4deac969e4..b87310ed76 100644
--- a/src/plugins/platforms/directfb/qdirectfbblitter.cpp
+++ b/src/plugins/platforms/directfb/qdirectfbblitter.cpp
@@ -473,7 +473,7 @@ IDirectFBSurface *QDirectFbTextureGlyphCache::sourceSurface()
case QImage::Format_Mono:
desc.pixelformat = DSPF_A1;
break;
- case QImage::Format_Indexed8:
+ case QImage::Format_Alpha8:
desc.pixelformat = DSPF_A8;
break;
default:
diff --git a/src/plugins/platforms/eglfs/deviceintegration/deviceintegration.pro b/src/plugins/platforms/eglfs/deviceintegration/deviceintegration.pro
index 0adbb0d49f..cf367d930f 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/deviceintegration.pro
+++ b/src/plugins/platforms/eglfs/deviceintegration/deviceintegration.pro
@@ -1,7 +1,8 @@
TEMPLATE = subdirs
contains(QT_CONFIG, egl_x11): SUBDIRS += eglfs_x11
-contains(QT_CONFIG, kms): SUBDIRS += eglfs_kms
+contains(QT_CONFIG, eglfs_gbm): SUBDIRS += eglfs_kms
+contains(QT_CONFIG, eglfs_egldevice): SUBDIRS += eglfs_kms_egldevice
contains(QT_CONFIG, eglfs_brcm): SUBDIRS += eglfs_brcm
contains(QT_CONFIG, eglfs_mali): SUBDIRS += eglfs_mali
contains(QT_CONFIG, eglfs_viv): SUBDIRS += eglfs_viv
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsdevice.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsdevice.cpp
index f3df1f8445..c29d64c06d 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsdevice.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsdevice.cpp
@@ -191,6 +191,12 @@ QEglFSKmsScreen *QEglFSKmsDevice::screenForConnector(drmModeResPtr resources, dr
return Q_NULLPTR;
}
+ // Skip disconnected output
+ if (configuration == OutputConfigPreferred && connector->connection == DRM_MODE_DISCONNECTED) {
+ qCDebug(qLcEglfsKmsDebug) << "Skipping disconnected output" << connectorName;
+ return Q_NULLPTR;
+ }
+
// Get the current mode on the current crtc
drmModeModeInfo crtc_mode;
memset(&crtc_mode, 0, sizeof crtc_mode);
@@ -213,7 +219,7 @@ QEglFSKmsScreen *QEglFSKmsDevice::screenForConnector(drmModeResPtr resources, dr
for (int i = 0; i < connector->count_modes; i++) {
const drmModeModeInfo &mode = connector->modes[i];
qCDebug(qLcEglfsKmsDebug) << "mode" << i << mode.hdisplay << "x" << mode.vdisplay
- << "@" << mode.vrefresh << "hz";
+ << '@' << mode.vrefresh << "hz";
modes << connector->modes[i];
}
@@ -272,7 +278,7 @@ QEglFSKmsScreen *QEglFSKmsDevice::screenForConnector(drmModeResPtr resources, dr
int height = modes[selected_mode].vdisplay;
int refresh = modes[selected_mode].vrefresh;
qCDebug(qLcEglfsKmsDebug) << "Selected mode" << selected_mode << ":" << width << "x" << height
- << "@" << refresh << "hz for output" << connectorName;
+ << '@' << refresh << "hz for output" << connectorName;
}
QEglFSKmsOutput output = {
@@ -284,6 +290,7 @@ QEglFSKmsScreen *QEglFSKmsDevice::screenForConnector(drmModeResPtr resources, dr
false,
drmModeGetCrtc(m_dri_fd, crtc_id),
modes,
+ connector->subpixel,
connectorProperty(connector, QByteArrayLiteral("DPMS"))
};
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsscreen.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsscreen.cpp
index 227c8f9a62..60586f98a7 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsscreen.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsscreen.cpp
@@ -52,15 +52,11 @@ public:
QEglFSKmsInterruptHandler(QEglFSKmsScreen *screen) : m_screen(screen) {
m_vtHandler = static_cast<QEglFSIntegration *>(QGuiApplicationPrivate::platformIntegration())->vtHandler();
connect(m_vtHandler, &QFbVtHandler::interrupted, this, &QEglFSKmsInterruptHandler::restoreVideoMode);
- connect(m_vtHandler, &QFbVtHandler::suspendRequested, this, &QEglFSKmsInterruptHandler::handleSuspendRequest);
+ connect(m_vtHandler, &QFbVtHandler::aboutToSuspend, this, &QEglFSKmsInterruptHandler::restoreVideoMode);
}
public slots:
void restoreVideoMode() { m_screen->restoreMode(); }
- void handleSuspendRequest() {
- m_screen->restoreMode();
- m_vtHandler->suspend();
- }
private:
QFbVtHandler *m_vtHandler;
@@ -321,6 +317,24 @@ qreal QEglFSKmsScreen::refreshRate() const
return refresh > 0 ? refresh : 60;
}
+QPlatformScreen::SubpixelAntialiasingType QEglFSKmsScreen::subpixelAntialiasingTypeHint() const
+{
+ switch (m_output.subpixel) {
+ default:
+ case DRM_MODE_SUBPIXEL_UNKNOWN:
+ case DRM_MODE_SUBPIXEL_NONE:
+ return Subpixel_None;
+ case DRM_MODE_SUBPIXEL_HORIZONTAL_RGB:
+ return Subpixel_RGB;
+ case DRM_MODE_SUBPIXEL_HORIZONTAL_BGR:
+ return Subpixel_BGR;
+ case DRM_MODE_SUBPIXEL_VERTICAL_RGB:
+ return Subpixel_VRGB;
+ case DRM_MODE_SUBPIXEL_VERTICAL_BGR:
+ return Subpixel_VBGR;
+ }
+}
+
QPlatformScreen::PowerState QEglFSKmsScreen::powerState() const
{
return m_powerState;
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsscreen.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsscreen.h
index 2ce8700478..7fd6ccaa31 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsscreen.h
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsscreen.h
@@ -60,6 +60,7 @@ struct QEglFSKmsOutput
bool mode_set;
drmModeCrtcPtr saved_crtc;
QList<drmModeModeInfo> modes;
+ int subpixel;
drmModePropertyPtr dpms_prop;
};
@@ -104,6 +105,8 @@ public:
QEglFSKmsOutput &output() { return m_output; }
void restoreMode();
+ SubpixelAntialiasingType subpixelAntialiasingTypeHint() const Q_DECL_OVERRIDE;
+
QPlatformScreen::PowerState powerState() const Q_DECL_OVERRIDE;
void setPowerState(QPlatformScreen::PowerState state) Q_DECL_OVERRIDE;
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/eglfs_kms_egldevice.json b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/eglfs_kms_egldevice.json
new file mode 100644
index 0000000000..169ba1eb02
--- /dev/null
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/eglfs_kms_egldevice.json
@@ -0,0 +1,3 @@
+{
+ "Keys": [ "eglfs_kms_egldevice" ]
+}
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/eglfs_kms_egldevice.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/eglfs_kms_egldevice.pro
new file mode 100644
index 0000000000..2274c5b228
--- /dev/null
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/eglfs_kms_egldevice.pro
@@ -0,0 +1,21 @@
+TARGET = qeglfs-kms-egldevice-integration
+
+PLUGIN_TYPE = egldeviceintegrations
+PLUGIN_CLASS_NAME = QEglFSKmsEglDeviceIntegrationPlugin
+load(qt_plugin)
+
+QT += core-private gui-private platformsupport-private eglfs_device_lib-private
+
+INCLUDEPATH += $$PWD/../..
+
+CONFIG += egl
+QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF
+
+SOURCES += $$PWD/qeglfskmsegldevicemain.cpp \
+ $$PWD/qeglfskmsegldeviceintegration.cpp
+
+HEADERS += $$PWD/qeglfskmsegldeviceintegration.h
+
+OTHER_FILES += $$PWD/eglfs_kms_egldevice.json
+
+LIBS += -ldrm
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp
new file mode 100644
index 0000000000..2f32bd73a3
--- /dev/null
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp
@@ -0,0 +1,464 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qeglfskmsegldeviceintegration.h"
+#include <QLoggingCategory>
+
+QT_BEGIN_NAMESPACE
+
+Q_LOGGING_CATEGORY(qLcEglfsKmsDebug, "qt.qpa.eglfs.kms")
+
+QEglFSKmsEglDeviceIntegration::QEglFSKmsEglDeviceIntegration()
+ : m_dri_fd(-1)
+ , m_egl_device(EGL_NO_DEVICE_EXT)
+ , m_egl_display(EGL_NO_DISPLAY)
+ , m_drm_connector(Q_NULLPTR)
+ , m_drm_encoder(Q_NULLPTR)
+ , m_drm_crtc(0)
+{
+ qCDebug(qLcEglfsKmsDebug, "New DRM/KMS on EGLDevice integration created");
+}
+
+void QEglFSKmsEglDeviceIntegration::platformInit()
+{
+ if (!query_egl_device())
+ qFatal("Could not set up EGL device!");
+
+ const char *deviceName = m_query_device_string(m_egl_device, EGL_DRM_DEVICE_FILE_EXT);
+ if (!deviceName)
+ qFatal("Failed to query device name from EGLDevice");
+
+ qCDebug(qLcEglfsKmsDebug, "Opening %s", deviceName);
+
+ m_dri_fd = drmOpen(deviceName, Q_NULLPTR);
+ if (m_dri_fd < 0)
+ qFatal("Could not open DRM device");
+
+ if (!setup_kms())
+ qFatal("Could not set up KMS on device %s!", m_device.constData());
+
+ qCDebug(qLcEglfsKmsDebug, "DRM/KMS initialized");
+}
+
+void QEglFSKmsEglDeviceIntegration::platformDestroy()
+{
+ if (qt_safe_close(m_dri_fd) == -1)
+ qErrnoWarning("Could not close DRM device");
+
+ m_dri_fd = -1;
+}
+
+EGLNativeDisplayType QEglFSKmsEglDeviceIntegration::platformDisplay() const
+{
+ return static_cast<EGLNativeDisplayType>(m_egl_device);
+}
+
+EGLDisplay QEglFSKmsEglDeviceIntegration::createDisplay(EGLNativeDisplayType nativeDisplay)
+{
+ qCDebug(qLcEglfsKmsDebug, "Creating display");
+
+ const char *extensions = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
+
+ m_get_platform_display = reinterpret_cast<PFNEGLGETPLATFORMDISPLAYEXTPROC>(eglGetProcAddress("eglGetPlatformDisplayEXT"));
+ m_has_egl_platform_device = extensions && strstr(extensions, "EGL_EXT_platform_device");
+
+ EGLDisplay display;
+
+ if (!m_has_egl_platform_device) {
+ qWarning("EGL_EXT_platform_device not available, falling back to legacy path!");
+ display = eglGetDisplay(nativeDisplay);
+ } else {
+ display = m_get_platform_display(EGL_PLATFORM_DEVICE_EXT, nativeDisplay, Q_NULLPTR);
+ }
+
+ if (display == EGL_NO_DISPLAY)
+ qFatal("Could not get EGL display");
+
+ EGLint major, minor;
+ if (!eglInitialize(display, &major, &minor))
+ qFatal("Could not initialize egl display");
+
+ if (!eglBindAPI(EGL_OPENGL_ES_API))
+ qFatal("Failed to bind EGL_OPENGL_ES_API\n");
+
+ return display;
+}
+
+QSizeF QEglFSKmsEglDeviceIntegration::physicalScreenSize() const
+{
+ return QSizeF(m_drm_connector->mmWidth, m_drm_connector->mmHeight);
+}
+
+QSize QEglFSKmsEglDeviceIntegration::screenSize() const
+{
+ return QSize(m_drm_mode.hdisplay, m_drm_mode.vdisplay);
+}
+
+int QEglFSKmsEglDeviceIntegration::screenDepth() const
+{
+ return 32;
+}
+
+QSurfaceFormat QEglFSKmsEglDeviceIntegration::surfaceFormatFor(const QSurfaceFormat &inputFormat) const
+{
+ QSurfaceFormat format(inputFormat);
+ format.setRenderableType(QSurfaceFormat::OpenGLES);
+ format.setSwapBehavior(QSurfaceFormat::DoubleBuffer);
+ format.setRedBufferSize(8);
+ format.setGreenBufferSize(8);
+ format.setBlueBufferSize(8);
+ return format;
+}
+
+EGLint QEglFSKmsEglDeviceIntegration::surfaceType() const
+{
+ return EGL_STREAM_BIT_KHR;
+}
+
+class QEglJetsonTK1Window : public QEglFSWindow
+{
+public:
+ QEglJetsonTK1Window(QWindow *w, const QEglFSKmsEglDeviceIntegration *integration)
+ : QEglFSWindow(w)
+ , m_integration(integration)
+ , m_egl_stream(EGL_NO_STREAM_KHR)
+ { }
+
+ void invalidateSurface() Q_DECL_OVERRIDE;
+ void resetSurface() Q_DECL_OVERRIDE;
+
+ const QEglFSKmsEglDeviceIntegration *m_integration;
+ EGLStreamKHR m_egl_stream;
+ EGLint m_latency;
+};
+
+void QEglJetsonTK1Window::invalidateSurface()
+{
+ QEglFSWindow::invalidateSurface();
+ m_integration->m_destroy_stream(screen()->display(), m_egl_stream);
+}
+
+void QEglJetsonTK1Window::resetSurface()
+{
+ qCDebug(qLcEglfsKmsDebug, "Creating stream");
+
+ EGLDisplay display = screen()->display();
+ EGLOutputLayerEXT layer = EGL_NO_OUTPUT_LAYER_EXT;
+ EGLint count;
+
+ m_egl_stream = m_integration->m_create_stream(display, Q_NULLPTR);
+ if (m_egl_stream == EGL_NO_STREAM_KHR) {
+ qWarning("resetSurface: Couldn't create EGLStream for native window");
+ return;
+ }
+
+ qCDebug(qLcEglfsKmsDebug, "Created stream %p on display %p", m_egl_stream, display);
+
+ if (!m_integration->m_get_output_layers(display, Q_NULLPTR, Q_NULLPTR, 0, &count) || count == 0) {
+ qWarning("No output layers found");
+ return;
+ }
+
+ qCDebug(qLcEglfsKmsDebug, "Output has %d layers", count);
+
+ QVector<EGLOutputLayerEXT> layers;
+ layers.resize(count);
+ EGLint actualCount;
+ if (!m_integration->m_get_output_layers(display, Q_NULLPTR, layers.data(), count, &actualCount)) {
+ qWarning("Failed to get layers");
+ return;
+ }
+
+ for (int i = 0; i < actualCount; ++i) {
+ EGLAttrib id;
+ if (m_integration->m_query_output_layer_attrib(display, layers[i], EGL_DRM_CRTC_EXT, &id)) {
+ qCDebug(qLcEglfsKmsDebug, " [%d] layer %p - crtc %d", i, layers[i], id);
+ if (id == EGLAttrib(m_integration->m_drm_crtc))
+ layer = layers[i];
+ } else if (m_integration->m_query_output_layer_attrib(display, layers[i], EGL_DRM_PLANE_EXT, &id)) {
+ // Not used yet, just for debugging.
+ qCDebug(qLcEglfsKmsDebug, " [%d] layer %p - plane %d", i, layers[i], id);
+ } else {
+ qCDebug(qLcEglfsKmsDebug, " [%d] layer %p - unknown", i, layers[i]);
+ }
+ }
+
+ QByteArray reqLayerIndex = qgetenv("QT_QPA_EGLFS_LAYER_INDEX");
+ if (!reqLayerIndex.isEmpty()) {
+ int idx = reqLayerIndex.toInt();
+ if (idx >= 0 && idx < layers.count())
+ layer = layers[idx];
+ }
+
+ if (layer == EGL_NO_OUTPUT_LAYER_EXT) {
+ qWarning("resetSurface: Couldn't get EGLOutputLayer for native window");
+ return;
+ }
+
+ qCDebug(qLcEglfsKmsDebug, "Using layer %p", layer);
+
+ if (!m_integration->m_stream_consumer_output(display, m_egl_stream, layer))
+ qWarning("resetSurface: Unable to connect stream");
+
+ m_config = QEglFSIntegration::chooseConfig(display, m_integration->surfaceFormatFor(window()->requestedFormat()));
+ m_format = q_glFormatFromConfig(display, m_config);
+ qCDebug(qLcEglfsKmsDebug) << "Stream producer format is" << m_format;
+
+ const int w = m_integration->screenSize().width();
+ const int h = m_integration->screenSize().height();
+ qCDebug(qLcEglfsKmsDebug, "Creating stream producer surface of size %dx%d", w, h);
+
+ const EGLint stream_producer_attribs[] = {
+ EGL_WIDTH, w,
+ EGL_HEIGHT, h,
+ EGL_NONE
+ };
+
+ m_surface = m_integration->m_create_stream_producer_surface(display, m_config, m_egl_stream, stream_producer_attribs);
+ if (m_surface == EGL_NO_SURFACE)
+ return;
+
+ qCDebug(qLcEglfsKmsDebug, "Created stream producer surface %p", m_surface);
+}
+
+QEglFSWindow *QEglFSKmsEglDeviceIntegration::createWindow(QWindow *window) const
+{
+ QEglJetsonTK1Window *eglWindow = new QEglJetsonTK1Window(window, this);
+
+ if (!const_cast<QEglFSKmsEglDeviceIntegration *>(this)->query_egl_extensions(eglWindow->screen()->display()))
+ qFatal("Required extensions missing!");
+
+ return eglWindow;
+}
+
+bool QEglFSKmsEglDeviceIntegration::hasCapability(QPlatformIntegration::Capability cap) const
+{
+ switch (cap) {
+ case QPlatformIntegration::ThreadedPixmaps:
+ case QPlatformIntegration::OpenGL:
+ case QPlatformIntegration::ThreadedOpenGL:
+ case QPlatformIntegration::BufferQueueingOpenGL:
+ return true;
+ default:
+ return false;
+ }
+}
+
+void QEglFSKmsEglDeviceIntegration::waitForVSync(QPlatformSurface *) const
+{
+ static bool mode_set = false;
+
+ if (!mode_set) {
+ mode_set = true;
+
+ drmModeCrtcPtr currentMode = drmModeGetCrtc(m_dri_fd, m_drm_crtc);
+ const bool alreadySet = currentMode
+ && currentMode->width == m_drm_mode.hdisplay
+ && currentMode->height == m_drm_mode.vdisplay;
+ if (currentMode)
+ drmModeFreeCrtc(currentMode);
+ if (alreadySet) {
+ qCDebug(qLcEglfsKmsDebug, "Mode already set");
+ return;
+ }
+
+ qCDebug(qLcEglfsKmsDebug, "Setting mode");
+ int ret = drmModeSetCrtc(m_dri_fd, m_drm_crtc,
+ -1, 0, 0,
+ &m_drm_connector->connector_id, 1,
+ const_cast<const drmModeModeInfoPtr>(&m_drm_mode));
+ if (ret)
+ qFatal("drmModeSetCrtc failed");
+ }
+}
+
+qreal QEglFSKmsEglDeviceIntegration::refreshRate() const
+{
+ quint32 refresh = m_drm_mode.vrefresh;
+ return refresh > 0 ? refresh : 60;
+}
+
+bool QEglFSKmsEglDeviceIntegration::supportsSurfacelessContexts() const
+{
+ // Returning false disables the usage of EGL_KHR_surfaceless_context even when the
+ // extension is available. This is just what we need since, at least with NVIDIA
+ // 352.00 making a null surface current with a context breaks.
+ return false;
+}
+
+bool QEglFSKmsEglDeviceIntegration::setup_kms()
+{
+ drmModeRes *resources;
+ drmModeConnector *connector;
+ drmModeEncoder *encoder;
+ quint32 crtc = 0;
+ int i;
+
+ resources = drmModeGetResources(m_dri_fd);
+ if (!resources) {
+ qWarning("drmModeGetResources failed");
+ return false;
+ }
+
+ for (i = 0; i < resources->count_connectors; i++) {
+ connector = drmModeGetConnector(m_dri_fd, resources->connectors[i]);
+ if (!connector)
+ continue;
+
+ if (connector->connection == DRM_MODE_CONNECTED && connector->count_modes > 0)
+ break;
+
+ drmModeFreeConnector(connector);
+ }
+
+ if (i == resources->count_connectors) {
+ qWarning("No currently active connector found.");
+ return false;
+ }
+
+ qCDebug(qLcEglfsKmsDebug, "Using connector with type %d", connector->connector_type);
+
+ for (i = 0; i < resources->count_encoders; i++) {
+ encoder = drmModeGetEncoder(m_dri_fd, resources->encoders[i]);
+ if (!encoder)
+ continue;
+
+ if (encoder->encoder_id == connector->encoder_id)
+ break;
+
+ drmModeFreeEncoder(encoder);
+ }
+
+ for (int j = 0; j < resources->count_crtcs; j++) {
+ if ((encoder->possible_crtcs & (1 << j))) {
+ crtc = resources->crtcs[j];
+ break;
+ }
+ }
+
+ if (crtc == 0)
+ qFatal("No suitable CRTC available");
+
+ m_drm_connector = connector;
+ m_drm_encoder = encoder;
+ m_drm_mode = connector->modes[0];
+ m_drm_crtc = crtc;
+
+ qCDebug(qLcEglfsKmsDebug).noquote() << "Using crtc" << m_drm_crtc
+ << "with mode" << m_drm_mode.hdisplay << "x" << m_drm_mode.vdisplay
+ << "@" << m_drm_mode.vrefresh;
+
+ drmModeFreeResources(resources);
+
+ return true;
+}
+
+bool QEglFSKmsEglDeviceIntegration::query_egl_device()
+{
+ const char *extensions = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
+ if (!extensions) {
+ qWarning("eglQueryString failed");
+ return false;
+ }
+
+ m_has_egl_device_base = strstr(extensions, "EGL_EXT_device_base");
+ m_query_devices = reinterpret_cast<PFNEGLQUERYDEVICESEXTPROC>(eglGetProcAddress("eglQueryDevicesEXT"));
+ m_query_device_string = reinterpret_cast<PFNEGLQUERYDEVICESTRINGEXTPROC>(eglGetProcAddress("eglQueryDeviceStringEXT"));
+
+ if (!m_has_egl_device_base || !m_query_devices || !m_query_device_string)
+ qFatal("EGL_EXT_device_base missing");
+
+ EGLint num_devices = 0;
+ if (m_query_devices(1, &m_egl_device, &num_devices) != EGL_TRUE) {
+ qWarning("eglQueryDevicesEXT failed: eglError: %x", eglGetError());
+ return false;
+ }
+
+ qCDebug(qLcEglfsKmsDebug, "Found %d EGL devices", num_devices);
+
+ if (num_devices < 1 || m_egl_device == EGL_NO_DEVICE_EXT) {
+ qWarning("eglQueryDevicesEXT could not find any EGL devices");
+ return false;
+ }
+
+ return true;
+}
+
+bool QEglFSKmsEglDeviceIntegration::query_egl_extensions(EGLDisplay display)
+{
+ if (!eglBindAPI(EGL_OPENGL_ES_API)) {
+ qWarning() << Q_FUNC_INFO << "failed to bind EGL_OPENGL_ES_API";
+ return false;
+ }
+
+ m_create_stream = reinterpret_cast<PFNEGLCREATESTREAMKHRPROC>(eglGetProcAddress("eglCreateStreamKHR"));
+ m_destroy_stream = reinterpret_cast<PFNEGLDESTROYSTREAMKHRPROC>(eglGetProcAddress("eglDestroyStreamKHR"));
+ m_stream_attrib = reinterpret_cast<PFNEGLSTREAMATTRIBKHRPROC>(eglGetProcAddress("eglStreamAttribKHR"));
+ m_query_stream = reinterpret_cast<PFNEGLQUERYSTREAMKHRPROC>(eglGetProcAddress("eglQueryStreamKHR"));
+ m_query_stream_u64 = reinterpret_cast<PFNEGLQUERYSTREAMU64KHRPROC>(eglGetProcAddress("eglQueryStreamu64KHR"));
+ m_create_stream_producer_surface = reinterpret_cast<PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC>(eglGetProcAddress("eglCreateStreamProducerSurfaceKHR"));
+ m_stream_consumer_output = reinterpret_cast<PFNEGLSTREAMCONSUMEROUTPUTEXTPROC>(eglGetProcAddress("eglStreamConsumerOutputEXT"));
+ m_get_output_layers = reinterpret_cast<PFNEGLGETOUTPUTLAYERSEXTPROC>(eglGetProcAddress("eglGetOutputLayersEXT"));
+ m_get_output_ports = reinterpret_cast<PFNEGLGETOUTPUTPORTSEXTPROC>(eglGetProcAddress("eglGetOutputPortsEXT"));
+ m_output_layer_attrib = reinterpret_cast<PFNEGLOUTPUTLAYERATTRIBEXTPROC>(eglGetProcAddress("eglOutputLayerAttribEXT"));
+ m_query_output_layer_attrib = reinterpret_cast<PFNEGLQUERYOUTPUTLAYERATTRIBEXTPROC>(eglGetProcAddress("eglQueryOutputLayerAttribEXT"));
+ m_query_output_layer_string = reinterpret_cast<PFNEGLQUERYOUTPUTLAYERSTRINGEXTPROC>(eglGetProcAddress("eglQueryOutputLayerStringEXT"));
+ m_query_output_port_attrib = reinterpret_cast<PFNEGLQUERYOUTPUTPORTATTRIBEXTPROC>(eglGetProcAddress("eglQueryOutputPortAttribEXT"));
+ m_query_output_port_string = reinterpret_cast<PFNEGLQUERYOUTPUTPORTSTRINGEXTPROC>(eglGetProcAddress("eglQueryOutputPortStringEXT"));
+ m_get_stream_file_descriptor = reinterpret_cast<PFNEGLGETSTREAMFILEDESCRIPTORKHRPROC>(eglGetProcAddress("eglGetStreamFileDescriptorKHR"));
+ m_create_stream_from_file_descriptor = reinterpret_cast<PFNEGLCREATESTREAMFROMFILEDESCRIPTORKHRPROC>(eglGetProcAddress("eglCreateStreamFromFileDescriptorKHR"));
+ m_stream_consumer_gltexture = reinterpret_cast<PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALKHRPROC>(eglGetProcAddress("eglStreamConsumerGLTextureExternalKHR"));
+ m_stream_consumer_acquire = reinterpret_cast<PFNEGLSTREAMCONSUMERACQUIREKHRPROC>(eglGetProcAddress("eglStreamConsumerAcquireKHR"));
+
+ const char *extensions = eglQueryString(display, EGL_EXTENSIONS);
+ if (!extensions) {
+ qWarning() << Q_FUNC_INFO << "eglQueryString failed";
+ return false;
+ }
+
+ m_has_egl_stream = strstr(extensions, "EGL_KHR_stream");
+ m_has_egl_stream_producer_eglsurface = strstr(extensions, "EGL_KHR_stream_producer_eglsurface");
+ m_has_egl_stream_consumer_egloutput = strstr(extensions, "EGL_EXT_stream_consumer_egloutput");
+ m_has_egl_output_drm = strstr(extensions, "EGL_EXT_output_drm");
+ m_has_egl_output_base = strstr(extensions, "EGL_EXT_output_base");
+ m_has_egl_stream_cross_process_fd = strstr(extensions, "EGL_KHR_stream_cross_process_fd");
+ m_has_egl_stream_consumer_gltexture = strstr(extensions, "EGL_KHR_stream_consumer_gltexture");
+
+ return m_has_egl_output_base &&
+ m_has_egl_output_drm &&
+ m_has_egl_stream &&
+ m_has_egl_stream_producer_eglsurface &&
+ m_has_egl_stream_consumer_egloutput;
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.h
new file mode 100644
index 0000000000..c6132354a8
--- /dev/null
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.h
@@ -0,0 +1,137 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QEGLFSKMSEGLDEVICEINTEGRATION_H
+#define QEGLFSKMSEGLDEVICEINTEGRATION_H
+
+#include "qeglfsdeviceintegration.h"
+#include "qeglfswindow.h"
+#include "qeglfsintegration.h"
+
+#include <QtPlatformSupport/private/qdevicediscovery_p.h>
+#include <QtPlatformSupport/private/qeglconvenience_p.h>
+#include <QtCore/private/qcore_unix_p.h>
+#include <QtCore/QScopedPointer>
+#include <QtGui/qpa/qplatformwindow.h>
+#include <QtGui/qguiapplication.h>
+#include <QDebug>
+
+#include <xf86drm.h>
+#include <xf86drmMode.h>
+
+#include <EGL/egl.h>
+#include <EGL/eglext.h>
+
+QT_BEGIN_NAMESPACE
+
+class QEglFSKmsEglDeviceIntegration : public QEGLDeviceIntegration
+{
+public:
+ QEglFSKmsEglDeviceIntegration();
+
+ void platformInit() Q_DECL_OVERRIDE;
+ void platformDestroy() Q_DECL_OVERRIDE;
+ EGLNativeDisplayType platformDisplay() const Q_DECL_OVERRIDE;
+ EGLDisplay createDisplay(EGLNativeDisplayType nativeDisplay) Q_DECL_OVERRIDE;
+ QSizeF physicalScreenSize() const Q_DECL_OVERRIDE;
+ QSize screenSize() const Q_DECL_OVERRIDE;
+ int screenDepth() const Q_DECL_OVERRIDE;
+ qreal refreshRate() const Q_DECL_OVERRIDE;
+ QSurfaceFormat surfaceFormatFor(const QSurfaceFormat &inputFormat) const Q_DECL_OVERRIDE;
+ EGLint surfaceType() const Q_DECL_OVERRIDE;
+ QEglFSWindow *createWindow(QWindow *window) const Q_DECL_OVERRIDE;
+ bool hasCapability(QPlatformIntegration::Capability cap) const Q_DECL_OVERRIDE;
+ void waitForVSync(QPlatformSurface *surface) const Q_DECL_OVERRIDE;
+ bool supportsSurfacelessContexts() const Q_DECL_OVERRIDE;
+
+ bool setup_kms();
+
+ bool query_egl_device();
+ bool query_egl_extensions(EGLDisplay display);
+
+ // device bits
+ QByteArray m_device;
+ int m_dri_fd;
+ EGLDeviceEXT m_egl_device;
+ EGLDisplay m_egl_display;
+
+ // KMS bits
+ drmModeConnector *m_drm_connector;
+ drmModeEncoder *m_drm_encoder;
+ drmModeModeInfo m_drm_mode;
+ quint32 m_drm_crtc;
+
+ // EGLStream infrastructure
+ PFNEGLGETPLATFORMDISPLAYEXTPROC m_get_platform_display;
+ bool m_has_egl_platform_device;
+
+ PFNEGLQUERYDEVICESEXTPROC m_query_devices;
+ PFNEGLQUERYDEVICESTRINGEXTPROC m_query_device_string;
+ bool m_has_egl_device_base;
+
+ PFNEGLCREATESTREAMKHRPROC m_create_stream;
+ PFNEGLDESTROYSTREAMKHRPROC m_destroy_stream;
+ PFNEGLSTREAMATTRIBKHRPROC m_stream_attrib;
+ PFNEGLQUERYSTREAMKHRPROC m_query_stream;
+ PFNEGLQUERYSTREAMU64KHRPROC m_query_stream_u64;
+ bool m_has_egl_stream;
+
+ PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC m_create_stream_producer_surface;
+ bool m_has_egl_stream_producer_eglsurface;
+
+ PFNEGLSTREAMCONSUMEROUTPUTEXTPROC m_stream_consumer_output;
+ bool m_has_egl_stream_consumer_egloutput;
+
+ bool m_has_egl_output_drm;
+
+ PFNEGLGETOUTPUTLAYERSEXTPROC m_get_output_layers;
+ PFNEGLGETOUTPUTPORTSEXTPROC m_get_output_ports;
+ PFNEGLOUTPUTLAYERATTRIBEXTPROC m_output_layer_attrib;
+ PFNEGLQUERYOUTPUTLAYERATTRIBEXTPROC m_query_output_layer_attrib;
+ PFNEGLQUERYOUTPUTLAYERSTRINGEXTPROC m_query_output_layer_string;
+ PFNEGLQUERYOUTPUTPORTATTRIBEXTPROC m_query_output_port_attrib;
+ PFNEGLQUERYOUTPUTPORTSTRINGEXTPROC m_query_output_port_string;
+ bool m_has_egl_output_base;
+
+ PFNEGLGETSTREAMFILEDESCRIPTORKHRPROC m_get_stream_file_descriptor;
+ PFNEGLCREATESTREAMFROMFILEDESCRIPTORKHRPROC m_create_stream_from_file_descriptor;
+ bool m_has_egl_stream_cross_process_fd;
+
+ PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALKHRPROC m_stream_consumer_gltexture;
+ PFNEGLSTREAMCONSUMERACQUIREKHRPROC m_stream_consumer_acquire;
+ bool m_has_egl_stream_consumer_gltexture;
+};
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/mkspecs/unsupported/linux-armcc/qplatformdefs.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicemain.cpp
index 946b4d2b90..f987ae38a6 100644
--- a/mkspecs/unsupported/linux-armcc/qplatformdefs.h
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicemain.cpp
@@ -31,62 +31,19 @@
**
****************************************************************************/
-#ifndef QPLATFORMDEFS_H
-#define QPLATFORMDEFS_H
+#include "qeglfskmsegldeviceintegration.h"
-// Get Qt defines/settings
+QT_BEGIN_NAMESPACE
-#include "qglobal.h"
+class QEglFSKmsEglDeviceIntegrationPlugin : public QEGLDeviceIntegrationPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID QEGLDeviceIntegrationFactoryInterface_iid FILE "eglfs_kms_egldevice.json")
-// Set any POSIX/XOPEN defines at the top of this file to turn on specific APIs
+public:
+ QEGLDeviceIntegration *create() Q_DECL_OVERRIDE { return new QEglFSKmsEglDeviceIntegration; }
+};
-// 1) need to reset default environment if _BSD_SOURCE is defined
-// 2) need to specify POSIX thread interfaces explicitly in glibc 2.0
-// 3) it seems older glibc need this to include the X/Open stuff
-#ifndef _GNU_SOURCE
-# define _GNU_SOURCE
-#endif
+QT_END_NAMESPACE
-#include <unistd.h>
-
-
-// We are hot - unistd.h should have turned on the specific APIs we requested
-
-#include <features.h>
-#include <pthread.h>
-#include <dirent.h>
-#include <fcntl.h>
-#include <grp.h>
-#include <pwd.h>
-#include <signal.h>
-
-#include <sys/types.h>
-#include <sys/ioctl.h>
-#include <sys/ipc.h>
-#include <sys/time.h>
-#include <sys/shm.h>
-#include <sys/socket.h>
-#include <sys/stat.h>
-#include <sys/wait.h>
-#include <netinet/in.h>
-#ifndef QT_NO_IPV6IFNAME
-#include <net/if.h>
-#endif
-
-#define QT_USE_XOPEN_LFS_EXTENSIONS
-#include "../../common/posix/qplatformdefs.h"
-
-#undef QT_SOCKLEN_T
-
-#if defined(__GLIBC__) && (__GLIBC__ >= 2)
-#define QT_SOCKLEN_T socklen_t
-#else
-#define QT_SOCKLEN_T int
-#endif
-
-#if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 500)
-#define QT_SNPRINTF ::snprintf
-#define QT_VSNPRINTF ::vsnprintf
-#endif
-
-#endif // QPLATFORMDEFS_H
+#include "qeglfskmsegldevicemain.moc"
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/qeglfsmaliintegration.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/qeglfsmaliintegration.cpp
index 455d78035a..43decdf849 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/qeglfsmaliintegration.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/qeglfsmaliintegration.cpp
@@ -32,7 +32,6 @@
****************************************************************************/
#include "qeglfsmaliintegration.h"
-#include <EGL/fbdev_window.h>
#include <unistd.h>
#include <fcntl.h>
@@ -43,6 +42,11 @@
QT_BEGIN_NAMESPACE
+struct fbdev_window {
+ unsigned short width;
+ unsigned short height;
+};
+
void QEglFSMaliIntegration::platformInit()
{
// Keep the non-overridden base class functions based on fb0 working.
diff --git a/src/plugins/platforms/eglfs/qeglfscontext.cpp b/src/plugins/platforms/eglfs/qeglfscontext.cpp
index e2223aba43..6fcdae7ad2 100644
--- a/src/plugins/platforms/eglfs/qeglfscontext.cpp
+++ b/src/plugins/platforms/eglfs/qeglfscontext.cpp
@@ -44,7 +44,8 @@ QT_BEGIN_NAMESPACE
QEglFSContext::QEglFSContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display,
EGLConfig *config, const QVariant &nativeHandle)
- : QEGLPlatformContext(format, share, display, config, nativeHandle),
+ : QEGLPlatformContext(format, share, display, config, nativeHandle,
+ qt_egl_device_integration()->supportsSurfacelessContexts() ? Flags(0) : QEGLPlatformContext::NoSurfaceless),
m_tempWindow(0)
{
}
diff --git a/src/plugins/platforms/eglfs/qeglfsdeviceintegration.cpp b/src/plugins/platforms/eglfs/qeglfsdeviceintegration.cpp
index d27c949c8d..0c2aa7ad61 100644
--- a/src/plugins/platforms/eglfs/qeglfsdeviceintegration.cpp
+++ b/src/plugins/platforms/eglfs/qeglfsdeviceintegration.cpp
@@ -34,6 +34,7 @@
#include "qeglfsdeviceintegration.h"
#include "qeglfsintegration.h"
#include "qeglfscursor.h"
+#include "qeglfswindow.h"
#include <QtPlatformSupport/private/qeglconvenience_p.h>
#include <QGuiApplication>
#include <private/qguiapplication_p.h>
@@ -175,6 +176,11 @@ EGLNativeDisplayType QEGLDeviceIntegration::platformDisplay() const
return EGL_DEFAULT_DISPLAY;
}
+EGLDisplay QEGLDeviceIntegration::createDisplay(EGLNativeDisplayType nativeDisplay)
+{
+ return eglGetDisplay(nativeDisplay);
+}
+
bool QEGLDeviceIntegration::usesDefaultScreen()
{
return true;
@@ -238,6 +244,11 @@ qreal QEGLDeviceIntegration::refreshRate() const
return q_refreshRateFromFb(framebuffer);
}
+EGLint QEGLDeviceIntegration::surfaceType() const
+{
+ return EGL_WINDOW_BIT;
+}
+
QSurfaceFormat QEGLDeviceIntegration::surfaceFormatFor(const QSurfaceFormat &inputFormat) const
{
QSurfaceFormat format = inputFormat;
@@ -257,6 +268,11 @@ bool QEGLDeviceIntegration::filterConfig(EGLDisplay, EGLConfig) const
return true;
}
+QEglFSWindow *QEGLDeviceIntegration::createWindow(QWindow *window) const
+{
+ return new QEglFSWindow(window);
+}
+
EGLNativeWindowType QEGLDeviceIntegration::createNativeWindow(QPlatformWindow *platformWindow,
const QSize &size,
const QSurfaceFormat &format)
@@ -313,4 +329,9 @@ bool QEGLDeviceIntegration::supportsPBuffers() const
return true;
}
+bool QEGLDeviceIntegration::supportsSurfacelessContexts() const
+{
+ return true;
+}
+
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/eglfs/qeglfsdeviceintegration.h b/src/plugins/platforms/eglfs/qeglfsdeviceintegration.h
index 260fc313f7..d91d67de16 100644
--- a/src/plugins/platforms/eglfs/qeglfsdeviceintegration.h
+++ b/src/plugins/platforms/eglfs/qeglfsdeviceintegration.h
@@ -56,6 +56,7 @@
QT_BEGIN_NAMESPACE
class QPlatformSurface;
+class QEglFSWindow;
#define QEGLDeviceIntegrationFactoryInterface_iid "org.qt-project.qt.qpa.egl.QEGLDeviceIntegrationFactoryInterface.5.5"
@@ -67,6 +68,7 @@ public:
virtual void platformInit();
virtual void platformDestroy();
virtual EGLNativeDisplayType platformDisplay() const;
+ virtual EGLDisplay createDisplay(EGLNativeDisplayType nativeDisplay);
virtual bool usesDefaultScreen();
virtual void screenInit();
virtual void screenDestroy();
@@ -79,6 +81,8 @@ public:
virtual QImage::Format screenFormat() const;
virtual qreal refreshRate() const;
virtual QSurfaceFormat surfaceFormatFor(const QSurfaceFormat &inputFormat) const;
+ virtual EGLint surfaceType() const;
+ virtual QEglFSWindow *createWindow(QWindow *window) const;
virtual EGLNativeWindowType createNativeWindow(QPlatformWindow *platformWindow,
const QSize &size,
const QSurfaceFormat &format);
@@ -92,6 +96,7 @@ public:
virtual QByteArray fbDeviceName() const;
virtual int framebufferIndex() const;
virtual bool supportsPBuffers() const;
+ virtual bool supportsSurfacelessContexts() const;
};
class Q_EGLFS_EXPORT QEGLDeviceIntegrationPlugin : public QObject
diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.cpp b/src/plugins/platforms/eglfs/qeglfsintegration.cpp
index f0946b9b64..2df06caa6b 100644
--- a/src/plugins/platforms/eglfs/qeglfsintegration.cpp
+++ b/src/plugins/platforms/eglfs/qeglfsintegration.cpp
@@ -117,7 +117,7 @@ void QEglFSIntegration::initialize()
{
qt_egl_device_integration()->platformInit();
- m_display = eglGetDisplay(nativeDisplay());
+ m_display = qt_egl_device_integration()->createDisplay(nativeDisplay());
if (m_display == EGL_NO_DISPLAY)
qFatal("Could not open egl display");
@@ -179,7 +179,7 @@ QPlatformBackingStore *QEglFSIntegration::createPlatformBackingStore(QWindow *wi
QPlatformWindow *QEglFSIntegration::createPlatformWindow(QWindow *window) const
{
QWindowSystemInterface::flushWindowSystemEvents();
- QEglFSWindow *w = new QEglFSWindow(window);
+ QEglFSWindow *w = qt_egl_device_integration()->createWindow(window);
w->create();
if (window->type() != Qt::ToolTip)
w->requestActivateWindow();
@@ -213,10 +213,14 @@ QPlatformOffscreenSurface *QEglFSIntegration::createPlatformOffscreenSurface(QOf
{
EGLDisplay dpy = surface->screen() ? static_cast<QEglFSScreen *>(surface->screen()->handle())->display() : display();
QSurfaceFormat fmt = qt_egl_device_integration()->surfaceFormatFor(surface->requestedFormat());
- if (qt_egl_device_integration()->supportsPBuffers())
- return new QEGLPbuffer(dpy, fmt, surface);
- else
+ if (qt_egl_device_integration()->supportsPBuffers()) {
+ QEGLPlatformContext::Flags flags = 0;
+ if (!qt_egl_device_integration()->supportsSurfacelessContexts())
+ flags |= QEGLPlatformContext::NoSurfaceless;
+ return new QEGLPbuffer(dpy, fmt, surface, flags);
+ } else {
return new QEglFSOffscreenWindow(dpy, fmt, surface);
+ }
// Never return null. Multiple QWindows are not supported by this plugin.
}
@@ -433,6 +437,7 @@ EGLConfig QEglFSIntegration::chooseConfig(EGLDisplay display, const QSurfaceForm
};
Chooser chooser(display);
+ chooser.setSurfaceType(qt_egl_device_integration()->surfaceType());
chooser.setSurfaceFormat(format);
return chooser.chooseConfig();
}
diff --git a/src/plugins/platforms/eglfs/qeglfswindow.cpp b/src/plugins/platforms/eglfs/qeglfswindow.cpp
index c3b9dd6ef0..8301be8c17 100644
--- a/src/plugins/platforms/eglfs/qeglfswindow.cpp
+++ b/src/plugins/platforms/eglfs/qeglfswindow.cpp
@@ -51,7 +51,7 @@ QEglFSWindow::QEglFSWindow(QWindow *w)
m_backingStore(0),
m_raster(false),
m_winId(0),
- m_surface(0),
+ m_surface(EGL_NO_SURFACE),
m_window(0),
m_flags(0)
{
@@ -120,13 +120,14 @@ void QEglFSWindow::create()
setGeometry(QRect()); // will become fullscreen
QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(0, 0), geometry().size()));
- EGLDisplay display = static_cast<QEglFSScreen *>(screen)->display();
- QSurfaceFormat platformFormat = qt_egl_device_integration()->surfaceFormatFor(window()->requestedFormat());
- m_config = QEglFSIntegration::chooseConfig(display, platformFormat);
- m_format = q_glFormatFromConfig(display, m_config, platformFormat);
-
resetSurface();
+ if (m_surface == EGL_NO_SURFACE) {
+ EGLint error = eglGetError();
+ eglTerminate(screen->display());
+ qFatal("EGL Error : Could not create the egl surface: error = 0x%x\n", error);
+ }
+
screen->setPrimarySurface(m_surface);
if (isRaster()) {
@@ -158,15 +159,10 @@ void QEglFSWindow::destroy()
QOpenGLCompositor::instance()->removeWindow(this);
}
-// The virtual functions resetSurface and invalidateSurface may get overridden
-// in derived classes, for example in the Android port, to perform the native
-// window and surface creation differently.
-
void QEglFSWindow::invalidateSurface()
{
if (m_surface != EGL_NO_SURFACE) {
- EGLDisplay display = static_cast<QEglFSScreen *>(screen())->display();
- eglDestroySurface(display, m_surface);
+ eglDestroySurface(screen()->display(), m_surface);
m_surface = EGL_NO_SURFACE;
}
qt_egl_device_integration()->destroyNativeWindow(m_window);
@@ -175,15 +171,13 @@ void QEglFSWindow::invalidateSurface()
void QEglFSWindow::resetSurface()
{
- QEglFSScreen *nativeScreen = static_cast<QEglFSScreen *>(screen());
- EGLDisplay display = nativeScreen->display();
- m_window = qt_egl_device_integration()->createNativeWindow(this, nativeScreen->geometry().size(), m_format);
+ EGLDisplay display = screen()->display();
+ QSurfaceFormat platformFormat = qt_egl_device_integration()->surfaceFormatFor(window()->requestedFormat());
+
+ m_config = QEglFSIntegration::chooseConfig(display, platformFormat);
+ m_format = q_glFormatFromConfig(display, m_config, platformFormat);
+ m_window = qt_egl_device_integration()->createNativeWindow(this, screen()->geometry().size(), m_format);
m_surface = eglCreateWindowSurface(display, m_config, m_window, NULL);
- if (m_surface == EGL_NO_SURFACE) {
- EGLint error = eglGetError();
- eglTerminate(display);
- qFatal("EGL Error : Could not create the egl surface: error = 0x%x\n", error);
- }
}
void QEglFSWindow::setVisible(bool visible)
diff --git a/src/plugins/platforms/eglfs/qeglfswindow.h b/src/plugins/platforms/eglfs/qeglfswindow.h
index 53b9e18dc1..806b21de0a 100644
--- a/src/plugins/platforms/eglfs/qeglfswindow.h
+++ b/src/plugins/platforms/eglfs/qeglfswindow.h
@@ -89,7 +89,7 @@ public:
const QPlatformTextureList *textures() const Q_DECL_OVERRIDE;
void endCompositing() Q_DECL_OVERRIDE;
-private:
+protected:
QOpenGLCompositorBackingStore *m_backingStore;
bool m_raster;
WId m_winId;
diff --git a/src/plugins/platforms/ios/qioseventdispatcher.h b/src/plugins/platforms/ios/qioseventdispatcher.h
index fdaa7e68fe..e8ea1cc28b 100644
--- a/src/plugins/platforms/ios/qioseventdispatcher.h
+++ b/src/plugins/platforms/ios/qioseventdispatcher.h
@@ -46,6 +46,7 @@ public:
explicit QIOSEventDispatcher(QObject *parent = 0);
bool processEvents(QEventLoop::ProcessEventsFlags flags) Q_DECL_OVERRIDE;
+ bool processPostedEvents() Q_DECL_OVERRIDE;
void handleRunLoopExit(CFRunLoopActivity activity);
diff --git a/src/plugins/platforms/ios/qioseventdispatcher.mm b/src/plugins/platforms/ios/qioseventdispatcher.mm
index bd4b8778ed..0e9f176487 100644
--- a/src/plugins/platforms/ios/qioseventdispatcher.mm
+++ b/src/plugins/platforms/ios/qioseventdispatcher.mm
@@ -39,6 +39,8 @@
#include <QtCore/private/qcoreapplication_p.h>
#include <QtCore/private/qthread_p.h>
+#include <qpa/qwindowsysteminterface.h>
+
#import <Foundation/NSArray.h>
#import <Foundation/NSString.h>
#import <Foundation/NSProcessInfo.h>
@@ -461,6 +463,25 @@ bool __attribute__((returns_twice)) QIOSEventDispatcher::processEvents(QEventLoo
return processedEvents;
}
+/*!
+ Override of the CoreFoundation posted events runloop source callback
+ so that we can send window system (QPA) events in addition to sending
+ normal Qt events.
+*/
+bool QIOSEventDispatcher::processPostedEvents()
+{
+ // Don't send window system events if the base CF dispatcher has determined
+ // that events should not be sent for this pass of the runloop source.
+ if (!QEventDispatcherCoreFoundation::processPostedEvents())
+ return false;
+
+ qEventDispatcherDebug() << "Sending window system events for " << m_processEvents.flags; qIndent();
+ QWindowSystemInterface::sendWindowSystemEvents(m_processEvents.flags);
+ qUnIndent();
+
+ return true;
+}
+
void QIOSEventDispatcher::handleRunLoopExit(CFRunLoopActivity activity)
{
Q_UNUSED(activity);
diff --git a/src/plugins/platforms/ios/qiosmenu.h b/src/plugins/platforms/ios/qiosmenu.h
index 4fa0416df7..ec23b55507 100644
--- a/src/plugins/platforms/ios/qiosmenu.h
+++ b/src/plugins/platforms/ios/qiosmenu.h
@@ -62,7 +62,7 @@ public:
void setRole(MenuRole role) Q_DECL_OVERRIDE;
void setCheckable(bool) Q_DECL_OVERRIDE {}
void setChecked(bool) Q_DECL_OVERRIDE {}
- void setShortcut(const QKeySequence&) Q_DECL_OVERRIDE {}
+ void setShortcut(const QKeySequence&) Q_DECL_OVERRIDE;
void setEnabled(bool enabled) Q_DECL_OVERRIDE;
void setIconSize(int) Q_DECL_OVERRIDE {}
@@ -73,6 +73,7 @@ public:
bool m_enabled;
bool m_separator;
QIOSMenu *m_menu;
+ QKeySequence m_shortcut;
private:
QString removeMnemonics(const QString &original);
@@ -134,6 +135,7 @@ private:
void toggleShowUsingUIMenuController(bool show);
void toggleShowUsingUIPickerView(bool show);
QIOSMenuItemList visibleMenuItems() const;
+ QIOSMenuItemList filterFirstResponderActions(const QIOSMenuItemList &menuItems);
void repositionMenu();
};
diff --git a/src/plugins/platforms/ios/qiosmenu.mm b/src/plugins/platforms/ios/qiosmenu.mm
index 045d39e328..7aea3729fd 100644
--- a/src/plugins/platforms/ios/qiosmenu.mm
+++ b/src/plugins/platforms/ios/qiosmenu.mm
@@ -277,6 +277,11 @@ void QIOSMenuItem::setRole(QPlatformMenuItem::MenuRole role)
m_role = role;
}
+void QIOSMenuItem::setShortcut(const QKeySequence &sequence)
+{
+ m_shortcut = sequence;
+}
+
void QIOSMenuItem::setEnabled(bool enabled)
{
m_enabled = enabled;
@@ -364,7 +369,7 @@ void QIOSMenu::syncMenuItem(QPlatformMenuItem *)
switch (m_effectiveMenuType) {
case EditMenu:
- [m_menuController setVisibleMenuItems:visibleMenuItems()];
+ [m_menuController setVisibleMenuItems:filterFirstResponderActions(visibleMenuItems())];
break;
default:
[m_pickerView setVisibleMenuItems:visibleMenuItems() selectItem:m_targetItem];
@@ -469,7 +474,7 @@ void QIOSMenu::toggleShowUsingUIMenuController(bool show)
{
if (show) {
Q_ASSERT(!m_menuController);
- m_menuController = [[QUIMenuController alloc] initWithVisibleMenuItems:visibleMenuItems()];
+ m_menuController = [[QUIMenuController alloc] initWithVisibleMenuItems:filterFirstResponderActions(visibleMenuItems())];
repositionMenu();
connect(qGuiApp->inputMethod(), &QInputMethod::keyboardRectangleChanged, this, &QIOSMenu::repositionMenu);
} else {
@@ -542,6 +547,36 @@ QIOSMenuItemList QIOSMenu::visibleMenuItems() const
return visibleMenuItems;
}
+QIOSMenuItemList QIOSMenu::filterFirstResponderActions(const QIOSMenuItemList &menuItems)
+{
+ // UIResponderStandardEditActions found in first responder will be prepended to the edit
+ // menu automatically (or e.g made available as buttons on the virtual keyboard). So we
+ // filter them out to avoid duplicates, and let first responder handle the actions instead.
+ // In case of QIOSTextResponder, edit actions will be converted to key events that ends up
+ // triggering the shortcuts of the filtered menu items.
+ QIOSMenuItemList filteredMenuItems;
+ UIResponder *responder = [UIResponder currentFirstResponder];
+
+ for (int i = 0; i < menuItems.count(); ++i) {
+ QIOSMenuItem *menuItem = menuItems.at(i);
+ QKeySequence shortcut = menuItem->m_shortcut;
+ if ((shortcut == QKeySequence::Cut && [responder canPerformAction:@selector(cut:) withSender:nil])
+ || (shortcut == QKeySequence::Copy && [responder canPerformAction:@selector(copy:) withSender:nil])
+ || (shortcut == QKeySequence::Paste && [responder canPerformAction:@selector(paste:) withSender:nil])
+ || (shortcut == QKeySequence::Delete && [responder canPerformAction:@selector(delete:) withSender:nil])
+ || (shortcut == QKeySequence::SelectAll && [responder canPerformAction:@selector(selectAll:) withSender:nil])
+ || (shortcut == QKeySequence::Undo && [responder canPerformAction:@selector(undo:) withSender:nil])
+ || (shortcut == QKeySequence::Redo && [responder canPerformAction:@selector(redo:) withSender:nil])
+ || (shortcut == QKeySequence::Bold && [responder canPerformAction:@selector(toggleBoldface:) withSender:nil])
+ || (shortcut == QKeySequence::Italic && [responder canPerformAction:@selector(toggleItalics:) withSender:nil])
+ || (shortcut == QKeySequence::Underline && [responder canPerformAction:@selector(toggleUnderline:) withSender:nil])) {
+ continue;
+ }
+ filteredMenuItems.append(menuItem);
+ }
+ return filteredMenuItems;
+}
+
void QIOSMenu::repositionMenu()
{
switch (m_effectiveMenuType) {
diff --git a/src/plugins/platforms/ios/qiostextresponder.mm b/src/plugins/platforms/ios/qiostextresponder.mm
index e4917593db..b95be7a883 100644
--- a/src/plugins/platforms/ios/qiostextresponder.mm
+++ b/src/plugins/platforms/ios/qiostextresponder.mm
@@ -231,6 +231,9 @@
if (UIView *accessoryView = static_cast<UIView *>(platformData.value(kImePlatformDataInputAccessoryView).value<void *>()))
self.inputAccessoryView = [[[WrapperView alloc] initWithView:accessoryView] autorelease];
+ self.undoManager.groupsByEvent = NO;
+ [self rebuildUndoStack];
+
return self;
}
@@ -346,44 +349,183 @@
- (void)sendKeyPressRelease:(Qt::Key)key modifiers:(Qt::KeyboardModifiers)modifiers
{
- QKeyEvent press(QEvent::KeyPress, key, modifiers);
- QKeyEvent release(QEvent::KeyRelease, key, modifiers);
- [self sendEventToFocusObject:press];
- [self sendEventToFocusObject:release];
+ QWindowSystemInterface::handleKeyEvent(qApp->focusWindow(), QEvent::KeyPress, key, modifiers);
+ QWindowSystemInterface::handleKeyEvent(qApp->focusWindow(), QEvent::KeyRelease, key, modifiers);
+}
+
+#ifndef QT_NO_SHORTCUT
+
+- (void)sendShortcut:(QKeySequence::StandardKey)standardKey
+{
+ const int keys = QKeySequence(standardKey)[0];
+ Qt::Key key = Qt::Key(keys & 0x0000FFFF);
+ Qt::KeyboardModifiers modifiers = Qt::KeyboardModifiers(keys & 0xFFFF0000);
+ [self sendKeyPressRelease:key modifiers:modifiers];
}
- (void)cut:(id)sender
{
Q_UNUSED(sender);
- [self sendKeyPressRelease:Qt::Key_X modifiers:Qt::ControlModifier];
+ [self sendShortcut:QKeySequence::Cut];
}
- (void)copy:(id)sender
{
Q_UNUSED(sender);
- [self sendKeyPressRelease:Qt::Key_C modifiers:Qt::ControlModifier];
+ [self sendShortcut:QKeySequence::Copy];
}
- (void)paste:(id)sender
{
Q_UNUSED(sender);
- [self sendKeyPressRelease:Qt::Key_V modifiers:Qt::ControlModifier];
+ [self sendShortcut:QKeySequence::Paste];
}
- (void)selectAll:(id)sender
{
Q_UNUSED(sender);
- [self sendKeyPressRelease:Qt::Key_A modifiers:Qt::ControlModifier];
+ [self sendShortcut:QKeySequence::SelectAll];
}
- (void)delete:(id)sender
{
Q_UNUSED(sender);
- [self sendKeyPressRelease:Qt::Key_Delete modifiers:Qt::ControlModifier];
+ [self sendShortcut:QKeySequence::Delete];
+}
+
+- (void)toggleBoldface:(id)sender
+{
+ Q_UNUSED(sender);
+ [self sendShortcut:QKeySequence::Bold];
+}
+
+- (void)toggleItalics:(id)sender
+{
+ Q_UNUSED(sender);
+ [self sendShortcut:QKeySequence::Italic];
+}
+
+- (void)toggleUnderline:(id)sender
+{
+ Q_UNUSED(sender);
+ [self sendShortcut:QKeySequence::Underline];
+}
+
+// -------------------------------------------------------------------------
+
+- (void)undo
+{
+ [self sendShortcut:QKeySequence::Undo];
+ [self rebuildUndoStack];
+}
+
+- (void)redo
+{
+ [self sendShortcut:QKeySequence::Redo];
+ [self rebuildUndoStack];
+}
+
+- (void)registerRedo
+{
+ NSUndoManager *undoMgr = self.undoManager;
+ [undoMgr beginUndoGrouping];
+ [undoMgr registerUndoWithTarget:self selector:@selector(redo) object:nil];
+ [undoMgr endUndoGrouping];
+}
+
+- (void)rebuildUndoStack
+{
+ dispatch_async(dispatch_get_main_queue (), ^{
+ // Register dummy undo/redo operations to enable Cmd-Z and Cmd-Shift-Z
+ // Ensure we do this outside any undo/redo callback since NSUndoManager
+ // will treat registerUndoWithTarget as registering a redo when called
+ // from within a undo callback.
+ NSUndoManager *undoMgr = self.undoManager;
+ [undoMgr removeAllActions];
+ [undoMgr beginUndoGrouping];
+ [undoMgr registerUndoWithTarget:self selector:@selector(undo) object:nil];
+ [undoMgr endUndoGrouping];
+
+ // Schedule an operation that we immediately pop off to be able to schedule a redo
+ [undoMgr beginUndoGrouping];
+ [undoMgr registerUndoWithTarget:self selector:@selector(registerRedo) object:nil];
+ [undoMgr endUndoGrouping];
+ [undoMgr undo];
+
+ // Note that, perhaps because of a bug in UIKit, the buttons on the shortcuts bar ends up
+ // disabled if a undo/redo callback doesn't lead to a [UITextInputDelegate textDidChange].
+ // And we only call that method if Qt made changes to the text. The effect is that the buttons
+ // become disabled when there is nothing more to undo (Qt didn't change anything upon receiving
+ // an undo request). This seems to be OK behavior, so we let it stay like that unless it shows
+ // to cause problems.
+ });
}
// -------------------------------------------------------------------------
+- (void)keyCommandTriggered:(UIKeyCommand *)keyCommand
+{
+ Qt::Key key = Qt::Key_unknown;
+ Qt::KeyboardModifiers modifiers = Qt::NoModifier;
+
+ if (keyCommand.input == UIKeyInputLeftArrow)
+ key = Qt::Key_Left;
+ else if (keyCommand.input == UIKeyInputRightArrow)
+ key = Qt::Key_Right;
+ else if (keyCommand.input == UIKeyInputUpArrow)
+ key = Qt::Key_Up;
+ else if (keyCommand.input == UIKeyInputDownArrow)
+ key = Qt::Key_Down;
+ else
+ Q_UNREACHABLE();
+
+ if (keyCommand.modifierFlags & UIKeyModifierAlternate)
+ modifiers |= Qt::AltModifier;
+ if (keyCommand.modifierFlags & UIKeyModifierShift)
+ modifiers |= Qt::ShiftModifier;
+ if (keyCommand.modifierFlags & UIKeyModifierCommand)
+ modifiers |= Qt::ControlModifier;
+
+ [self sendKeyPressRelease:key modifiers:modifiers];
+}
+
+- (void)addKeyCommandsToArray:(NSMutableArray *)array key:(NSString *)key
+{
+ SEL s = @selector(keyCommandTriggered:);
+ [array addObject:[UIKeyCommand keyCommandWithInput:key modifierFlags:0 action:s]];
+ [array addObject:[UIKeyCommand keyCommandWithInput:key modifierFlags:UIKeyModifierShift action:s]];
+ [array addObject:[UIKeyCommand keyCommandWithInput:key modifierFlags:UIKeyModifierAlternate action:s]];
+ [array addObject:[UIKeyCommand keyCommandWithInput:key modifierFlags:UIKeyModifierAlternate|UIKeyModifierShift action:s]];
+ [array addObject:[UIKeyCommand keyCommandWithInput:key modifierFlags:UIKeyModifierCommand action:s]];
+ [array addObject:[UIKeyCommand keyCommandWithInput:key modifierFlags:UIKeyModifierCommand|UIKeyModifierShift action:s]];
+}
+
+- (NSArray *)keyCommands
+{
+ // Since keyCommands is called for every key
+ // press/release, we cache the result
+ static dispatch_once_t once;
+ static NSMutableArray *array;
+
+ dispatch_once(&once, ^{
+ // We let Qt move the cursor around when the arrow keys are being used. This
+ // is normally implemented through UITextInput, but since IM in Qt have poor
+ // support for moving the cursor vertically, and even less support for selecting
+ // text across multiple paragraphs, we do this through key events.
+ array = [NSMutableArray new];
+ [self addKeyCommandsToArray:array key:UIKeyInputUpArrow];
+ [self addKeyCommandsToArray:array key:UIKeyInputDownArrow];
+ [self addKeyCommandsToArray:array key:UIKeyInputLeftArrow];
+ [self addKeyCommandsToArray:array key:UIKeyInputRightArrow];
+ });
+
+ return array;
+}
+
+#endif // QT_NO_SHORTCUT
+
+// -------------------------------------------------------------------------
+
- (void)notifyInputDelegate:(Qt::InputMethodQueries)updatedProperties
{
// As documented, we should not report textWillChange/textDidChange unless the text
@@ -540,7 +682,17 @@
- (UITextPosition *)positionFromPosition:(UITextPosition *)position inDirection:(UITextLayoutDirection)direction offset:(NSInteger)offset
{
int p = static_cast<QUITextPosition *>(position).index;
- return [QUITextPosition positionWithIndex:(direction == UITextLayoutDirectionRight ? p + offset : p - offset)];
+
+ switch (direction) {
+ case UITextLayoutDirectionLeft:
+ return [QUITextPosition positionWithIndex:p - offset];
+ case UITextLayoutDirectionRight:
+ return [QUITextPosition positionWithIndex:p + offset];
+ default:
+ // Qt doesn't support getting the position above or below the current position, so
+ // for those cases we just return the current position, making it a no-op.
+ return position;
+ }
}
- (UITextPosition *)positionWithinRange:(UITextRange *)range farthestInDirection:(UITextLayoutDirection)direction
@@ -608,6 +760,15 @@
return toCGRect(startRect.united(endRect));
}
+- (NSArray *)selectionRectsForRange:(UITextRange *)range
+{
+ Q_UNUSED(range);
+ // This method is supposed to return a rectangle for each line with selection. Since we don't
+ // expose an API in Qt/IM for getting this information, and since we never seems to be getting
+ // a call from UIKit for this, we return an empty array until a need arise.
+ return [[NSArray new] autorelease];
+}
+
- (CGRect)caretRectForPosition:(UITextPosition *)position
{
Q_UNUSED(position);
@@ -734,10 +895,10 @@
- (void)deleteBackward
{
- // Since we're posting im events directly to the focus object, we should do the
- // same for key events. Otherwise they might end up in a different place or out
- // of sync with im events.
+ // UITextInput selects the text to be deleted before calling this method. To avoid
+ // drawing the selection, we flush after posting the key press/release.
[self sendKeyPressRelease:Qt::Key_Backspace modifiers:Qt::NoModifier];
+ QWindowSystemInterface::flushWindowSystemEvents();
}
@end
diff --git a/src/plugins/platforms/ios/qiostheme.mm b/src/plugins/platforms/ios/qiostheme.mm
index edeabf66dc..bc40069670 100644
--- a/src/plugins/platforms/ios/qiostheme.mm
+++ b/src/plugins/platforms/ios/qiostheme.mm
@@ -107,6 +107,8 @@ QVariant QIOSTheme::themeHint(ThemeHint hint) const
switch (hint) {
case QPlatformTheme::StyleNames:
return QStringList(QStringLiteral("fusion"));
+ case KeyboardScheme:
+ return QVariant(int(MacKeyboardScheme));
default:
return QPlatformTheme::themeHint(hint);
}
diff --git a/src/plugins/platforms/ios/qiosviewcontroller.mm b/src/plugins/platforms/ios/qiosviewcontroller.mm
index 67b33ce235..94d894bba7 100644
--- a/src/plugins/platforms/ios/qiosviewcontroller.mm
+++ b/src/plugins/platforms/ios/qiosviewcontroller.mm
@@ -185,7 +185,14 @@
- (void)setFrame:(CGRect)newFrame
{
- [super setFrame:CGRectMake(0, 0, CGRectGetWidth(newFrame), CGRectGetHeight(self.window.bounds))];
+ Q_UNUSED(newFrame);
+ Q_ASSERT(!self.window || self.window.rootViewController.view == self);
+
+ // When presenting view controllers our view may be temporarily reparented into a UITransitionView
+ // instead of the UIWindow, and the UITransitionView may have a transform set, so we need to do a
+ // mapping even if we still expect to always be the root view-controller.
+ CGRect transformedWindowBounds = [self.superview convertRect:self.window.bounds fromView:self.window];
+ [super setFrame:transformedWindowBounds];
}
- (void)setBounds:(CGRect)newBounds
diff --git a/src/plugins/platforms/offscreen/qoffscreencommon.cpp b/src/plugins/platforms/offscreen/qoffscreencommon.cpp
index 11977fc6ed..31d7397f6f 100644
--- a/src/plugins/platforms/offscreen/qoffscreencommon.cpp
+++ b/src/plugins/platforms/offscreen/qoffscreencommon.cpp
@@ -75,13 +75,13 @@ public:
QOffscreenScreen::windowContainingCursor = containing ? containing->handle() : 0;
}
-
+#ifndef QT_NO_CURSOR
void changeCursor(QCursor *windowCursor, QWindow *window) Q_DECL_OVERRIDE
{
Q_UNUSED(windowCursor);
Q_UNUSED(window);
}
-
+#endif
private:
QPoint m_pos;
};
diff --git a/src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.cpp b/src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.cpp
index 392d45c5b4..2c7a28e835 100644
--- a/src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.cpp
+++ b/src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.cpp
@@ -121,7 +121,7 @@ bool QQnxVirtualKeyboardPps::connect()
if (m_fd == -1)
{
qVirtualKeyboardDebug() << Q_FUNC_INFO << ": Unable to open" << ms_PPSPath
- << ":" << strerror(errno);
+ << ':' << strerror(errno);
close();
return false;
}
diff --git a/src/plugins/platforms/windows/openglblacklists/default.json b/src/plugins/platforms/windows/openglblacklists/default.json
index b00c9df408..f1500409fe 100644
--- a/src/plugins/platforms/windows/openglblacklists/default.json
+++ b/src/plugins/platforms/windows/openglblacklists/default.json
@@ -4,7 +4,7 @@
"entries": [
{
"id": 1,
- "description": "Desktop OpenGL is unreliable on some Intel HD laptops (QTBUG-43263, QTBUG-42240)",
+ "description": "Desktop OpenGL is unreliable on some Intel HD laptops (QTBUG-43263)",
"vendor_id": "0x8086",
"device_id": [ "0x0A16" ],
"os": {
@@ -42,6 +42,18 @@
"features": [
"disable_desktopgl"
]
+ },
+ {
+ "id": 4,
+ "description": "Intel HD Graphics 3000 crashes when initializing the OpenGL driver (QTBUG-42240)",
+ "vendor_id": "0x8086",
+ "device_id": [ "0x0102", "0x0116" ],
+ "os": {
+ "type": "win"
+ },
+ "features": [
+ "disable_desktopgl"
+ ]
}
]
}
diff --git a/src/plugins/platforms/windows/qwindowseglcontext.cpp b/src/plugins/platforms/windows/qwindowseglcontext.cpp
index e4ec3f3cf8..02073f5098 100644
--- a/src/plugins/platforms/windows/qwindowseglcontext.cpp
+++ b/src/plugins/platforms/windows/qwindowseglcontext.cpp
@@ -152,7 +152,7 @@ bool QWindowsLibEGL::init()
eglGetCurrentSurface = RESOLVE((EGLSurface (EGLAPIENTRY *)(EGLint )), eglGetCurrentSurface);
eglGetCurrentDisplay = RESOLVE((EGLDisplay (EGLAPIENTRY *)(void)), eglGetCurrentDisplay);
eglSwapBuffers = RESOLVE((EGLBoolean (EGLAPIENTRY *)(EGLDisplay , EGLSurface)), eglSwapBuffers);
- eglGetProcAddress = RESOLVE((__eglMustCastToProperFunctionPointerType (EGLAPIENTRY * )(const char *)), eglGetProcAddress);
+ eglGetProcAddress = RESOLVE((QFunctionPointer (EGLAPIENTRY * )(const char *)), eglGetProcAddress);
if (!eglGetError || !eglGetDisplay || !eglInitialize || !eglGetProcAddress)
return false;
diff --git a/src/plugins/platforms/windows/qwindowseglcontext.h b/src/plugins/platforms/windows/qwindowseglcontext.h
index d8302c97a7..555d633a78 100644
--- a/src/plugins/platforms/windows/qwindowseglcontext.h
+++ b/src/plugins/platforms/windows/qwindowseglcontext.h
@@ -71,7 +71,7 @@ struct QWindowsLibEGL
EGLSurface (EGLAPIENTRY * eglGetCurrentSurface)(EGLint readdraw);
EGLDisplay (EGLAPIENTRY * eglGetCurrentDisplay)(void);
EGLBoolean (EGLAPIENTRY * eglSwapBuffers)(EGLDisplay dpy, EGLSurface surface);
- __eglMustCastToProperFunctionPointerType (EGLAPIENTRY * eglGetProcAddress)(const char *procname);
+ QFunctionPointer (EGLAPIENTRY *eglGetProcAddress)(const char *procname);
EGLDisplay (EGLAPIENTRY * eglGetPlatformDisplayEXT)(EGLenum platform, void *native_display, const EGLint *attrib_list);
diff --git a/src/plugins/platforms/windows/qwindowsguieventdispatcher.cpp b/src/plugins/platforms/windows/qwindowsguieventdispatcher.cpp
index 0dd2facd4d..0bfa0239aa 100644
--- a/src/plugins/platforms/windows/qwindowsguieventdispatcher.cpp
+++ b/src/plugins/platforms/windows/qwindowsguieventdispatcher.cpp
@@ -67,18 +67,20 @@ QWindowsGuiEventDispatcher::QWindowsGuiEventDispatcher(QObject *parent) :
bool QWindowsGuiEventDispatcher::processEvents(QEventLoop::ProcessEventsFlags flags)
{
+ const QEventLoop::ProcessEventsFlags oldFlags = m_flags;
m_flags = flags;
if (QWindowsContext::verbose > 2 && lcQpaEvents().isDebugEnabled())
qCDebug(lcQpaEvents) << '>' << __FUNCTION__ << objectName() << flags;
const bool rc = QEventDispatcherWin32::processEvents(flags);
if (QWindowsContext::verbose > 2 && lcQpaEvents().isDebugEnabled())
qCDebug(lcQpaEvents) << '<' << __FUNCTION__ << "returns" << rc;
+ m_flags = oldFlags;
return rc;
}
void QWindowsGuiEventDispatcher::sendPostedEvents()
{
- QCoreApplication::sendPostedEvents();
+ QEventDispatcherWin32::sendPostedEvents();
QWindowSystemInterface::sendWindowSystemEvents(m_flags);
}
diff --git a/src/plugins/platforms/windows/qwindowsmime.cpp b/src/plugins/platforms/windows/qwindowsmime.cpp
index 375a7f11db..52a4ca26dc 100644
--- a/src/plugins/platforms/windows/qwindowsmime.cpp
+++ b/src/plugins/platforms/windows/qwindowsmime.cpp
@@ -1579,7 +1579,11 @@ QVector<FORMATETC> QWindowsMimeConverter::allFormatsForMime(const QMimeData *mim
void QWindowsMimeConverter::ensureInitialized() const
{
if (m_mimes.isEmpty()) {
- m_mimes << new QWindowsMimeImage << new QLastResortMimes
+ m_mimes
+#ifndef QT_NO_IMAGEFORMAT_BMP
+ << new QWindowsMimeImage
+#endif //QT_NO_IMAGEFORMAT_BMP
+ << new QLastResortMimes
<< new QWindowsMimeText << new QWindowsMimeURI
<< new QWindowsMimeHtml << new QBuiltInMimes;
m_internalMimeCount = m_mimes.size();
diff --git a/src/plugins/platforms/windows/qwindowsopengltester.cpp b/src/plugins/platforms/windows/qwindowsopengltester.cpp
index 52e83395d1..befd06f1a2 100644
--- a/src/plugins/platforms/windows/qwindowsopengltester.cpp
+++ b/src/plugins/platforms/windows/qwindowsopengltester.cpp
@@ -276,7 +276,7 @@ QWindowsOpenGLTester::Renderers QWindowsOpenGLTester::supportedGlesRenderers()
{
const GpuDescription gpu = GpuDescription::detect();
const QWindowsOpenGLTester::Renderers result = detectSupportedRenderers(gpu, true);
- qDebug(lcQpaGl) << __FUNCTION__ << gpu << "renderer: " << result;
+ qCDebug(lcQpaGl) << __FUNCTION__ << gpu << "renderer: " << result;
return result;
}
@@ -284,7 +284,7 @@ QWindowsOpenGLTester::Renderers QWindowsOpenGLTester::supportedRenderers()
{
const GpuDescription gpu = GpuDescription::detect();
const QWindowsOpenGLTester::Renderers result = detectSupportedRenderers(gpu, false);
- qDebug(lcQpaGl) << __FUNCTION__ << gpu << "renderer: " << result;
+ qCDebug(lcQpaGl) << __FUNCTION__ << gpu << "renderer: " << result;
return result;
}
diff --git a/src/plugins/platforms/winrt/qwinrtmessagedialoghelper.cpp b/src/plugins/platforms/winrt/qwinrtmessagedialoghelper.cpp
index 68bf1fdcac..bb04144563 100644
--- a/src/plugins/platforms/winrt/qwinrtmessagedialoghelper.cpp
+++ b/src/plugins/platforms/winrt/qwinrtmessagedialoghelper.cpp
@@ -133,45 +133,46 @@ bool QWinRTMessageDialogHelper::show(Qt::WindowFlags windowFlags, Qt::WindowModa
RETURN_FALSE_IF_FAILED("Failed to create dialog");
}
- // Add Buttons
- ComPtr<IVector<IUICommand *>> dialogCommands;
- hr = dialog->get_Commands(&dialogCommands);
- RETURN_FALSE_IF_FAILED("Failed to get dialog commands");
-
- // If no button is specified we need to create one to get close notification
- int buttons = options->standardButtons();
- if (buttons == 0)
- buttons = Ok;
-
- for (int i = FirstButton; i < LastButton; i<<=1) {
- if (!(buttons & i))
- continue;
- // Add native command
- const QString label = d->theme->standardButtonText(i);
- HStringReference nativeLabel(reinterpret_cast<LPCWSTR>(label.utf16()), label.size());
- ComPtr<IUICommand> command;
- hr = commandFactory->Create(nativeLabel.Get(), &command);
- RETURN_FALSE_IF_FAILED("Failed to create message box command");
- ComPtr<IInspectable> id = Make<CommandId>(static_cast<StandardButton>(i));
- hr = command->put_Id(id.Get());
- RETURN_FALSE_IF_FAILED("Failed to set command ID");
- hr = dialogCommands->Append(command.Get());
- if (hr == E_BOUNDS) {
- qErrnoWarning(hr, "The WinRT message dialog supports a maximum of three buttons");
- continue;
- }
- RETURN_FALSE_IF_FAILED("Failed to append message box command");
- if (i == Abort || i == Cancel || i == Close) {
- quint32 size;
- hr = dialogCommands->get_Size(&size);
- RETURN_FALSE_IF_FAILED("Failed to get command list size");
- hr = dialog->put_CancelCommandIndex(size - 1);
- RETURN_FALSE_IF_FAILED("Failed to set cancel index");
+ hr = QEventDispatcherWinRT::runOnXamlThread([this, d, options, commandFactory, dialog]() {
+ HRESULT hr;
+
+ // Add Buttons
+ ComPtr<IVector<IUICommand *>> dialogCommands;
+ hr = dialog->get_Commands(&dialogCommands);
+ RETURN_HR_IF_FAILED("Failed to get dialog commands");
+
+ // If no button is specified we need to create one to get close notification
+ int buttons = options->standardButtons();
+ if (buttons == 0)
+ buttons = Ok;
+
+ for (int i = FirstButton; i < LastButton; i<<=1) {
+ if (!(buttons & i))
+ continue;
+ // Add native command
+ const QString label = d->theme->standardButtonText(i);
+ HStringReference nativeLabel(reinterpret_cast<LPCWSTR>(label.utf16()), label.size());
+ ComPtr<IUICommand> command;
+ hr = commandFactory->Create(nativeLabel.Get(), &command);
+ RETURN_HR_IF_FAILED("Failed to create message box command");
+ ComPtr<IInspectable> id = Make<CommandId>(static_cast<StandardButton>(i));
+ hr = command->put_Id(id.Get());
+ RETURN_HR_IF_FAILED("Failed to set command ID");
+ hr = dialogCommands->Append(command.Get());
+ if (hr == E_BOUNDS) {
+ qErrnoWarning(hr, "The WinRT message dialog supports a maximum of three buttons");
+ continue;
+ }
+ RETURN_HR_IF_FAILED("Failed to append message box command");
+ if (i == Abort || i == Cancel || i == Close) {
+ quint32 size;
+ hr = dialogCommands->get_Size(&size);
+ RETURN_HR_IF_FAILED("Failed to get command list size");
+ hr = dialog->put_CancelCommandIndex(size - 1);
+ RETURN_HR_IF_FAILED("Failed to set cancel index");
+ }
}
- }
- hr = QEventDispatcherWinRT::runOnXamlThread([this, d, dialog]() {
- HRESULT hr;
ComPtr<IAsyncOperation<IUICommand *>> op;
hr = dialog->ShowAsync(&op);
RETURN_HR_IF_FAILED("Failed to show dialog");
@@ -206,8 +207,7 @@ HRESULT QWinRTMessageDialogHelper::onCompleted(IAsyncOperation<IUICommand *> *as
Q_UNUSED(status);
Q_D(QWinRTMessageDialogHelper);
- if (d->loop.isRunning())
- d->loop.exit();
+ QEventLoopLocker locker(&d->loop);
d->shown = false;
diff --git a/src/plugins/platforms/winrt/qwinrttheme.cpp b/src/plugins/platforms/winrt/qwinrttheme.cpp
index a0fa2798a8..c32ec8a151 100644
--- a/src/plugins/platforms/winrt/qwinrttheme.cpp
+++ b/src/plugins/platforms/winrt/qwinrttheme.cpp
@@ -218,7 +218,7 @@ QVariant QWinRTTheme::styleHint(QPlatformIntegration::StyleHint hint)
case QPlatformIntegration::KeyboardAutoRepeatRate:
return defaultThemeHint(KeyboardAutoRepeatRate);
case QPlatformIntegration::ShowIsFullScreen:
- return true;
+ return false;
case QPlatformIntegration::PasswordMaskDelay:
return defaultThemeHint(PasswordMaskDelay);
case QPlatformIntegration::FontSmoothingGamma:
@@ -232,7 +232,7 @@ QVariant QWinRTTheme::styleHint(QPlatformIntegration::StyleHint hint)
case QPlatformIntegration::SetFocusOnTouchRelease:
return false;
case QPlatformIntegration::ShowIsMaximized:
- return false;
+ return true;
case QPlatformIntegration::MousePressAndHoldInterval:
return defaultThemeHint(MousePressAndHoldInterval);
default:
diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp
index c35b019f7e..13d73c7194 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection.cpp
@@ -476,7 +476,7 @@ void QXcbConnection::initializeScreens()
// Push the screens to QApplication
QXcbIntegration *integration = QXcbIntegration::instance();
foreach (QXcbScreen* screen, m_screens) {
- qCDebug(lcQpaScreen) << "adding" << screen << "(Primary:" << screen->isPrimary() << ")";
+ qCDebug(lcQpaScreen) << "adding" << screen << "(Primary:" << screen->isPrimary() << ')';
integration->screenAdded(screen, screen->isPrimary());
}
diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h
index 6ee32bf600..fb5b941fff 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.h
+++ b/src/plugins/platforms/xcb/qxcbconnection.h
@@ -376,8 +376,10 @@ public:
QXcbConnection *connection() const { return const_cast<QXcbConnection *>(this); }
+ const QList<QXcbVirtualDesktop *> &virtualDesktops() const { return m_virtualDesktops; }
const QList<QXcbScreen *> &screens() const { return m_screens; }
int primaryScreenNumber() const { return m_primaryScreenNumber; }
+ QXcbVirtualDesktop *primaryVirtualDesktop() const { return m_virtualDesktops.value(m_primaryScreenNumber); }
QXcbScreen *primaryScreen() const;
inline xcb_atom_t atom(QXcbAtom::Atom atom) const { return m_allAtoms[atom]; }
diff --git a/src/plugins/platforms/xcb/qxcbcursor.cpp b/src/plugins/platforms/xcb/qxcbcursor.cpp
index 0cd9159052..b321ed95dc 100644
--- a/src/plugins/platforms/xcb/qxcbcursor.cpp
+++ b/src/plugins/platforms/xcb/qxcbcursor.cpp
@@ -607,30 +607,33 @@ xcb_cursor_t QXcbCursor::createBitmapCursor(QCursor *cursor)
}
#endif
-void QXcbCursor::queryPointer(QXcbConnection *c, xcb_window_t *rootWin, QPoint *pos, int *keybMask)
+void QXcbCursor::queryPointer(QXcbConnection *c, QXcbVirtualDesktop **virtualDesktop, QPoint *pos, int *keybMask)
{
if (pos)
*pos = QPoint();
- xcb_screen_iterator_t it = xcb_setup_roots_iterator(c->setup());
- while (it.rem) {
- xcb_window_t root = it.data->root;
- xcb_query_pointer_cookie_t cookie = xcb_query_pointer(c->xcb_connection(), root);
- xcb_generic_error_t *err = 0;
- xcb_query_pointer_reply_t *reply = xcb_query_pointer_reply(c->xcb_connection(), cookie, &err);
- if (!err && reply) {
- if (pos)
- *pos = QPoint(reply->root_x, reply->root_y);
- if (rootWin)
- *rootWin = root;
- if (keybMask)
- *keybMask = reply->mask;
- free(reply);
- return;
+
+ xcb_window_t root = c->primaryVirtualDesktop()->root();
+ xcb_query_pointer_cookie_t cookie = xcb_query_pointer(c->xcb_connection(), root);
+ xcb_generic_error_t *err = 0;
+ xcb_query_pointer_reply_t *reply = xcb_query_pointer_reply(c->xcb_connection(), cookie, &err);
+ if (!err && reply) {
+ if (virtualDesktop) {
+ foreach (QXcbVirtualDesktop *vd, c->virtualDesktops()) {
+ if (vd->root() == reply->root) {
+ *virtualDesktop = vd;
+ break;
+ }
+ }
}
- free(err);
+ if (pos)
+ *pos = QPoint(reply->root_x, reply->root_y);
+ if (keybMask)
+ *keybMask = reply->mask;
free(reply);
- xcb_screen_next(&it);
+ return;
}
+ free(err);
+ free(reply);
}
QPoint QXcbCursor::pos() const
@@ -642,9 +645,9 @@ QPoint QXcbCursor::pos() const
void QXcbCursor::setPos(const QPoint &pos)
{
- xcb_window_t root = 0;
- queryPointer(connection(), &root, 0);
- xcb_warp_pointer(xcb_connection(), XCB_NONE, root, 0, 0, 0, 0, pos.x(), pos.y());
+ QXcbVirtualDesktop *virtualDesktop = Q_NULLPTR;
+ queryPointer(connection(), &virtualDesktop, 0);
+ xcb_warp_pointer(xcb_connection(), XCB_NONE, virtualDesktop->root(), 0, 0, 0, 0, pos.x(), pos.y());
xcb_flush(xcb_connection());
}
diff --git a/src/plugins/platforms/xcb/qxcbcursor.h b/src/plugins/platforms/xcb/qxcbcursor.h
index f4f6e61706..3c6dece1f2 100644
--- a/src/plugins/platforms/xcb/qxcbcursor.h
+++ b/src/plugins/platforms/xcb/qxcbcursor.h
@@ -75,7 +75,7 @@ public:
QPoint pos() const Q_DECL_OVERRIDE;
void setPos(const QPoint &pos) Q_DECL_OVERRIDE;
- static void queryPointer(QXcbConnection *c, xcb_window_t *rootWin, QPoint *pos, int *keybMask = 0);
+ static void queryPointer(QXcbConnection *c, QXcbVirtualDesktop **virtualDesktop, QPoint *pos, int *keybMask = 0);
private:
#ifndef QT_NO_CURSOR
diff --git a/src/plugins/platforms/xcb/qxcbdrag.cpp b/src/plugins/platforms/xcb/qxcbdrag.cpp
index de23c59a63..f9c3aa7fed 100644
--- a/src/plugins/platforms/xcb/qxcbdrag.cpp
+++ b/src/plugins/platforms/xcb/qxcbdrag.cpp
@@ -39,6 +39,7 @@
#include "qxcbwindow.h"
#include "qxcbscreen.h"
#include "qwindow.h"
+#include "qxcbcursor.h"
#include <private/qdnd_p.h>
#include <qdebug.h>
#include <qevent.h>
@@ -160,7 +161,7 @@ void QXcbDrag::init()
source_time = XCB_CURRENT_TIME;
target_time = XCB_CURRENT_TIME;
- current_screen = 0;
+ QXcbCursor::queryPointer(connection(), &current_virtual_desktop, 0);
drag_types.clear();
}
@@ -308,38 +309,20 @@ void QXcbDrag::move(const QPoint &globalPos)
if (source_sameanswer.contains(globalPos) && source_sameanswer.isValid())
return;
- const QList<QXcbScreen *> &screens = connection()->screens();
- QXcbScreen *screen = connection()->primaryScreen();
- for (int i = 0; i < screens.size(); ++i) {
- if (screens.at(i)->geometry().contains(globalPos)) {
- screen = screens.at(i);
- break;
- }
- }
+ QXcbVirtualDesktop *virtualDesktop = Q_NULLPTR;
+ QPoint cursorPos;
+ QXcbCursor::queryPointer(connection(), &virtualDesktop, &cursorPos);
+ QXcbScreen *screen = virtualDesktop->screenAt(cursorPos);
+ QPoint deviceIndependentPos = QHighDpiScaling::mapPositionFromNative(globalPos, screen);
- QBasicDrag::moveShapedPixmapWindow(QHighDpiScaling::mapPositionFromNative(globalPos, screen));
-
- if (screen != current_screen) {
- // ### need to recreate the shaped pixmap window?
-// int screen = QCursor::x11Screen();
-// if ((qt_xdnd_current_screen == -1 && screen != X11->defaultScreen) || (screen != qt_xdnd_current_screen)) {
-// // recreate the pixmap on the new screen...
-// delete xdnd_data.deco;
-// QWidget* parent = object->source()->window()->x11Info().screen() == screen
-// ? object->source()->window() : QApplication::desktop()->screen(screen);
-// xdnd_data.deco = new QShapedPixmapWidget(parent);
-// if (!QWidget::mouseGrabber()) {
-// updatePixmap();
-// xdnd_data.deco->grabMouse();
-// }
-// }
-// xdnd_data.deco->move(QCursor::pos() - xdnd_data.deco->pm_hot);
- current_screen = screen;
+ if (virtualDesktop != current_virtual_desktop) {
+ recreateShapedPixmapWindow(static_cast<QPlatformScreen*>(screen)->screen(), deviceIndependentPos);
+ current_virtual_desktop = virtualDesktop;
+ } else {
+ QBasicDrag::moveShapedPixmapWindow(deviceIndependentPos);
}
-
-// qt_xdnd_current_screen = screen;
- xcb_window_t rootwin = current_screen->root();
+ xcb_window_t rootwin = current_virtual_desktop->root();
xcb_translate_coordinates_reply_t *translate =
::translateCoordinates(connection(), rootwin, rootwin, globalPos.x(), globalPos.y());
if (!translate)
diff --git a/src/plugins/platforms/xcb/qxcbdrag.h b/src/plugins/platforms/xcb/qxcbdrag.h
index 9584c04238..c9d257906f 100644
--- a/src/plugins/platforms/xcb/qxcbdrag.h
+++ b/src/plugins/platforms/xcb/qxcbdrag.h
@@ -133,7 +133,7 @@ private:
// window to send events to (always valid if current_target)
xcb_window_t current_proxy_target;
- QXcbScreen *current_screen;
+ QXcbVirtualDesktop *current_virtual_desktop;
// 10 minute timer used to discard old XdndDrop transactions
enum { XdndDropTransactionTimeout = 600000 };
diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp
index 82cd1b86c9..da4db5edcb 100644
--- a/src/plugins/platforms/xcb/qxcbscreen.cpp
+++ b/src/plugins/platforms/xcb/qxcbscreen.cpp
@@ -61,6 +61,15 @@ QXcbVirtualDesktop::~QXcbVirtualDesktop()
delete m_xSettings;
}
+QXcbScreen *QXcbVirtualDesktop::screenAt(const QPoint &pos) const
+{
+ foreach (QXcbScreen *screen, connection()->screens()) {
+ if (screen->virtualDesktop() == this && screen->nativeGeometry().contains(pos))
+ return screen;
+ }
+ return Q_NULLPTR;
+}
+
QXcbXSettings *QXcbVirtualDesktop::xSettings() const
{
if (!m_xSettings) {
@@ -724,7 +733,7 @@ QDebug operator<<(QDebug debug, const QXcbScreen *screen)
formatSizeF(debug, screen->physicalSize());
// TODO 5.6 if (debug.verbosity() > 2) {
debug << ", screenNumber=" << screen->screenNumber();
- debug << ", virtualSize=" << screen->virtualSize().width() << "x" << screen->virtualSize().height() << " (";
+ debug << ", virtualSize=" << screen->virtualSize().width() << 'x' << screen->virtualSize().height() << " (";
formatSizeF(debug, screen->virtualSize());
debug << "), nativeGeometry=";
formatRect(debug, screen->nativeGeometry());
diff --git a/src/plugins/platforms/xcb/qxcbscreen.h b/src/plugins/platforms/xcb/qxcbscreen.h
index cbb6307d6e..d8d63608e7 100644
--- a/src/plugins/platforms/xcb/qxcbscreen.h
+++ b/src/plugins/platforms/xcb/qxcbscreen.h
@@ -64,6 +64,8 @@ public:
int number() const { return m_number; }
QSize size() const { return QSize(m_screen->width_in_pixels, m_screen->height_in_pixels); }
QSize physicalSize() const { return QSize(m_screen->width_in_millimeters, m_screen->height_in_millimeters); }
+ xcb_window_t root() const { return m_screen->root; }
+ QXcbScreen *screenAt(const QPoint &pos) const;
QXcbXSettings *xSettings() const;
@@ -104,6 +106,7 @@ public:
void setVirtualSiblings(QList<QPlatformScreen *> sl) { m_siblings = sl; }
void removeVirtualSibling(QPlatformScreen *s) { m_siblings.removeOne(s); }
void addVirtualSibling(QPlatformScreen *s) { ((QXcbScreen *) s)->isPrimary() ? m_siblings.prepend(s) : m_siblings.append(s); }
+ QXcbVirtualDesktop *virtualDesktop() const { return m_virtualDesktop; }
void setPrimary(bool primary) { m_primary = primary; }
bool isPrimary() const { return m_primary; }
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index d751c6d48a..e7f5bbf0e9 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -775,6 +775,13 @@ void QXcbWindow::setVisible(bool visible)
hide();
}
+static inline bool testShowWithoutActivating(const QWindow *window)
+{
+ // QWidget-attribute Qt::WA_ShowWithoutActivating.
+ const QVariant showWithoutActivating = window->property("_q_showWithoutActivating");
+ return showWithoutActivating.isValid() && showWithoutActivating.toBool();
+}
+
void QXcbWindow::show()
{
if (window()->isTopLevel()) {
@@ -822,7 +829,9 @@ void QXcbWindow::show()
updateNetWmStateBeforeMap();
}
- if (connection()->time() != XCB_TIME_CURRENT_TIME)
+ if (testShowWithoutActivating(window()))
+ updateNetWmUserTime(0);
+ else if (connection()->time() != XCB_TIME_CURRENT_TIME)
updateNetWmUserTime(connection()->time());
if (window()->objectName() == QLatin1String("QSystemTrayIconSysWindow"))
@@ -1112,6 +1121,9 @@ void QXcbWindow::setMotifWindowFlags(Qt::WindowFlags flags)
mwmhints.flags |= MWM_HINTS_DECORATIONS;
bool customize = flags & Qt::CustomizeWindowHint;
+ if (type == Qt::Window && !customize)
+ flags |= Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint;
+
if (!(flags & Qt::FramelessWindowHint) && !(customize && !(flags & Qt::WindowTitleHint))) {
mwmhints.decorations |= MWM_DECOR_BORDER;
mwmhints.decorations |= MWM_DECOR_RESIZEH;
@@ -1326,7 +1338,11 @@ void QXcbWindow::updateNetWmStateBeforeMap()
void QXcbWindow::updateNetWmUserTime(xcb_timestamp_t timestamp)
{
xcb_window_t wid = m_window;
- connection()->setNetWmUserTime(timestamp);
+ // If timestamp == 0, then it means that the window should not be
+ // initially activated. Don't update global user time for this
+ // special case.
+ if (timestamp != 0)
+ connection()->setNetWmUserTime(timestamp);
const bool isSupportedByWM = connection()->wmSupport()->isSupportedByWM(atom(QXcbAtom::_NET_WM_USER_TIME_WINDOW));
if (m_netWmUserTimeWindow || isSupportedByWM) {
diff --git a/src/printsupport/dialogs/qprintdialog_unix.cpp b/src/printsupport/dialogs/qprintdialog_unix.cpp
index a15fd51c98..9633032a0f 100644
--- a/src/printsupport/dialogs/qprintdialog_unix.cpp
+++ b/src/printsupport/dialogs/qprintdialog_unix.cpp
@@ -806,7 +806,7 @@ void QUnixPrintWidgetPrivate::applyPrinterProperties()
home += QLatin1Char('/');
if (!cur.isEmpty() && cur.at(cur.length()-1) != QLatin1Char('/'))
cur += QLatin1Char('/');
- if (cur.left(home.length()) != home)
+ if (!cur.startsWith(home))
cur = home;
if (QGuiApplication::platformName() == QLatin1String("xcb")) {
if (printer->docName().isEmpty()) {
diff --git a/src/printsupport/doc/qtprintsupport.qdocconf b/src/printsupport/doc/qtprintsupport.qdocconf
index 2ec33f6600..fbb6f8d1a9 100644
--- a/src/printsupport/doc/qtprintsupport.qdocconf
+++ b/src/printsupport/doc/qtprintsupport.qdocconf
@@ -26,7 +26,7 @@ qhp.QtPrintSupport.subprojects.classes.sortPages = true
tagfile = ../../../doc/qtprintsupport/qtprintsupport.tags
-depends += qtcore qtgui qtwidgets qtdoc
+depends += qtcore qtgui qtwidgets qtdoc qmake
headerdirs += ..
diff --git a/src/printsupport/kernel/qpaintengine_alpha.cpp b/src/printsupport/kernel/qpaintengine_alpha.cpp
index 0ae9464b69..79026e5762 100644
--- a/src/printsupport/kernel/qpaintengine_alpha.cpp
+++ b/src/printsupport/kernel/qpaintengine_alpha.cpp
@@ -146,8 +146,16 @@ void QAlphaPaintEngine::updateState(const QPaintEngineState &state)
d->m_hasalpha = d->m_alphaOpacity || d->m_alphaBrush || d->m_alphaPen;
- if (d->m_picengine)
+ if (d->m_picengine) {
+ const QPainter *p = painter();
+ d->m_picpainter->setPen(p->pen());
+ d->m_picpainter->setBrush(p->brush());
+ d->m_picpainter->setBrushOrigin(p->brushOrigin());
+ d->m_picpainter->setFont(p->font());
+ d->m_picpainter->setOpacity(p->opacity());
+ d->m_picpainter->setTransform(p->combinedTransform());
d->m_picengine->updateState(state);
+ }
}
void QAlphaPaintEngine::drawPath(const QPainterPath &path)
diff --git a/src/printsupport/kernel/qprintengine_win.cpp b/src/printsupport/kernel/qprintengine_win.cpp
index b377401ed9..c8ce2e482d 100644
--- a/src/printsupport/kernel/qprintengine_win.cpp
+++ b/src/printsupport/kernel/qprintengine_win.cpp
@@ -93,9 +93,10 @@ static QByteArray msgBeginFailed(const char *function, const DOCINFO &d)
{
QString result;
QTextStream str(&result);
- str << "QWin32PrintEngine::begin: " << function << " failed, document \""
- << QString::fromWCharArray(d.lpszDocName) << '"';
- if (d.lpszOutput[0])
+ str << "QWin32PrintEngine::begin: " << function << " failed";
+ if (d.lpszDocName && d.lpszDocName[0])
+ str << ", document \"" << QString::fromWCharArray(d.lpszDocName) << '"';
+ if (d.lpszOutput && d.lpszOutput[0])
str << ", file \"" << QString::fromWCharArray(d.lpszOutput) << '"';
return result.toLocal8Bit();
}
@@ -1149,7 +1150,7 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &
d->updateMetrics();
d->doReinit();
#ifdef QT_DEBUG_METRICS
- qDebug() << "QWin32PrintEngine::setProperty(PPK_Orientation," << orientation << ")";
+ qDebug() << "QWin32PrintEngine::setProperty(PPK_Orientation," << orientation << ')';
d->debugMetrics();
#endif // QT_DEBUG_METRICS
break;
@@ -1172,7 +1173,7 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &
d->setPageSize(pageSize);
d->doReinit();
#ifdef QT_DEBUG_METRICS
- qDebug() << "QWin32PrintEngine::setProperty(PPK_PageSize," << value.toInt() << ")";
+ qDebug() << "QWin32PrintEngine::setProperty(PPK_PageSize," << value.toInt() << ')';
d->debugMetrics();
#endif // QT_DEBUG_METRICS
}
@@ -1188,7 +1189,7 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &
d->setPageSize(pageSize);
d->doReinit();
#ifdef QT_DEBUG_METRICS
- qDebug() << "QWin32PrintEngine::setProperty(PPK_PaperName," << value.toString() << ")";
+ qDebug() << "QWin32PrintEngine::setProperty(PPK_PaperName," << value.toString() << ')';
d->debugMetrics();
#endif // QT_DEBUG_METRICS
}
@@ -1227,7 +1228,7 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &
d->stretch_y = d->dpi_y / double(d->resolution);
d->updateMetrics();
#ifdef QT_DEBUG_METRICS
- qDebug() << "QWin32PrintEngine::setProperty(PPK_Resolution," << value.toInt() << ")";
+ qDebug() << "QWin32PrintEngine::setProperty(PPK_Resolution," << value.toInt() << ')';
d->debugMetrics();
#endif // QT_DEBUG_METRICS
break;
@@ -1241,7 +1242,7 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &
d->setPageSize(pageSize);
d->doReinit();
#ifdef QT_DEBUG_METRICS
- qDebug() << "QWin32PrintEngine::setProperty(PPK_WindowsPageSize," << value.toInt() << ")";
+ qDebug() << "QWin32PrintEngine::setProperty(PPK_WindowsPageSize," << value.toInt() << ')';
d->debugMetrics();
#endif // QT_DEBUG_METRICS
break;
@@ -1257,7 +1258,7 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &
d->setPageSize(pageSize);
d->doReinit();
#ifdef QT_DEBUG_METRICS
- qDebug() << "QWin32PrintEngine::setProperty(PPK_CustomPaperSize," << value.toSizeF() << ")";
+ qDebug() << "QWin32PrintEngine::setProperty(PPK_CustomPaperSize," << value.toSizeF() << ')';
d->debugMetrics();
#endif // QT_DEBUG_METRICS
}
@@ -1272,7 +1273,7 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &
margins.at(2).toReal(), margins.at(3).toReal()));
d->updateMetrics();
#ifdef QT_DEBUG_METRICS
- qDebug() << "QWin32PrintEngine::setProperty(PPK_PageMargins," << margins << ")";
+ qDebug() << "QWin32PrintEngine::setProperty(PPK_PageMargins," << margins << ')';
d->debugMetrics();
#endif // QT_DEBUG_METRICS
break;
@@ -1287,7 +1288,7 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &
d->setPageSize(pageSize);
d->doReinit();
#ifdef QT_DEBUG_METRICS
- qDebug() << "QWin32PrintEngine::setProperty(PPK_QPageSize," << pageSize << ")";
+ qDebug() << "QWin32PrintEngine::setProperty(PPK_QPageSize," << pageSize << ')';
d->debugMetrics();
#endif // QT_DEBUG_METRICS
}
@@ -1300,7 +1301,7 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &
d->m_pageLayout.setMargins(pair.first);
d->updateMetrics();
#ifdef QT_DEBUG_METRICS
- qDebug() << "QWin32PrintEngine::setProperty(PPK_QPageMargins," << pair.first << pair.second << ")";
+ qDebug() << "QWin32PrintEngine::setProperty(PPK_QPageMargins," << pair.first << pair.second << ')';
d->debugMetrics();
#endif // QT_DEBUG_METRICS
break;
@@ -1316,7 +1317,7 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &
d->m_pageLayout.setMargins(pageLayout.margins());
d->updateMetrics();
#ifdef QT_DEBUG_METRICS
- qDebug() << "QWin32PrintEngine::setProperty(PPK_QPageLayout," << pageLayout << ")";
+ qDebug() << "QWin32PrintEngine::setProperty(PPK_QPageLayout," << pageLayout << ')';
d->debugMetrics();
#endif // QT_DEBUG_METRICS
}
diff --git a/src/sql/doc/qtsql.qdocconf b/src/sql/doc/qtsql.qdocconf
index b8632c5260..5a224adeb9 100644
--- a/src/sql/doc/qtsql.qdocconf
+++ b/src/sql/doc/qtsql.qdocconf
@@ -25,7 +25,7 @@ qhp.QtSql.subprojects.classes.selectors = class fake:headerfile
qhp.QtSql.subprojects.classes.sortPages = true
tagfile = ../../../doc/qtsql/qtsql.tags
-depends += qtcore qtwidgets qtdoc
+depends += qtcore qtwidgets qtdoc qmake
headerdirs += ..
diff --git a/src/sql/drivers/mysql/qsql_mysql.cpp b/src/sql/drivers/mysql/qsql_mysql.cpp
index ea8a918dcf..96bdcc42fa 100644
--- a/src/sql/drivers/mysql/qsql_mysql.cpp
+++ b/src/sql/drivers/mysql/qsql_mysql.cpp
@@ -1325,20 +1325,21 @@ bool QMYSQLDriver::open(const QString& db,
if (writeTimeout != 0)
mysql_options(d->mysql, MYSQL_OPT_WRITE_TIMEOUT, &writeTimeout);
#endif
- if (mysql_real_connect(d->mysql,
- host.isNull() ? static_cast<const char *>(0)
- : host.toLocal8Bit().constData(),
- user.isNull() ? static_cast<const char *>(0)
- : user.toLocal8Bit().constData(),
- password.isNull() ? static_cast<const char *>(0)
- : password.toLocal8Bit().constData(),
- db.isNull() ? static_cast<const char *>(0)
- : db.toLocal8Bit().constData(),
- (port > -1) ? port : 0,
- unixSocket.isNull() ? static_cast<const char *>(0)
- : unixSocket.toLocal8Bit().constData(),
- optionFlags))
- {
+ MYSQL *mysql = mysql_real_connect(d->mysql,
+ host.isNull() ? static_cast<const char *>(0)
+ : host.toLocal8Bit().constData(),
+ user.isNull() ? static_cast<const char *>(0)
+ : user.toLocal8Bit().constData(),
+ password.isNull() ? static_cast<const char *>(0)
+ : password.toLocal8Bit().constData(),
+ db.isNull() ? static_cast<const char *>(0)
+ : db.toLocal8Bit().constData(),
+ (port > -1) ? port : 0,
+ unixSocket.isNull() ? static_cast<const char *>(0)
+ : unixSocket.toLocal8Bit().constData(),
+ optionFlags);
+
+ if (mysql == d->mysql) {
if (!db.isEmpty() && mysql_select_db(d->mysql, db.toLocal8Bit().constData())) {
setLastError(qMakeError(tr("Unable to open database '%1'").arg(db), QSqlError::ConnectionError, d));
mysql_close(d->mysql);
diff --git a/src/sql/drivers/oci/qsql_oci.cpp b/src/sql/drivers/oci/qsql_oci.cpp
index 33e3b96276..f0c0b224bd 100644
--- a/src/sql/drivers/oci/qsql_oci.cpp
+++ b/src/sql/drivers/oci/qsql_oci.cpp
@@ -2452,7 +2452,7 @@ QStringList QOCIDriver::tables(QSql::TableType type) const
t.exec(query + whereList.join(QLatin1String(" or ")));
while (t.next()) {
if (t.value(0).toString() != d->user)
- tl.append(t.value(0).toString() + QLatin1String(".") + t.value(1).toString());
+ tl.append(t.value(0).toString() + QLatin1Char('.') + t.value(1).toString());
else
tl.append(t.value(1).toString());
}
diff --git a/src/sql/drivers/sqlite/qsql_sqlite.cpp b/src/sql/drivers/sqlite/qsql_sqlite.cpp
index 06e849ccd5..4286f5b338 100644
--- a/src/sql/drivers/sqlite/qsql_sqlite.cpp
+++ b/src/sql/drivers/sqlite/qsql_sqlite.cpp
@@ -744,7 +744,7 @@ static QSqlIndex qGetTableInfo(QSqlQuery &q, const QString &tableName, bool only
schema = tableName.left(indexOfSeparator).append(QLatin1Char('.'));
table = tableName.mid(indexOfSeparator + 1);
}
- q.exec(QLatin1String("PRAGMA ") + schema + QLatin1String("table_info (") + _q_escapeIdentifier(table) + QLatin1String(")"));
+ q.exec(QLatin1String("PRAGMA ") + schema + QLatin1String("table_info (") + _q_escapeIdentifier(table) + QLatin1Char(')'));
QSqlIndex ind;
while (q.next()) {
diff --git a/src/testlib/doc/snippets/code/src_qtestlib_qtestcase.cpp b/src/testlib/doc/snippets/code/src_qtestlib_qtestcase.cpp
index 29cbefdc04..8c32787b42 100644
--- a/src/testlib/doc/snippets/code/src_qtestlib_qtestcase.cpp
+++ b/src/testlib/doc/snippets/code/src_qtestlib_qtestcase.cpp
@@ -147,7 +147,7 @@ namespace QTest {
{
QByteArray ba = "MyPoint(";
ba += QByteArray::number(point.x()) + ", " + QByteArray::number(point.y());
- ba += ")";
+ ba += ')';
return qstrdup(ba.data());
}
}
diff --git a/src/testlib/qtestblacklist.cpp b/src/testlib/qtestblacklist.cpp
index eb7abdad46..c2643a2304 100644
--- a/src/testlib/qtestblacklist.cpp
+++ b/src/testlib/qtestblacklist.cpp
@@ -109,7 +109,9 @@ static QSet<QByteArray> keywords()
#ifdef Q_CC_MSVC
<< "msvc"
#ifdef _MSC_VER
- #if _MSC_VER == 1800
+ #if _MSC_VER == 1900
+ << "msvc-2015"
+ #elif _MSC_VER == 1800
<< "msvc-2013"
#elif _MSC_VER == 1700
<< "msvc-2012"
@@ -172,7 +174,7 @@ static bool isGPUTestBlacklisted(const char *slot, const char *data = 0)
if (gpuFeatures->find(disableKey) != gpuFeatures->end()) {
QByteArray msg = QByteArrayLiteral("Skipped due to GPU blacklist: ") + disableKey;
if (data)
- msg += QByteArrayLiteral(":") + QByteArray(data);
+ msg += ':' + QByteArray(data);
QTest::qSkip(msg.constData(), __FILE__, __LINE__);
return true;
}
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp
index 000470e9e5..0847d639fd 100644
--- a/src/testlib/qtestcase.cpp
+++ b/src/testlib/qtestcase.cpp
@@ -2597,9 +2597,13 @@ private:
void FatalSignalHandler::signal(int signum)
{
+ const int msecsFunctionTime = qRound(QTestLog::msecsFunctionTime());
+ const int msecsTotalTime = qRound(QTestLog::msecsTotalTime());
if (signum != SIGINT)
stackTrace();
- qFatal("Received signal %d", signum);
+ qFatal("Received signal %d\n"
+ " Function time: %dms Total time: %dms",
+ signum, msecsFunctionTime, msecsTotalTime);
#if defined(Q_OS_INTEGRITY)
{
struct sigaction act;
@@ -2794,12 +2798,15 @@ static LONG WINAPI windowsFaultHandler(struct _EXCEPTION_POINTERS *exInfo)
char appName[MAX_PATH];
if (!GetModuleFileNameA(NULL, appName, MAX_PATH))
appName[0] = 0;
-
+ const int msecsFunctionTime = qRound(QTestLog::msecsFunctionTime());
+ const int msecsTotalTime = qRound(QTestLog::msecsTotalTime());
const void *exceptionAddress = exInfo->ExceptionRecord->ExceptionAddress;
- printf("A crash occurred in %s.\n\n"
+ printf("A crash occurred in %s.\n"
+ "Function time: %dms Total time: %dms\n\n"
"Exception address: 0x%p\n"
"Exception code : 0x%lx\n",
- appName, exceptionAddress, exInfo->ExceptionRecord->ExceptionCode);
+ appName, msecsFunctionTime, msecsTotalTime,
+ exceptionAddress, exInfo->ExceptionRecord->ExceptionCode);
DebugSymbolResolver resolver(GetCurrentProcess());
if (resolver.isValid()) {
diff --git a/src/testlib/qtestkeyboard.h b/src/testlib/qtestkeyboard.h
index d73658d8fc..d2b3ef240b 100644
--- a/src/testlib/qtestkeyboard.h
+++ b/src/testlib/qtestkeyboard.h
@@ -57,7 +57,7 @@
QT_BEGIN_NAMESPACE
Q_GUI_EXPORT void qt_handleKeyEvent(QWindow *w, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1);
-Q_GUI_EXPORT bool qt_sendShortcutOverrideEvent(QObject *o, ulong timestamp, int k, Qt::KeyboardModifiers mods, const QString &text = QString(), bool autorep = false, ushort count = 1);
+Q_GUI_EXPORT bool qt_handleShortcutEvent(QObject *o, ulong timestamp, int k, Qt::KeyboardModifiers mods, const QString &text = QString(), bool autorep = false, ushort count = 1);
namespace QTest
{
@@ -97,7 +97,7 @@ namespace QTest
if (action == Shortcut) {
int timestamp = 0;
- qt_sendShortcutOverrideEvent(window, timestamp, code, modifier, text, repeat);
+ qt_handleShortcutEvent(window, timestamp, code, modifier, text, repeat);
return;
}
@@ -178,7 +178,7 @@ namespace QTest
QKeyEvent a(press ? QEvent::KeyPress : QEvent::KeyRelease, code, modifier, text, repeat);
QSpontaneKeyEvent::setSpontaneous(&a);
- if (press && qt_sendShortcutOverrideEvent(widget, a.timestamp(), code, modifier, text, repeat))
+ if (press && qt_handleShortcutEvent(widget, a.timestamp(), code, modifier, text, repeat))
return;
if (!qApp->notify(widget, &a))
QTest::qWarn("Keyboard event not accepted by receiving widget");
diff --git a/src/testlib/qtestlog.cpp b/src/testlib/qtestlog.cpp
index 59aeb27ffe..3513e10eec 100644
--- a/src/testlib/qtestlog.cpp
+++ b/src/testlib/qtestlog.cpp
@@ -46,6 +46,7 @@
#include <QtCore/qatomic.h>
#include <QtCore/qbytearray.h>
+#include <QtCore/QElapsedTimer>
#include <QtCore/QVariant>
#include <QtCore/QRegularExpression>
@@ -75,6 +76,9 @@ static void saveCoverageTool(const char * appname, bool testfailed, bool install
#endif
}
+static QElapsedTimer elapsedFunctionTime;
+static QElapsedTimer elapsedTotalTime;
+
namespace QTest {
int fails = 0;
@@ -325,6 +329,7 @@ namespace QTest {
void QTestLog::enterTestFunction(const char* function)
{
+ elapsedFunctionTime.restart();
if (printAvailableTags)
return;
@@ -450,6 +455,8 @@ void QTestLog::addBenchmarkResult(const QBenchmarkResult &result)
void QTestLog::startLogging()
{
+ elapsedTotalTime.start();
+ elapsedFunctionTime.start();
QTest::TestLoggers::startLogging();
QTest::oldMessageHandler = qInstallMessageHandler(QTest::messageHandler);
}
@@ -597,4 +604,14 @@ bool QTestLog::installedTestCoverage()
return QTest::installedTestCoverage;
}
+qint64 QTestLog::nsecsTotalTime()
+{
+ return elapsedTotalTime.nsecsElapsed();
+}
+
+qint64 QTestLog::nsecsFunctionTime()
+{
+ return elapsedFunctionTime.nsecsElapsed();
+}
+
QT_END_NAMESPACE
diff --git a/src/testlib/qtestlog_p.h b/src/testlib/qtestlog_p.h
index b4786b4904..b7e9d16ec3 100644
--- a/src/testlib/qtestlog_p.h
+++ b/src/testlib/qtestlog_p.h
@@ -110,6 +110,11 @@ public:
static void setInstalledTestCoverage(bool installed);
static bool installedTestCoverage();
+ static qint64 nsecsTotalTime();
+ static qreal msecsTotalTime() { return QTestLog::nsecsTotalTime() / 1000000.; }
+ static qint64 nsecsFunctionTime();
+ static qreal msecsFunctionTime() { return QTestLog::nsecsFunctionTime() / 1000000.; }
+
private:
QTestLog();
~QTestLog();
diff --git a/src/testlib/qxmltestlogger.cpp b/src/testlib/qxmltestlogger.cpp
index bf607b4702..f96b5647e4 100644
--- a/src/testlib/qxmltestlogger.cpp
+++ b/src/testlib/qxmltestlogger.cpp
@@ -36,6 +36,7 @@
#include <QtCore/qglobal.h>
#include <QtCore/qlibraryinfo.h>
+#include <QtTest/private/qtestlog_p.h>
#include <QtTest/private/qxmltestlogger_p.h>
#include <QtTest/private/qtestresult_p.h>
#include <QtTest/private/qbenchmark_p.h>
@@ -124,15 +125,13 @@ void QXmlTestLogger::startLogging()
" <QTestVersion>" QTEST_VERSION_STR "</QTestVersion>\n"
"</Environment>\n", qVersion(), quotedBuild.constData());
outputString(buf.constData());
- m_totalTime.start();
}
void QXmlTestLogger::stopLogging()
{
QTestCharBuffer buf;
QTest::qt_asprintf(&buf,
- "<Duration msecs=\"%f\"/>\n",
- m_totalTime.nsecsElapsed() / 1000000.);
+ "<Duration msecs=\"%f\"/>\n", QTestLog::msecsTotalTime());
outputString(buf.constData());
if (xmlmode == QXmlTestLogger::Complete) {
outputString("</TestCase>\n");
@@ -148,8 +147,6 @@ void QXmlTestLogger::enterTestFunction(const char *function)
xmlQuote(&quotedFunction, function);
QTest::qt_asprintf(&buf, "<TestFunction name=\"%s\">\n", quotedFunction.constData());
outputString(buf.constData());
-
- m_functionTime.start();
}
void QXmlTestLogger::leaveTestFunction()
@@ -158,7 +155,7 @@ void QXmlTestLogger::leaveTestFunction()
QTest::qt_asprintf(&buf,
" <Duration msecs=\"%f\"/>\n"
"</TestFunction>\n",
- m_functionTime.nsecsElapsed() / 1000000.);
+ QTestLog::msecsFunctionTime());
outputString(buf.constData());
}
diff --git a/src/testlib/qxmltestlogger_p.h b/src/testlib/qxmltestlogger_p.h
index 5cf8b4596c..49a21d9ca1 100644
--- a/src/testlib/qxmltestlogger_p.h
+++ b/src/testlib/qxmltestlogger_p.h
@@ -47,7 +47,6 @@
#include <QtTest/private/qabstracttestlogger_p.h>
-#include <QtCore/qelapsedtimer.h>
QT_BEGIN_NAMESPACE
@@ -79,8 +78,6 @@ public:
private:
XmlMode xmlmode;
- QElapsedTimer m_functionTime;
- QElapsedTimer m_totalTime;
};
QT_END_NAMESPACE
diff --git a/src/testlib/testlib.pro b/src/testlib/testlib.pro
index 0070cdb271..ff4379f85d 100644
--- a/src/testlib/testlib.pro
+++ b/src/testlib/testlib.pro
@@ -92,7 +92,7 @@ mac {
# don't know yet if the target that links to testlib will build under Xcode or not.
# The corresponding flags for the target lives in xctest.prf, where we do know.
QMAKE_LFLAGS += -F$${platform_dev_frameworks_path} -weak_framework XCTest
- QMAKE_OBJECTIVE_CFLAGS += -F$${platform_dev_frameworks_path}
+ QMAKE_CXXFLAGS += -F$${platform_dev_frameworks_path}
MODULE_CONFIG += xctest
}
}
diff --git a/src/tools/qdoc/codemarker.cpp b/src/tools/qdoc/codemarker.cpp
index 458799fc27..a668205a66 100644
--- a/src/tools/qdoc/codemarker.cpp
+++ b/src/tools/qdoc/codemarker.cpp
@@ -210,7 +210,7 @@ void CodeMarker::appendProtectedString(QString *output, const QStringRef &str)
}
}
-QString CodeMarker::typified(const QString &string)
+QString CodeMarker::typified(const QString &string, bool trailingSpace)
{
QString result;
QString pendingWord;
@@ -254,6 +254,11 @@ QString CodeMarker::typified(const QString &string)
}
}
}
+ if (trailingSpace && string.size()) {
+ if (!string.endsWith(QLatin1Char('*'))
+ && !string.endsWith(QLatin1Char('&')))
+ result += QLatin1Char(' ');
+ }
return result;
}
diff --git a/src/tools/qdoc/codemarker.h b/src/tools/qdoc/codemarker.h
index 31a9f3a254..011c8623dd 100644
--- a/src/tools/qdoc/codemarker.h
+++ b/src/tools/qdoc/codemarker.h
@@ -159,7 +159,7 @@ public:
static const Node *nodeForString(const QString& string);
static QString stringForNode(const Node *node);
- QString typified(const QString &string);
+ QString typified(const QString &string, bool trailingSpace = false);
protected:
virtual QString sortName(const Node *node, const QString* name = 0);
diff --git a/src/tools/qdoc/config.cpp b/src/tools/qdoc/config.cpp
index ae6bbaf5da..6c47b86d22 100644
--- a/src/tools/qdoc/config.cpp
+++ b/src/tools/qdoc/config.cpp
@@ -493,7 +493,7 @@ QStringList Config::getCanonicalPathList(const QString& var, bool validate) cons
QDir dir(sl[i].simplified());
QString path = dir.path();
if (dir.isRelative())
- dir.setPath(d + "/" + path);
+ dir.setPath(d + QLatin1Char('/') + path);
if (validate && !QFileInfo::exists(dir.path()))
lastLocation_.warning(tr("Cannot find file or directory: %1").arg(path));
else
@@ -889,7 +889,7 @@ QStringList Config::loadMaster(const QString& fileName)
if (!fin.open(QFile::ReadOnly | QFile::Text)) {
if (!Config::installDir.isEmpty()) {
int prefix = location.filePath().length() - location.fileName().length();
- fin.setFileName(Config::installDir + "/" + fileName.right(fileName.length() - prefix));
+ fin.setFileName(Config::installDir + QLatin1Char('/') + fileName.right(fileName.length() - prefix));
}
if (!fin.open(QFile::ReadOnly | QFile::Text))
location.fatal(tr("Cannot open master qdocconf file '%1': %2").arg(fileName).arg(fin.errorString()));
@@ -945,7 +945,7 @@ void Config::load(Location location, const QString& fileName)
if (!fin.open(QFile::ReadOnly | QFile::Text)) {
if (!Config::installDir.isEmpty()) {
int prefix = location.filePath().length() - location.fileName().length();
- fin.setFileName(Config::installDir + "/" + fileName.right(fileName.length() - prefix));
+ fin.setFileName(Config::installDir + QLatin1Char('/') + fileName.right(fileName.length() - prefix));
}
if (!fin.open(QFile::ReadOnly | QFile::Text))
location.fatal(tr("Cannot open file '%1': %2").arg(fileName).arg(fin.errorString()));
diff --git a/src/tools/qdoc/cppcodemarker.cpp b/src/tools/qdoc/cppcodemarker.cpp
index 774ff115b9..01ff827d58 100644
--- a/src/tools/qdoc/cppcodemarker.cpp
+++ b/src/tools/qdoc/cppcodemarker.cpp
@@ -150,18 +150,18 @@ QString CppCodeMarker::markedUpSynopsis(const Node *node,
case Node::QmlSignalHandler:
case Node::QmlMethod:
func = (const FunctionNode *) node;
+
if (style != Subpage && !func->returnType().isEmpty())
- synopsis = typified(func->returnType()) + QLatin1Char(' ');
+ synopsis = typified(func->returnType(), true);
synopsis += name;
if (func->metaness() != FunctionNode::MacroWithoutParams) {
- synopsis += "(";
+ synopsis += QLatin1Char('(');
if (!func->parameters().isEmpty()) {
- //synopsis += QLatin1Char(' ');
QVector<Parameter>::ConstIterator p = func->parameters().constBegin();
while (p != func->parameters().constEnd()) {
if (p != func->parameters().constBegin())
synopsis += ", ";
- synopsis += typified((*p).dataType());
+ synopsis += typified((*p).dataType(), true);
if (style != Subpage && !(*p).name().isEmpty())
synopsis +=
"<@param>" + protect((*p).name()) + "</@param>";
@@ -170,7 +170,6 @@ QString CppCodeMarker::markedUpSynopsis(const Node *node,
synopsis += " = " + protect((*p).defaultValue());
++p;
}
- //synopsis += QLatin1Char(' ');
}
synopsis += QLatin1Char(')');
}
@@ -273,7 +272,7 @@ QString CppCodeMarker::markedUpSynopsis(const Node *node,
synopsis = name + " : " + typified(variable->dataType());
}
else {
- synopsis = typified(variable->leftType()) + QLatin1Char(' ') +
+ synopsis = typified(variable->leftType(), true) +
name + protect(variable->rightType());
}
break;
@@ -323,7 +322,7 @@ QString CppCodeMarker::markedUpQmlItem(const Node* node, bool summary)
(node->type() == Node::QmlSignalHandler)) {
const FunctionNode* func = static_cast<const FunctionNode*>(node);
if (!func->returnType().isEmpty())
- synopsis = typified(func->returnType()) + QLatin1Char(' ') + name;
+ synopsis = typified(func->returnType(), true) + name;
else
synopsis = name;
synopsis += QLatin1Char('(');
@@ -332,12 +331,9 @@ QString CppCodeMarker::markedUpQmlItem(const Node* node, bool summary)
while (p != func->parameters().constEnd()) {
if (p != func->parameters().constBegin())
synopsis += ", ";
- synopsis += typified((*p).dataType());
- if (!(*p).name().isEmpty()) {
- if (!synopsis.endsWith(QLatin1Char('(')))
- synopsis += QLatin1Char(' ');
+ synopsis += typified((*p).dataType(), true);
+ if (!(*p).name().isEmpty())
synopsis += "<@param>" + protect((*p).name()) + "</@param>";
- }
synopsis += protect((*p).rightType());
++p;
}
diff --git a/src/tools/qdoc/cppcodeparser.cpp b/src/tools/qdoc/cppcodeparser.cpp
index 5d2a2c90d0..f20b998cc4 100644
--- a/src/tools/qdoc/cppcodeparser.cpp
+++ b/src/tools/qdoc/cppcodeparser.cpp
@@ -2321,7 +2321,7 @@ bool CppCodeParser::matchDocsAndStuff()
QString topics;
QSet<QString>::ConstIterator t = topicCommandsUsed.constBegin();
while (t != topicCommandsUsed.constEnd()) {
- topics += " \\" + *t + ",";
+ topics += " \\" + *t + QLatin1Char(',');
++t;
}
topics[topics.lastIndexOf(',')] = '.';
diff --git a/src/tools/qdoc/doc/examples/examples.qdoc b/src/tools/qdoc/doc/examples/examples.qdoc
index ce67dea20e..28810e30da 100644
--- a/src/tools/qdoc/doc/examples/examples.qdoc
+++ b/src/tools/qdoc/doc/examples/examples.qdoc
@@ -89,9 +89,9 @@
\title UI Components
\brief Basic set of UI components
- This is a listing of a list of UI components implemented by QML types.
- These files are available for general import and they are based off the
- \e {Qt Quick Code Samples}.
+ This is a listing of a list of UI components implemented by QML types. These
+ files are available for general import and they are based on the
+ \l{Qt Quick Examples and Tutorials}{Qt Quick Code Samples}.
This module is part of the \l{componentset}{UIComponents} example.
*/
diff --git a/src/tools/qdoc/doc/qdoc-manual-contextcmds.qdoc b/src/tools/qdoc/doc/qdoc-manual-contextcmds.qdoc
index a2e851293c..d707c77cfb 100644
--- a/src/tools/qdoc/doc/qdoc-manual-contextcmds.qdoc
+++ b/src/tools/qdoc/doc/qdoc-manual-contextcmds.qdoc
@@ -269,7 +269,7 @@
library.} It is provided to keep old source code
working. We strongly advise against using it in new
code. See the \l
- {http://doc.qt.digia.com/4.0/porting4.html} {Porting
+ {http://doc.qt.io/qt-4.8/porting4.html} {Porting
Guide} for more information.
\endquotation
diff --git a/src/tools/qdoc/doc/qdoc-manual-qdocconf.qdoc b/src/tools/qdoc/doc/qdoc-manual-qdocconf.qdoc
index d490f8549a..69980c1e18 100644
--- a/src/tools/qdoc/doc/qdoc-manual-qdocconf.qdoc
+++ b/src/tools/qdoc/doc/qdoc-manual-qdocconf.qdoc
@@ -1392,8 +1392,8 @@
\endcode
The complete variable entry in \l qtgui.qdocconf provides the
- standard header of the \l {http://doc.qt.digia.com/}
- {Qt Reference Documentation}.
+ standard header of the \l {http://doc.qt.io/qt-5/qtgui-index.html}
+ {Qt GUI Documentation}.
\target HTML.style-variable
\section1 HTML.style
@@ -1521,7 +1521,7 @@
This makes sure that whenever \c qt.index is used to generate
references to for example Qt classes, the base URL is \c
- http://doc.qt.digia.com/4.7.
+ http://doc.qt.io/qt-4.8/.
See also \l indexes.
diff --git a/src/tools/qdoc/doc/qdoc-manual-topiccmds.qdoc b/src/tools/qdoc/doc/qdoc-manual-topiccmds.qdoc
index 306fc40cb8..1dfd031633 100644
--- a/src/tools/qdoc/doc/qdoc-manual-topiccmds.qdoc
+++ b/src/tools/qdoc/doc/qdoc-manual-topiccmds.qdoc
@@ -812,7 +812,7 @@
<tr valign="top" bgcolor="#d0d0d0">
<td><b>
- <a href="http://doc.qt.digia.com/4.0/qftp.html">QFtp</a>
+ <a href="http://doc.qt.io/archives/qt-4.7/qftp.html">QFtp</a>
</b></td>
<td>
Implementation of the FTP protocol
@@ -885,7 +885,7 @@
<pre>#include &lt;Qt&gt;</pre>
<ul>
<li>
- <a href="http://doc.qt.digia.com/4.0/qt-qt3.html">
+ <a href="http://doc.qt.io/archives/qt-4.7/qt-qt3.html">
Qt 3 support members</a></li>
</ul>
@@ -893,7 +893,7 @@
<h3>Types</h3>
<ul>
<li>flags
- <a href="http://doc.qt.digia.com/4.0/qt.html#AlignmentFlag-enum">Alignment</a></b></li>
+ <a href="http://doc.qt.io/archives/qt-4.7/qt.html#AlignmentFlag-enum">Alignment</a></b></li>
<li>...</li></ul>
<hr />
\endraw
diff --git a/src/tools/qdoc/doc/qdoc-minimum-qdocconf.qdoc b/src/tools/qdoc/doc/qdoc-minimum-qdocconf.qdoc
index 66ceed4a3d..1fcd23a0f8 100644
--- a/src/tools/qdoc/doc/qdoc-minimum-qdocconf.qdoc
+++ b/src/tools/qdoc/doc/qdoc-minimum-qdocconf.qdoc
@@ -26,7 +26,7 @@
****************************************************************************/
/*!
\page qdoc-minimum-qdocconf.html
-\target minimal-qdocconf
+\keyword minimal-qdocconf
\title A Minimal qdocconf File
\brief Describes a minimal .qdocconf file
diff --git a/src/tools/qdoc/generator.cpp b/src/tools/qdoc/generator.cpp
index 5037d95640..3ce5bf99d0 100644
--- a/src/tools/qdoc/generator.cpp
+++ b/src/tools/qdoc/generator.cpp
@@ -1500,7 +1500,7 @@ void Generator::generateOverloadedSignal(const Node* node, CodeMarker* marker)
// We have an overloaded signal, show an example
QString code = "connect(" + objectName + ", static_cast<" + func->returnType()
- + "(" + func->parent()->name() + "::*)(";
+ + QLatin1Char('(') + func->parent()->name() + "::*)(";
for (int i = 0; i < func->parameters().size(); ++i) {
if (i != 0)
code += ", ";
@@ -1508,7 +1508,7 @@ void Generator::generateOverloadedSignal(const Node* node, CodeMarker* marker)
code += p.dataType() + p.rightType();
}
- code += ")";
+ code += QLatin1Char(')');
if (func->isConst())
code += " const";
code += ">(&" + func->parent()->name() + "::" + func->name() + "),\n [=](";
@@ -1519,7 +1519,7 @@ void Generator::generateOverloadedSignal(const Node* node, CodeMarker* marker)
const Parameter &p = func->parameters().at(i);
code += p.dataType();
if (code[code.size()-1].isLetterOrNumber())
- code += " ";
+ code += QLatin1Char(' ');
code += p.name() + p.rightType();
}
diff --git a/src/tools/qdoc/htmlgenerator.cpp b/src/tools/qdoc/htmlgenerator.cpp
index eaa6de42ef..90f8ab2046 100644
--- a/src/tools/qdoc/htmlgenerator.cpp
+++ b/src/tools/qdoc/htmlgenerator.cpp
@@ -1191,7 +1191,7 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark
if (unit < 3) {
out() << "id=\"" << Doc::canonicalTitle(Text::sectionHeading(atom).toString()) << "\"";
}
- out() << ">";
+ out() << '>';
inSectionHeading_ = true;
break;
}
@@ -1228,18 +1228,18 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark
if (!p1.isEmpty()) {
if (p1 == QLatin1String("borderless"))
attr = p1;
- else if (p1.contains("%"))
+ else if (p1.contains(QLatin1Char('%')))
width = p1;
}
if (!p2.isEmpty()) {
if (p2 == QLatin1String("borderless"))
attr = p2;
- else if (p2.contains("%"))
+ else if (p2.contains(QLatin1Char('%')))
width = p2;
}
- out() << "<div class=\"table\"><table class=\"" << attr << "\"";
+ out() << "<div class=\"table\"><table class=\"" << attr << '"';
if (!width.isEmpty())
- out() << " width=\"" << width << "\"";
+ out() << " width=\"" << width << '"';
out() << ">\n ";
numTableRows_ = 0;
}
@@ -1288,7 +1288,7 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark
out() << p;
}
else {
- QStringList spans = p.split(",");
+ QStringList spans = p.split(QLatin1Char(','));
if (spans.size() == 2) {
if (spans.at(0) != "1")
out() << " colspan=\"" << spans.at(0) << '"';
@@ -2216,7 +2216,7 @@ void HtmlGenerator::generateRequisites(Aggregate *inner, CodeMarker *marker)
out() << "<tr>"
<< "<td class=\"memItemLeft rightAlign topAlign\"> "
<< *i << ":"
- << "</td><td class=\"memItemRight bottomAlign\"> ";
+ "</td><td class=\"memItemRight bottomAlign\"> ";
if (*i == headerText)
out() << requisites.value(*i).toString();
@@ -2262,7 +2262,7 @@ void HtmlGenerator::generateQmlRequisites(QmlTypeNode *qcn, CodeMarker *marker)
else
logicalModuleVersion = qcn->logicalModuleVersion();
text.clear();
- text << "import " + qcn->logicalModuleName() + " " + logicalModuleVersion;
+ text << "import " + qcn->logicalModuleName() + QLatin1Char(' ') + logicalModuleVersion;
requisites.insert(importText, text);
//add the since and project into the map
@@ -3150,7 +3150,7 @@ void HtmlGenerator::generateQmlItem(const Node *node,
}
marked.replace(QRegExp("<@param>([a-z]+)_([1-9n])</@param>"),
"<i>\\1<sub>\\2</sub></i>");
- marked.replace("<@param>", "<i> ");
+ marked.replace("<@param>", "<i>");
marked.replace("</@param>", "</i>");
if (summary)
@@ -3390,7 +3390,7 @@ void HtmlGenerator::generateSynopsis(const Node *node,
}
marked.replace(QRegExp("<@param>([a-z]+)_([1-9n])</@param>"),
"<i>\\1<sub>\\2</sub></i>");
- marked.replace("<@param>", "<i> ");
+ marked.replace("<@param>", "<i>");
marked.replace("</@param>", "</i>");
if (style == CodeMarker::Summary) {
@@ -3820,7 +3820,7 @@ QString HtmlGenerator::getAutoLink(const Atom *atom, const Node *relative, const
int hashtag = link.lastIndexOf(QChar('#'));
if (hashtag != -1)
link.truncate(hashtag);
- link += "#" + ref;
+ link += QLatin1Char('#') + ref;
}
return link;
}
diff --git a/src/tools/qdoc/node.h b/src/tools/qdoc/node.h
index 6262cee0ab..6b1032805f 100644
--- a/src/tools/qdoc/node.h
+++ b/src/tools/qdoc/node.h
@@ -1134,7 +1134,7 @@ class CollectionNode : public Aggregate
virtual QString logicalModuleName() const Q_DECL_OVERRIDE { return logicalModuleName_; }
virtual QString logicalModuleVersion() const Q_DECL_OVERRIDE {
- return logicalModuleVersionMajor_ + "." + logicalModuleVersionMinor_;
+ return logicalModuleVersionMajor_ + QLatin1Char('.') + logicalModuleVersionMinor_;
}
virtual QString logicalModuleIdentifier() const Q_DECL_OVERRIDE {
return logicalModuleName_ + logicalModuleVersionMajor_;
diff --git a/src/tools/qdoc/puredocparser.cpp b/src/tools/qdoc/puredocparser.cpp
index 80a7ec4bf5..b47f1fc453 100644
--- a/src/tools/qdoc/puredocparser.cpp
+++ b/src/tools/qdoc/puredocparser.cpp
@@ -173,7 +173,7 @@ bool PureDocParser::processQdocComments()
QString topics;
QSet<QString>::ConstIterator t = topicCommandsUsed.constBegin();
while (t != topicCommandsUsed.constEnd()) {
- topics += " \\" + *t + ",";
+ topics += " \\" + *t + QLatin1Char(',');
++t;
}
topics[topics.lastIndexOf(',')] = '.';
diff --git a/src/tools/qdoc/qdocdatabase.cpp b/src/tools/qdoc/qdocdatabase.cpp
index ca1648ec2f..d48804d566 100644
--- a/src/tools/qdoc/qdocdatabase.cpp
+++ b/src/tools/qdoc/qdocdatabase.cpp
@@ -340,10 +340,10 @@ void QDocForest::printLinkCounts(const QString& project)
while (i != m.end()) {
QString line = " " + i.value();
if (i.value() != module)
- depends += " " + i.value();
+ depends += QLatin1Char(' ') + i.value();
int pad = 30 - line.length();
for (int k=0; k<pad; ++k)
- line += " ";
+ line += QLatin1Char(' ');
line += "%1";
Location::null.report(line.arg(-(i.key())));
++i;
@@ -370,7 +370,7 @@ QString QDocForest::getLinkCounts(QStringList& strings, QVector<int>& counts)
if (i.value() != module) {
counts.append(-(i.key()));
strings.append(i.value());
- depends += " " + i.value();
+ depends += QLatin1Char(' ') + i.value();
}
++i;
}
@@ -1296,6 +1296,8 @@ void QDocDatabase::resolveIssues() {
QDocIndexFiles::qdocIndexFiles()->resolveRelates();
QDocIndexFiles::destroyQDocIndexFiles();
}
+ if (Generator::generating())
+ resolveNamespaces();
}
void QDocDatabase::resolveStuff()
@@ -1326,8 +1328,10 @@ void QDocDatabase::resolveNamespaces()
int count = nmm_.remove(s);
if (count > 1) {
foreach (Node* n, nodes) {
- if (n->isNamespace() && n->wasSeen()) {
+ // Treat public namespaces from index trees as 'seen'
+ if (n->isNamespace() && (n->wasSeen() || (n->isIndexNode() && n->access() == Node::Public))) {
ns = static_cast<NamespaceNode*>(n);
+ ns->markSeen();
break;
}
}
@@ -1670,7 +1674,7 @@ const Node* QDocDatabase::findNodeForAtom(const Atom* a, const Node* relative, Q
const Node* node = 0;
Atom* atom = const_cast<Atom*>(a);
- QStringList targetPath = atom->string().split("#");
+ QStringList targetPath = atom->string().split(QLatin1Char('#'));
QString first = targetPath.first().trimmed();
Tree* domain = 0;
diff --git a/src/tools/qdoc/qdocindexfiles.cpp b/src/tools/qdoc/qdocindexfiles.cpp
index fc262d9834..ef86d782c7 100644
--- a/src/tools/qdoc/qdocindexfiles.cpp
+++ b/src/tools/qdoc/qdocindexfiles.cpp
@@ -463,10 +463,15 @@ void QDocIndexFiles::readIndexSection(QXmlStreamReader& reader,
location = Location(parent->name().toLower() + ".html");
while (reader.readNextStartElement()) {
+ QXmlStreamAttributes childAttributes = reader.attributes();
if (reader.name() == QLatin1String("value")) {
- QXmlStreamAttributes childAttributes = reader.attributes();
+
EnumItem item(childAttributes.value(QLatin1String("name")).toString(), childAttributes.value(QLatin1String("value")).toString());
enumNode->addItem(item);
+ } else if (reader.name() == QLatin1String("keyword")) {
+ insertTarget(TargetRec::Keyword, childAttributes, enumNode);
+ } else if (reader.name() == QLatin1String("target")) {
+ insertTarget(TargetRec::Target, childAttributes, enumNode);
}
reader.skipCurrentElement();
}
@@ -552,8 +557,8 @@ void QDocIndexFiles::readIndexSection(QXmlStreamReader& reader,
*/
while (reader.readNextStartElement()) {
+ QXmlStreamAttributes childAttributes = reader.attributes();
if (reader.name() == QLatin1String("parameter")) {
- QXmlStreamAttributes childAttributes = reader.attributes();
// Do not use the default value for the parameter; it is not
// required, and has been known to cause problems.
Parameter parameter(childAttributes.value(QLatin1String("left")).toString(),
@@ -561,6 +566,10 @@ void QDocIndexFiles::readIndexSection(QXmlStreamReader& reader,
childAttributes.value(QLatin1String("name")).toString(),
QString()); // childAttributes.value(QLatin1String("default"))
functionNode->addParameter(parameter);
+ } else if (reader.name() == QLatin1String("keyword")) {
+ insertTarget(TargetRec::Keyword, childAttributes, functionNode);
+ } else if (reader.name() == QLatin1String("target")) {
+ insertTarget(TargetRec::Target, childAttributes, functionNode);
}
reader.skipCurrentElement();
}
@@ -581,18 +590,15 @@ void QDocIndexFiles::readIndexSection(QXmlStreamReader& reader,
location = Location(parent->name().toLower() + ".html");
}
else if (elementName == QLatin1String("keyword")) {
- QString title = attributes.value(QLatin1String("title")).toString();
- qdb_->insertTarget(name, title, TargetRec::Keyword, current, 1);
+ insertTarget(TargetRec::Keyword, attributes, current);
goto done;
}
else if (elementName == QLatin1String("target")) {
- QString title = attributes.value(QLatin1String("title")).toString();
- qdb_->insertTarget(name, title, TargetRec::Target, current, 2);
+ insertTarget(TargetRec::Target, attributes, current);
goto done;
}
else if (elementName == QLatin1String("contents")) {
- QString title = attributes.value(QLatin1String("title")).toString();
- qdb_->insertTarget(name, title, TargetRec::Contents, current, 3);
+ insertTarget(TargetRec::Contents, attributes, current);
goto done;
}
else
@@ -660,7 +666,7 @@ void QDocIndexFiles::readIndexSection(QXmlStreamReader& reader,
QString groupsAttr = attributes.value(QLatin1String("groups")).toString();
if (!groupsAttr.isEmpty()) {
- QStringList groupNames = groupsAttr.split(",");
+ QStringList groupNames = groupsAttr.split(QLatin1Char(','));
foreach (const QString &name, groupNames) {
qdb_->addToGroup(name, node);
}
@@ -702,6 +708,30 @@ void QDocIndexFiles::readIndexSection(QXmlStreamReader& reader,
}
}
+void QDocIndexFiles::insertTarget(TargetRec::TargetType type,
+ const QXmlStreamAttributes &attributes,
+ Node *node)
+{
+ int priority;
+ switch (type) {
+ case TargetRec::Keyword:
+ priority = 1;
+ break;
+ case TargetRec::Target:
+ priority = 2;
+ break;
+ case TargetRec::Contents:
+ priority = 3;
+ break;
+ default:
+ return;
+ }
+
+ QString name = attributes.value(QLatin1String("name")).toString();
+ QString title = attributes.value(QLatin1String("title")).toString();
+ qdb_->insertTarget(name, title, type, node, priority);
+}
+
/*!
This function tries to resolve class inheritance immediately
after the index file is read. It is not always possible to
@@ -946,27 +976,27 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer,
}
writer.writeAttribute("name", objName);
- if (node->isQmlModule()) {
- logicalModuleName = node->logicalModuleName();
- logicalModuleVersion = node->logicalModuleVersion();
- if (!logicalModuleName.isEmpty()) {
- writer.writeAttribute("qml-module-name", logicalModuleName);
- if (node->isQmlModule())
- writer.writeAttribute("qml-module-version", logicalModuleVersion);
- if (!qmlFullBaseName.isEmpty())
- writer.writeAttribute("qml-base-type", qmlFullBaseName);
+
+ // Write module and base type info for QML/JS types
+ if (node->type() == Node::QmlType || node->type() == Node::QmlModule) {
+ QString baseNameAttr("qml-base-type");
+ QString moduleNameAttr("qml-module-name");
+ QString moduleVerAttr("qml-module-version");
+ if (node->isJsNode()) {
+ baseNameAttr = "js-base-type";
+ moduleNameAttr = "js-module-name";
+ moduleVerAttr = "js-module-version";
}
- }
- else if (node->isJsModule()) {
- logicalModuleName = node->logicalModuleName();
- logicalModuleVersion = node->logicalModuleVersion();
- if (!logicalModuleName.isEmpty()) {
- writer.writeAttribute("js-module-name", logicalModuleName);
- if (node->isQmlModule())
- writer.writeAttribute("js-module-version", logicalModuleVersion);
- if (!qmlFullBaseName.isEmpty())
- writer.writeAttribute("js-base-type", qmlFullBaseName);
+ if (node->type() == Node::QmlModule) {
+ logicalModuleName = node->logicalModuleName();
+ logicalModuleVersion = node->logicalModuleVersion();
}
+ if (!logicalModuleName.isEmpty())
+ writer.writeAttribute(moduleNameAttr, logicalModuleName);
+ if (!logicalModuleVersion.isEmpty())
+ writer.writeAttribute(moduleVerAttr, logicalModuleVersion);
+ if (!qmlFullBaseName.isEmpty())
+ writer.writeAttribute(baseNameAttr, qmlFullBaseName);
}
QString href;
@@ -1029,11 +1059,11 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer,
baseStrings.insert(n->fullName());
}
if (!baseStrings.isEmpty())
- writer.writeAttribute("bases", QStringList(baseStrings.toList()).join(","));
+ writer.writeAttribute("bases", QStringList(baseStrings.toList()).join(QLatin1Char(',')));
if (!node->physicalModuleName().isEmpty())
writer.writeAttribute("module", node->physicalModuleName());
if (!classNode->groupNames().isEmpty())
- writer.writeAttribute("groups", classNode->groupNames().join(","));
+ writer.writeAttribute("groups", classNode->groupNames().join(QLatin1Char(',')));
if (!brief.isEmpty())
writer.writeAttribute("brief", brief);
}
@@ -1044,7 +1074,7 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer,
if (!namespaceNode->physicalModuleName().isEmpty())
writer.writeAttribute("module", namespaceNode->physicalModuleName());
if (!namespaceNode->groupNames().isEmpty())
- writer.writeAttribute("groups", namespaceNode->groupNames().join(","));
+ writer.writeAttribute("groups", namespaceNode->groupNames().join(QLatin1Char(',')));
if (!brief.isEmpty())
writer.writeAttribute("brief", brief);
}
@@ -1056,7 +1086,7 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer,
writer.writeAttribute("fulltitle", qcn->fullTitle());
writer.writeAttribute("subtitle", qcn->subTitle());
if (!qcn->groupNames().isEmpty())
- writer.writeAttribute("groups", qcn->groupNames().join(","));
+ writer.writeAttribute("groups", qcn->groupNames().join(QLatin1Char(',')));
if (!brief.isEmpty())
writer.writeAttribute("brief", brief);
}
@@ -1098,7 +1128,7 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer,
writer.writeAttribute("module", node->physicalModuleName());
}
if (!docNode->groupNames().isEmpty())
- writer.writeAttribute("groups", docNode->groupNames().join(","));
+ writer.writeAttribute("groups", docNode->groupNames().join(QLatin1Char(',')));
if (!brief.isEmpty())
writer.writeAttribute("brief", brief);
}
@@ -1113,7 +1143,7 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer,
if (!cn->physicalModuleName().isEmpty())
writer.writeAttribute("module", cn->physicalModuleName());
if (!cn->groupNames().isEmpty())
- writer.writeAttribute("groups", cn->groupNames().join(","));
+ writer.writeAttribute("groups", cn->groupNames().join(QLatin1Char(',')));
/*
This is not read back in, so it probably
shouldn't be written out in the first place.
@@ -1122,7 +1152,7 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer,
QStringList names;
foreach (const Node* member, cn->members())
names.append(member->name());
- writer.writeAttribute("members", names.join(","));
+ writer.writeAttribute("members", names.join(QLatin1Char(',')));
}
if (!brief.isEmpty())
writer.writeAttribute("brief", brief);
@@ -1138,7 +1168,7 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer,
if (!cn->physicalModuleName().isEmpty())
writer.writeAttribute("module", cn->physicalModuleName());
if (!cn->groupNames().isEmpty())
- writer.writeAttribute("groups", cn->groupNames().join(","));
+ writer.writeAttribute("groups", cn->groupNames().join(QLatin1Char(',')));
/*
This is not read back in, so it probably
shouldn't be written out in the first place.
@@ -1147,7 +1177,7 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer,
QStringList names;
foreach (const Node* member, cn->members())
names.append(member->name());
- writer.writeAttribute("members", names.join(","));
+ writer.writeAttribute("members", names.join(QLatin1Char(',')));
}
if (!brief.isEmpty())
writer.writeAttribute("brief", brief);
@@ -1163,7 +1193,7 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer,
if (!cn->physicalModuleName().isEmpty())
writer.writeAttribute("module", cn->physicalModuleName());
if (!cn->groupNames().isEmpty())
- writer.writeAttribute("groups", cn->groupNames().join(","));
+ writer.writeAttribute("groups", cn->groupNames().join(QLatin1Char(',')));
/*
This is not read back in, so it probably
shouldn't be written out in the first place.
@@ -1172,7 +1202,7 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer,
QStringList names;
foreach (const Node* member, cn->members())
names.append(member->name());
- writer.writeAttribute("members", names.join(","));
+ writer.writeAttribute("members", names.join(QLatin1Char(',')));
}
if (!brief.isEmpty())
writer.writeAttribute("brief", brief);
diff --git a/src/tools/qdoc/qdocindexfiles.h b/src/tools/qdoc/qdocindexfiles.h
index 67a7e7226e..9873322b3b 100644
--- a/src/tools/qdoc/qdocindexfiles.h
+++ b/src/tools/qdoc/qdocindexfiles.h
@@ -35,6 +35,7 @@
#define QDOCINDEXFILES_H
#include "node.h"
+#include "tree.h"
QT_BEGIN_NAMESPACE
@@ -43,6 +44,7 @@ class Generator;
class QStringList;
class QDocDatabase;
class QXmlStreamWriter;
+class QXmlStreamAttributes;
class QDocIndexFiles
{
@@ -64,6 +66,7 @@ class QDocIndexFiles
void readIndexFile(const QString& path);
void readIndexSection(QXmlStreamReader &reader, Node* current, const QString& indexUrl);
+ void insertTarget(TargetRec::TargetType type, const QXmlStreamAttributes &attributes, Node *node);
void resolveIndex();
void resolveRelates();
bool generateIndexSection(QXmlStreamWriter& writer, Node* node, bool generateInternalNodes = false);
diff --git a/src/tools/qdoc/qmlvisitor.cpp b/src/tools/qdoc/qmlvisitor.cpp
index 155e1de054..0cb4d84513 100644
--- a/src/tools/qdoc/qmlvisitor.cpp
+++ b/src/tools/qdoc/qmlvisitor.cpp
@@ -624,7 +624,7 @@ bool QmlDocVisitor::visit(QQmlJS::AST::UiImport *import)
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;
+ QString reconstructed = importUri + QLatin1Char(' ') + version;
importList.append(ImportRec(name, version, importId, importUri));
return true;
diff --git a/src/tools/uic/qclass_lib_map.h b/src/tools/uic/qclass_lib_map.h
index 940017d063..930a648d57 100644
--- a/src/tools/uic/qclass_lib_map.h
+++ b/src/tools/uic/qclass_lib_map.h
@@ -969,10 +969,10 @@ QT_CLASS_LIB(QTextEdit, QtWidgets, qtextedit.h)
QT_CLASS_LIB(QToolBar, QtWidgets, qtoolbar.h)
QT_CLASS_LIB(QToolBox, QtWidgets, qtoolbox.h)
QT_CLASS_LIB(QToolButton, QtWidgets, qtoolbutton.h)
-QT_CLASS_LIB(QValidator, QtWidgets, qvalidator.h)
-QT_CLASS_LIB(QIntValidator, QtWidgets, qvalidator.h)
-QT_CLASS_LIB(QDoubleValidator, QtWidgets, qvalidator.h)
-QT_CLASS_LIB(QRegExpValidator, QtWidgets, qvalidator.h)
+QT_CLASS_LIB(QValidator, QtGui, qvalidator.h)
+QT_CLASS_LIB(QIntValidator, QtGui, qvalidator.h)
+QT_CLASS_LIB(QDoubleValidator, QtGui, qvalidator.h)
+QT_CLASS_LIB(QRegExpValidator, QtGui, qvalidator.h)
QT_CLASS_LIB(QScriptEngineDebugger, QtScriptTools, qscriptenginedebugger.h)
QT_CLASS_LIB(QDesignerComponents, QtDesigner, qdesigner_components.h)
QT_CLASS_LIB(QExtensionFactory, QtDesigner, default_extensionfactory.h)
diff --git a/src/widgets/accessible/accessible.pri b/src/widgets/accessible/accessible.pri
index bcdfbd639c..ac8205b1e3 100644
--- a/src/widgets/accessible/accessible.pri
+++ b/src/widgets/accessible/accessible.pri
@@ -4,12 +4,12 @@ contains(QT_CONFIG, accessibility) {
HEADERS += \
accessible/qaccessiblewidget.h \
accessible/qaccessiblewidgetfactory_p.h \
- accessible/complexwidgets.h \
- accessible/itemviews.h \
- accessible/qaccessiblemenu.h \
- accessible/qaccessiblewidgets.h \
- accessible/rangecontrols.h \
- accessible/simplewidgets.h
+ accessible/complexwidgets_p.h \
+ accessible/itemviews_p.h \
+ accessible/qaccessiblemenu_p.h \
+ accessible/qaccessiblewidgets_p.h \
+ accessible/rangecontrols_p.h \
+ accessible/simplewidgets_p.h
SOURCES += \
accessible/qaccessiblewidget.cpp \
diff --git a/src/widgets/accessible/complexwidgets.cpp b/src/widgets/accessible/complexwidgets.cpp
index 649a7f4363..ba87fead3c 100644
--- a/src/widgets/accessible/complexwidgets.cpp
+++ b/src/widgets/accessible/complexwidgets.cpp
@@ -31,7 +31,7 @@
**
****************************************************************************/
-#include "complexwidgets.h"
+#include "complexwidgets_p.h"
#include <qaccessible.h>
#include <qapplication.h>
diff --git a/src/widgets/accessible/complexwidgets.h b/src/widgets/accessible/complexwidgets_p.h
index bd063e7517..8edf996818 100644
--- a/src/widgets/accessible/complexwidgets.h
+++ b/src/widgets/accessible/complexwidgets_p.h
@@ -34,6 +34,17 @@
#ifndef COMPLEXWIDGETS_H
#define COMPLEXWIDGETS_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include <QtCore/qpointer.h>
#include <QtWidgets/qaccessiblewidget.h>
#include <QtWidgets/qabstractitemview.h>
diff --git a/src/widgets/accessible/itemviews.cpp b/src/widgets/accessible/itemviews.cpp
index 23a459c7e6..1b724c9a17 100644
--- a/src/widgets/accessible/itemviews.cpp
+++ b/src/widgets/accessible/itemviews.cpp
@@ -31,7 +31,7 @@
**
****************************************************************************/
-#include "itemviews.h"
+#include "itemviews_p.h"
#include <qheaderview.h>
#include <qtableview.h>
diff --git a/src/widgets/accessible/itemviews.h b/src/widgets/accessible/itemviews_p.h
index 33757f168a..6a18a1231b 100644
--- a/src/widgets/accessible/itemviews.h
+++ b/src/widgets/accessible/itemviews_p.h
@@ -34,6 +34,17 @@
#ifndef ACCESSIBLE_ITEMVIEWS_H
#define ACCESSIBLE_ITEMVIEWS_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include "QtCore/qpointer.h"
#include <QtGui/qaccessible.h>
#include <QtWidgets/qaccessiblewidget.h>
diff --git a/src/widgets/accessible/qaccessiblemenu.cpp b/src/widgets/accessible/qaccessiblemenu.cpp
index 72eb82b2b7..a0a7852851 100644
--- a/src/widgets/accessible/qaccessiblemenu.cpp
+++ b/src/widgets/accessible/qaccessiblemenu.cpp
@@ -31,7 +31,7 @@
**
****************************************************************************/
-#include "qaccessiblemenu.h"
+#include "qaccessiblemenu_p.h"
#include <qmenu.h>
#include <qmenubar.h>
diff --git a/src/widgets/accessible/qaccessiblemenu.h b/src/widgets/accessible/qaccessiblemenu_p.h
index 9c7671072d..b42c852ff1 100644
--- a/src/widgets/accessible/qaccessiblemenu.h
+++ b/src/widgets/accessible/qaccessiblemenu_p.h
@@ -34,6 +34,17 @@
#ifndef QACCESSIBLEMENU_H
#define QACCESSIBLEMENU_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include <QtWidgets/qaccessiblewidget.h>
#include <QtCore/qpointer.h>
diff --git a/src/widgets/accessible/qaccessiblewidgetfactory.cpp b/src/widgets/accessible/qaccessiblewidgetfactory.cpp
index e8b325b93f..4fa7c89482 100644
--- a/src/widgets/accessible/qaccessiblewidgetfactory.cpp
+++ b/src/widgets/accessible/qaccessiblewidgetfactory.cpp
@@ -31,12 +31,12 @@
**
****************************************************************************/
-#include "qaccessiblewidgets.h"
-#include "qaccessiblemenu.h"
-#include "simplewidgets.h"
-#include "rangecontrols.h"
-#include "complexwidgets.h"
-#include "itemviews.h"
+#include "qaccessiblewidgets_p.h"
+#include "qaccessiblemenu_p.h"
+#include "simplewidgets_p.h"
+#include "rangecontrols_p.h"
+#include "complexwidgets_p.h"
+#include "itemviews_p.h"
#include <qpushbutton.h>
#include <qtoolbutton.h>
diff --git a/src/widgets/accessible/qaccessiblewidgetfactory_p.h b/src/widgets/accessible/qaccessiblewidgetfactory_p.h
index b3f9d8a251..d94f2d1cb2 100644
--- a/src/widgets/accessible/qaccessiblewidgetfactory_p.h
+++ b/src/widgets/accessible/qaccessiblewidgetfactory_p.h
@@ -36,6 +36,17 @@
#ifndef QACCESSIBLEWIDGETFACTORY_H
#define QACCESSIBLEWIDGETFACTORY_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
QT_BEGIN_NAMESPACE
QAccessibleInterface *qAccessibleFactory(const QString &classname, QObject *object);
diff --git a/src/widgets/accessible/qaccessiblewidgets.cpp b/src/widgets/accessible/qaccessiblewidgets.cpp
index c598a5b4cb..adf908b821 100644
--- a/src/widgets/accessible/qaccessiblewidgets.cpp
+++ b/src/widgets/accessible/qaccessiblewidgets.cpp
@@ -31,7 +31,7 @@
**
****************************************************************************/
-#include "qaccessiblewidgets.h"
+#include "qaccessiblewidgets_p.h"
#include "qabstracttextdocumentlayout.h"
#include "qapplication.h"
#include "qclipboard.h"
diff --git a/src/widgets/accessible/qaccessiblewidgets.h b/src/widgets/accessible/qaccessiblewidgets_p.h
index 53f8c2c603..4bdc229578 100644
--- a/src/widgets/accessible/qaccessiblewidgets.h
+++ b/src/widgets/accessible/qaccessiblewidgets_p.h
@@ -34,6 +34,17 @@
#ifndef QACCESSIBLEWIDGETS_H
#define QACCESSIBLEWIDGETS_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include <QtWidgets/qaccessiblewidget.h>
#ifndef QT_NO_ACCESSIBILITY
diff --git a/src/widgets/accessible/rangecontrols.cpp b/src/widgets/accessible/rangecontrols.cpp
index 002d4a9ef4..0607a35269 100644
--- a/src/widgets/accessible/rangecontrols.cpp
+++ b/src/widgets/accessible/rangecontrols.cpp
@@ -31,7 +31,7 @@
**
****************************************************************************/
-#include "rangecontrols.h"
+#include "rangecontrols_p.h"
#include <qslider.h>
#include <qdial.h>
@@ -47,7 +47,7 @@
#include <qmath.h>
#include <private/qmath_p.h>
-#include "simplewidgets.h" // let spinbox use line edit's interface
+#include "simplewidgets_p.h" // let spinbox use line edit's interface
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/accessible/rangecontrols.h b/src/widgets/accessible/rangecontrols_p.h
index 11d4435e9d..32c6d6985f 100644
--- a/src/widgets/accessible/rangecontrols.h
+++ b/src/widgets/accessible/rangecontrols_p.h
@@ -34,6 +34,17 @@
#ifndef RANGECONTROLS_H
#define RANGECONTROLS_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include <QtWidgets/qaccessiblewidget.h>
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/accessible/simplewidgets.cpp b/src/widgets/accessible/simplewidgets.cpp
index b08c21939a..065c618cf7 100644
--- a/src/widgets/accessible/simplewidgets.cpp
+++ b/src/widgets/accessible/simplewidgets.cpp
@@ -31,7 +31,7 @@
**
****************************************************************************/
-#include "simplewidgets.h"
+#include "simplewidgets_p.h"
#include <qabstractbutton.h>
#include <qcheckbox.h>
diff --git a/src/widgets/accessible/simplewidgets.h b/src/widgets/accessible/simplewidgets_p.h
index 0dfd9f79c8..c2e904273f 100644
--- a/src/widgets/accessible/simplewidgets.h
+++ b/src/widgets/accessible/simplewidgets_p.h
@@ -34,6 +34,17 @@
#ifndef SIMPLEWIDGETS_H
#define SIMPLEWIDGETS_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include <QtCore/qcoreapplication.h>
#include <QtWidgets/qaccessiblewidget.h>
diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp
index 2ebbaaee10..468bffe49e 100644
--- a/src/widgets/dialogs/qcolordialog.cpp
+++ b/src/widgets/dialogs/qcolordialog.cpp
@@ -2286,16 +2286,12 @@ bool QColorDialogPrivate::handleColorPickingMouseButtonRelease(QMouseEvent *e)
bool QColorDialogPrivate::handleColorPickingKeyPress(QKeyEvent *e)
{
Q_Q(QColorDialog);
- switch (e->key()) {
- case Qt::Key_Escape:
+ if (e->matches(QKeySequence::Cancel)) {
releaseColorPicking();
q->setCurrentColor(beforeScreenColorPicking);
- break;
- case Qt::Key_Return:
- case Qt::Key_Enter:
+ } else if (e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter) {
q->setCurrentColor(grabScreenColor(QCursor::pos()));
releaseColorPicking();
- break;
}
e->accept();
return true;
diff --git a/src/widgets/dialogs/qdialog.cpp b/src/widgets/dialogs/qdialog.cpp
index d04241fee0..5124960ab4 100644
--- a/src/widgets/dialogs/qdialog.cpp
+++ b/src/widgets/dialogs/qdialog.cpp
@@ -651,11 +651,9 @@ void QDialog::keyPressEvent(QKeyEvent *e)
// Calls reject() if Escape is pressed. Simulates a button
// click for the default button if Enter is pressed. Move focus
// for the arrow keys. Ignore the rest.
-#ifdef Q_OS_MAC
- if(e->modifiers() == Qt::ControlModifier && e->key() == Qt::Key_Period) {
+ if (e->matches(QKeySequence::Cancel)) {
reject();
} else
-#endif
if (!e->modifiers() || (e->modifiers() & Qt::KeypadModifier && e->key() == Qt::Key_Enter)) {
switch (e->key()) {
case Qt::Key_Enter:
@@ -671,9 +669,6 @@ void QDialog::keyPressEvent(QKeyEvent *e)
}
}
break;
- case Qt::Key_Escape:
- reject();
- break;
default:
e->ignore();
return;
diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp
index 81beccd5c8..443213d0de 100644
--- a/src/widgets/dialogs/qfiledialog.cpp
+++ b/src/widgets/dialogs/qfiledialog.cpp
@@ -2833,6 +2833,13 @@ void QFileDialogPrivate::createWidgets()
if (qFileDialogUi)
return;
Q_Q(QFileDialog);
+
+ // This function is sometimes called late (e.g as a fallback from setVisible). In that case we
+ // need to ensure that the following UI code (setupUI in particular) doesn't reset any explicitly
+ // set window state or geometry.
+ QSize preSize = q->testAttribute(Qt::WA_Resized) ? q->size() : QSize();
+ Qt::WindowStates preState = q->windowState();
+
model = new QFileSystemModel(q);
model->setFilter(options->filter());
model->setObjectName(QLatin1String("qt_filesystem_model"));
@@ -2878,6 +2885,9 @@ void QFileDialogPrivate::createWidgets()
completer = new QFSCompleter(model, q);
qFileDialogUi->fileNameEdit->setCompleter(completer);
#endif // QT_NO_FSCOMPLETER
+
+ qFileDialogUi->fileNameEdit->setInputMethodHints(Qt::ImhNoPredictiveText);
+
QObject::connect(qFileDialogUi->fileNameEdit, SIGNAL(textChanged(QString)),
q, SLOT(_q_autoCompleteFileName(QString)));
QObject::connect(qFileDialogUi->fileNameEdit, SIGNAL(textChanged(QString)),
@@ -2991,7 +3001,8 @@ void QFileDialogPrivate::createWidgets()
lineEdit()->selectAll();
_q_updateOkButton();
retranslateStrings();
- q->resize(q->sizeHint());
+ q->resize(preSize.isValid() ? preSize : q->sizeHint());
+ q->setWindowState(preState);
}
void QFileDialogPrivate::_q_showHeader(QAction *action)
@@ -3778,6 +3789,12 @@ void QFileDialogPrivate::_q_nativeEnterDirectory(const QUrl &directory)
bool QFileDialogPrivate::itemViewKeyboardEvent(QKeyEvent *event) {
Q_Q(QFileDialog);
+
+ if (event->matches(QKeySequence::Cancel)) {
+ q->hide();
+ return true;
+ }
+
switch (event->key()) {
case Qt::Key_Backspace:
_q_navigateToParent();
@@ -3793,9 +3810,6 @@ bool QFileDialogPrivate::itemViewKeyboardEvent(QKeyEvent *event) {
return true;
}
break;
- case Qt::Key_Escape:
- q->hide();
- return true;
default:
break;
}
@@ -3982,7 +3996,7 @@ void QFileDialogLineEdit::keyPressEvent(QKeyEvent *e)
int key = e->key();
QLineEdit::keyPressEvent(e);
- if (key != Qt::Key_Escape && key != Qt::Key_Back)
+ if (!e->matches(QKeySequence::Cancel) && key != Qt::Key_Back)
e->accept();
}
diff --git a/src/widgets/dialogs/qfilesystemmodel.cpp b/src/widgets/dialogs/qfilesystemmodel.cpp
index 52c06dbaba..00f466e227 100644
--- a/src/widgets/dialogs/qfilesystemmodel.cpp
+++ b/src/widgets/dialogs/qfilesystemmodel.cpp
@@ -387,7 +387,7 @@ QFileSystemModelPrivate::QFileSystemNode *QFileSystemModelPrivate::node(const QS
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
{
- if (!pathElements.at(0).contains(QLatin1String(":"))) {
+ if (!pathElements.at(0).contains(QLatin1Char(':'))) {
QString rootPath = QDir(longPath).rootPath();
pathElements.prepend(rootPath);
}
diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp
index 66e506bd80..4ad235051c 100644
--- a/src/widgets/dialogs/qmessagebox.cpp
+++ b/src/widgets/dialogs/qmessagebox.cpp
@@ -1448,11 +1448,8 @@ void QMessageBox::changeEvent(QEvent *ev)
void QMessageBox::keyPressEvent(QKeyEvent *e)
{
Q_D(QMessageBox);
- if (e->key() == Qt::Key_Escape
-#ifdef Q_OS_MAC
- || (e->modifiers() == Qt::ControlModifier && e->key() == Qt::Key_Period)
-#endif
- ) {
+
+ if (e->matches(QKeySequence::Cancel)) {
if (d->detectedEscapeButton) {
#ifdef Q_OS_MAC
d->detectedEscapeButton->animateClick();
diff --git a/src/widgets/dialogs/qprogressdialog.cpp b/src/widgets/dialogs/qprogressdialog.cpp
index 97e9267a9d..bbb251c8b2 100644
--- a/src/widgets/dialogs/qprogressdialog.cpp
+++ b/src/widgets/dialogs/qprogressdialog.cpp
@@ -411,7 +411,8 @@ void QProgressDialog::setCancelButton(QPushButton *cancelButton)
if (cancelButton) {
connect(d->cancel, SIGNAL(clicked()), this, SIGNAL(canceled()));
#ifndef QT_NO_SHORTCUT
- d->escapeShortcut = new QShortcut(Qt::Key_Escape, this, SIGNAL(canceled()));
+ // FIXME: This only registers the primary key sequence of the cancel action
+ d->escapeShortcut = new QShortcut(QKeySequence::Cancel, this, SIGNAL(canceled()));
#endif
} else {
#ifndef QT_NO_SHORTCUT
diff --git a/src/widgets/dialogs/qwizard.cpp b/src/widgets/dialogs/qwizard.cpp
index 8b9ea95cf3..b9906f13da 100644
--- a/src/widgets/dialogs/qwizard.cpp
+++ b/src/widgets/dialogs/qwizard.cpp
@@ -3662,7 +3662,7 @@ bool QWizardPage::validatePage()
from the rest of your implementation, whenever the value of isComplete()
changes. This ensures that QWizard updates the enabled or disabled state of
its buttons. An example of the reimplementation is
- available \l{http://doc.qt.digia.com/qq/qq22-qwizard.html#validatebeforeitstoolate}
+ available \l{http://doc.qt.io/archives/qq/qq22-qwizard.html#validatebeforeitstoolate}
{here}.
\sa completeChanged(), isFinalPage()
diff --git a/src/widgets/doc/images/filedialogurls.png b/src/widgets/doc/images/filedialogurls.png
index 7d22ef33ae..4e26bbfb6d 100644
--- a/src/widgets/doc/images/filedialogurls.png
+++ b/src/widgets/doc/images/filedialogurls.png
Binary files differ
diff --git a/src/widgets/doc/qtwidgets.qdocconf b/src/widgets/doc/qtwidgets.qdocconf
index 1f79d144bf..f307e9d3e4 100644
--- a/src/widgets/doc/qtwidgets.qdocconf
+++ b/src/widgets/doc/qtwidgets.qdocconf
@@ -26,7 +26,7 @@ qhp.QtWidgets.subprojects.classes.sortPages = true
tagfile = ../../../doc/qtwidgets/qtwidgets.tags
-depends += qtcore qtgui qtdoc qtsql qtdesigner qtquick
+depends += qtcore qtgui qtdoc qtsql qtdesigner qtquick qmake qtsvg
headerdirs += ..
diff --git a/src/widgets/doc/snippets/filedialogurls.cpp b/src/widgets/doc/snippets/filedialogurls.cpp
index 9e2862b56f..ea771c2050 100644
--- a/src/widgets/doc/snippets/filedialogurls.cpp
+++ b/src/widgets/doc/snippets/filedialogurls.cpp
@@ -46,8 +46,8 @@ int main(int argv, char **args)
//![0]
QList<QUrl> urls;
- urls << QUrl::fromLocalFile("/home/gvatteka/dev/qt-45")
- << QUrl::fromLocalFile(QDesktopServices::storageLocation(QDesktopServices::MusicLocation));
+ urls << QUrl::fromLocalFile("/Users/foo/Code/qt5")
+ << QUrl::fromLocalFile(QStandardPaths::standardLocations(QStandardPaths::MusicLocation).first());
QFileDialog dialog;
dialog.setSidebarUrls(urls);
diff --git a/src/widgets/doc/src/qtwidgets-examples.qdoc b/src/widgets/doc/src/qtwidgets-examples.qdoc
index 7b727183b8..9c0b29d687 100644
--- a/src/widgets/doc/src/qtwidgets-examples.qdoc
+++ b/src/widgets/doc/src/qtwidgets-examples.qdoc
@@ -127,7 +127,7 @@
/*!
\ingroup all-examples
- \target Graphicsview Examples
+ \keyword Graphicsview Examples
\title Graphics View Examples
\brief Using the Graphics View framework.
\page examples-graphicsview.html
diff --git a/src/widgets/doc/src/widgets-and-layouts/layout.qdoc b/src/widgets/doc/src/widgets-and-layouts/layout.qdoc
index 60281ce109..47c2a17e7e 100644
--- a/src/widgets/doc/src/widgets-and-layouts/layout.qdoc
+++ b/src/widgets/doc/src/widgets-and-layouts/layout.qdoc
@@ -249,7 +249,7 @@
For further guidance when implementing these functions, see the
\e{Qt Quarterly} article
- \l{http://doc.qt.digia.com/qq/qq04-height-for-width.html}
+ \l{http://doc.qt.io/archives/qq/qq04-height-for-width.html}
{Trading Height for Width}.
diff --git a/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc b/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc
index bea1a6e657..8f0f0f32c7 100644
--- a/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc
+++ b/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc
@@ -2995,7 +2995,7 @@
\li \b{Url} \target Url
\li \tt{url(\e{filename})}
\li \tt{\e{filename}} is the name of a file on the local disk
- or stored using \l{the Qt Resource System}. Setting an
+ or stored using \l{The Qt Resource System}. Setting an
image implicitly sets the width and height of the element.
\endtable
diff --git a/src/widgets/itemviews/qabstractitemdelegate.cpp b/src/widgets/itemviews/qabstractitemdelegate.cpp
index 6efe5ccb71..c2dd1ec8fd 100644
--- a/src/widgets/itemviews/qabstractitemdelegate.cpp
+++ b/src/widgets/itemviews/qabstractitemdelegate.cpp
@@ -455,6 +455,12 @@ bool QAbstractItemDelegatePrivate::editorEventFilter(QObject *object, QEvent *ev
if (editorHandlesKeyEvent(editor, keyEvent))
return false;
+ if (keyEvent->matches(QKeySequence::Cancel)) {
+ // don't commit data
+ emit q->closeEditor(editor, QAbstractItemDelegate::RevertModelCache);
+ return true;
+ }
+
switch (keyEvent->key()) {
case Qt::Key_Tab:
if (tryFixup(editor)) {
@@ -479,10 +485,6 @@ bool QAbstractItemDelegatePrivate::editorEventFilter(QObject *object, QEvent *ev
QMetaObject::invokeMethod(q, "_q_commitDataAndCloseEditor",
Qt::QueuedConnection, Q_ARG(QWidget*, editor));
return false;
- case Qt::Key_Escape:
- // don't commit data
- emit q->closeEditor(editor, QAbstractItemDelegate::RevertModelCache);
- return true;
default:
return false;
}
@@ -509,7 +511,7 @@ bool QAbstractItemDelegatePrivate::editorEventFilter(QObject *object, QEvent *ev
emit q->closeEditor(editor, QAbstractItemDelegate::NoHint);
}
} else if (event->type() == QEvent::ShortcutOverride) {
- if (static_cast<QKeyEvent*>(event)->key() == Qt::Key_Escape) {
+ if (static_cast<QKeyEvent*>(event)->matches(QKeySequence::Cancel)) {
event->accept();
return true;
}
diff --git a/src/widgets/itemviews/qlistview.cpp b/src/widgets/itemviews/qlistview.cpp
index 9b07564db9..9c79509874 100644
--- a/src/widgets/itemviews/qlistview.cpp
+++ b/src/widgets/itemviews/qlistview.cpp
@@ -1877,8 +1877,7 @@ void QCommonListViewBase::updateHorizontalScrollBar(const QSize &step)
const bool bothScrollBarsAuto = qq->verticalScrollBarPolicy() == Qt::ScrollBarAsNeeded &&
qq->horizontalScrollBarPolicy() == Qt::ScrollBarAsNeeded;
- const QSize viewportSize(viewport()->width() + (qq->verticalScrollBar()->maximum() > 0 ? qq->verticalScrollBar()->width() : 0),
- viewport()->height() + (qq->horizontalScrollBar()->maximum() > 0 ? qq->horizontalScrollBar()->height() : 0));
+ const QSize viewportSize = qq->contentsRect().size();
bool verticalWantsToShow = contentsSize.height() > viewportSize.height();
bool horizontalWantsToShow;
@@ -1908,8 +1907,7 @@ void QCommonListViewBase::updateVerticalScrollBar(const QSize &step)
const bool bothScrollBarsAuto = qq->verticalScrollBarPolicy() == Qt::ScrollBarAsNeeded &&
qq->horizontalScrollBarPolicy() == Qt::ScrollBarAsNeeded;
- const QSize viewportSize(viewport()->width() + (qq->verticalScrollBar()->maximum() > 0 ? qq->verticalScrollBar()->width() : 0),
- viewport()->height() + (qq->horizontalScrollBar()->maximum() > 0 ? qq->horizontalScrollBar()->height() : 0));
+ const QSize viewportSize = qq->contentsRect().size();
bool horizontalWantsToShow = contentsSize.width() > viewportSize.width();
bool verticalWantsToShow;
diff --git a/src/widgets/itemviews/qtableview.cpp b/src/widgets/itemviews/qtableview.cpp
index 3e3e3099c8..0af4a26494 100644
--- a/src/widgets/itemviews/qtableview.cpp
+++ b/src/widgets/itemviews/qtableview.cpp
@@ -190,7 +190,7 @@ QList<QSpanCollection::Span *> QSpanCollection::spansInRect(int x, int y, int w,
#ifdef DEBUG_SPAN_UPDATE
QDebug operator<<(QDebug str, const QSpanCollection::Span &span)
{
- str << "(" << span.top() << "," << span.left() << "," << span.bottom() << "," << span.right() << ")";
+ str << '(' << span.top() << ',' << span.left() << ',' << span.bottom() << ',' << span.right() << ')';
return str;
}
#endif
diff --git a/src/widgets/itemviews/qtablewidget.cpp b/src/widgets/itemviews/qtablewidget.cpp
index f0c7ac0d32..a10b95f701 100644
--- a/src/widgets/itemviews/qtablewidget.cpp
+++ b/src/widgets/itemviews/qtablewidget.cpp
@@ -555,9 +555,7 @@ void QTableModel::ensureSorted(int column, Qt::SortOrder order,
LessThan compare = (order == Qt::AscendingOrder ? &itemLessThan : &itemGreaterThan);
std::stable_sort(sorting.begin(), sorting.end(), compare);
-
- QModelIndexList oldPersistentIndexes = persistentIndexList();
- QModelIndexList newPersistentIndexes = oldPersistentIndexes;
+ QModelIndexList oldPersistentIndexes, newPersistentIndexes;
QVector<QTableWidgetItem*> newTable = tableItems;
QVector<QTableWidgetItem*> newVertical = verticalHeaderItems;
QVector<QTableWidgetItem*> colItems = columnItems(column);
@@ -573,7 +571,12 @@ void QTableModel::ensureSorted(int column, Qt::SortOrder order,
newRow = oldRow;
vit = colItems.insert(vit, item);
if (newRow != oldRow) {
- changed = true;
+ if (!changed) {
+ emit layoutAboutToBeChanged();
+ oldPersistentIndexes = persistentIndexList();
+ newPersistentIndexes = oldPersistentIndexes;
+ changed = true;
+ }
// move the items @ oldRow to newRow
int cc = columnCount();
QVector<QTableWidgetItem*> rowItems(cc);
@@ -600,7 +603,6 @@ void QTableModel::ensureSorted(int column, Qt::SortOrder order,
}
if (changed) {
- emit layoutAboutToBeChanged();
tableItems = newTable;
verticalHeaderItems = newVertical;
changePersistentIndexList(oldPersistentIndexes,
diff --git a/src/widgets/itemviews/qtreewidget.cpp b/src/widgets/itemviews/qtreewidget.cpp
index 5970e94292..db4451c99a 100644
--- a/src/widgets/itemviews/qtreewidget.cpp
+++ b/src/widgets/itemviews/qtreewidget.cpp
@@ -3386,7 +3386,7 @@ void QTreeWidget::dropEvent(QDropEvent *event) {
// Remove the items
QList<QTreeWidgetItem *> taken;
- for (int i = indexes.count() - 1; i >= 0; --i) {
+ for (int i = 0; i < indexes.count(); ++i) {
QTreeWidgetItem *parent = itemFromIndex(indexes.at(i));
if (!parent || !parent->parent()) {
taken.append(takeTopLevelItem(indexes.at(i).row()));
diff --git a/src/widgets/kernel/qgesturemanager.cpp b/src/widgets/kernel/qgesturemanager.cpp
index 8cb7c2b560..9a35308cad 100644
--- a/src/widgets/kernel/qgesturemanager.cpp
+++ b/src/widgets/kernel/qgesturemanager.cpp
@@ -405,6 +405,8 @@ void QGestureManager::cancelGesturesForChildren(QGesture *original)
Q_ASSERT(original);
QWidget *originatingWidget = m_gestureTargets.value(original);
Q_ASSERT(originatingWidget);
+ if (!originatingWidget)
+ return;
// iterate over all active gestures and all maybe gestures
// for each find the owner
@@ -565,7 +567,8 @@ void QGestureManager::getGestureTargets(const QSet<QGesture*> &gestures,
foreach (QGesture *gesture, gestures) {
QWidget *receiver = m_gestureTargets.value(gesture, 0);
Q_ASSERT(receiver);
- gestureByTypes[gesture->gestureType()].insert(receiver, gesture);
+ if (receiver)
+ gestureByTypes[gesture->gestureType()].insert(receiver, gesture);
}
// for each gesture type
diff --git a/src/widgets/kernel/qgesturemanager_p.h b/src/widgets/kernel/qgesturemanager_p.h
index 8ba253d17e..4e349ac731 100644
--- a/src/widgets/kernel/qgesturemanager_p.h
+++ b/src/widgets/kernel/qgesturemanager_p.h
@@ -117,7 +117,7 @@ private:
QHash<QGesture *, QGestureRecognizer *> m_gestureToRecognizer;
QHash<QGesture *, QObject *> m_gestureOwners;
- QHash<QGesture *, QWidget *> m_gestureTargets;
+ QHash<QGesture *, QPointer<QWidget> > m_gestureTargets;
int m_lastCustomGestureId;
diff --git a/src/widgets/kernel/qopenglwidget.cpp b/src/widgets/kernel/qopenglwidget.cpp
index 92f6066936..65a70ceb02 100644
--- a/src/widgets/kernel/qopenglwidget.cpp
+++ b/src/widgets/kernel/qopenglwidget.cpp
@@ -559,7 +559,8 @@ public:
flushPending(false),
paintDevice(0),
updateBehavior(QOpenGLWidget::NoPartialUpdate),
- requestedSamples(0)
+ requestedSamples(0),
+ inPaintGL(false)
{
requestedFormat = QSurfaceFormat::defaultFormat();
}
@@ -602,6 +603,7 @@ public:
QSurfaceFormat requestedFormat;
QOpenGLWidget::UpdateBehavior updateBehavior;
int requestedSamples;
+ bool inPaintGL;
};
void QOpenGLWidgetPaintDevicePrivate::beginPaint()
@@ -823,7 +825,9 @@ void QOpenGLWidgetPrivate::invokeUserPaint()
QOpenGLContextPrivate::get(ctx)->defaultFboRedirect = fbo->handle();
f->glViewport(0, 0, q->width() * q->devicePixelRatioF(), q->height() * q->devicePixelRatioF());
+ inPaintGL = true;
q->paintGL();
+ inPaintGL = false;
flushPending = true;
QOpenGLContextPrivate::get(ctx)->defaultFboRedirect = 0;
@@ -870,12 +874,25 @@ QImage QOpenGLWidgetPrivate::grabFramebuffer()
if (!initialized)
return QImage();
- render();
- resolveSamples();
- q->makeCurrent();
+ if (!inPaintGL)
+ render();
+
+ if (resolvedFbo) {
+ resolveSamples();
+ resolvedFbo->bind();
+ } else {
+ q->makeCurrent();
+ }
+
QImage res = qt_gl_read_framebuffer(q->size() * q->devicePixelRatioF(), false, false);
res.setDevicePixelRatio(q->devicePixelRatioF());
+ // While we give no guarantees of what is going to be left bound, prefer the
+ // multisample fbo instead of the resolved one. Clients may continue to
+ // render straight after calling this function.
+ if (resolvedFbo)
+ q->makeCurrent();
+
return res;
}
diff --git a/src/widgets/kernel/qwhatsthis.cpp b/src/widgets/kernel/qwhatsthis.cpp
index 1e437c4fb7..81de2f25ca 100644
--- a/src/widgets/kernel/qwhatsthis.cpp
+++ b/src/widgets/kernel/qwhatsthis.cpp
@@ -459,7 +459,7 @@ bool QWhatsThisPrivate::eventFilter(QObject *o, QEvent *e)
{
QKeyEvent* kev = (QKeyEvent*)e;
- if (kev->key() == Qt::Key_Escape) {
+ if (kev->matches(QKeySequence::Cancel)) {
QWhatsThis::leaveWhatsThisMode();
return true;
} else if (customWhatsThis) {
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index ae674534e3..a4335e1f2d 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -5842,7 +5842,10 @@ QPixmap QWidgetEffectSourcePrivate::pixmap(Qt::CoordinateSystem system, QPoint *
pixmapOffset -= effectRect.topLeft();
- QPixmap pixmap(effectRect.size());
+ const qreal dpr = context->painter->device()->devicePixelRatio();
+ QPixmap pixmap(effectRect.size() * dpr);
+ pixmap.setDevicePixelRatio(dpr);
+
pixmap.fill(Qt::transparent);
m_widget->render(&pixmap, pixmapOffset, QRegion(), QWidget::DrawChildren);
return pixmap;
@@ -9362,7 +9365,8 @@ void QWidget::tabletEvent(QTabletEvent *event)
call the base class implementation if you do not act upon the key.
The default implementation closes popup widgets if the user
- presses Esc. Otherwise the event is ignored, so that the widget's
+ presses the key sequence for QKeySequence::Cancel (typically the
+ Escape key). Otherwise the event is ignored, so that the widget's
parent can interpret it.
Note that QKeyEvent starts with isAccepted() == true, so you do not
@@ -9375,7 +9379,7 @@ void QWidget::tabletEvent(QTabletEvent *event)
void QWidget::keyPressEvent(QKeyEvent *event)
{
- if ((windowType() == Qt::Popup) && event->key() == Qt::Key_Escape) {
+ if ((windowType() == Qt::Popup) && event->matches(QKeySequence::Cancel)) {
event->accept();
close();
} else {
diff --git a/src/widgets/kernel/qwidgetsvariant.cpp b/src/widgets/kernel/qwidgetsvariant.cpp
index b0dcc4aa1b..fc02c9c77d 100644
--- a/src/widgets/kernel/qwidgetsvariant.cpp
+++ b/src/widgets/kernel/qwidgetsvariant.cpp
@@ -109,7 +109,7 @@ static void streamDebug(QDebug dbg, const QVariant &v)
dbg.nospace() << *v_cast<QSizePolicy>(d);
break;
default:
- dbg.nospace() << "QMetaType::Type(" << d->type << ")";
+ dbg.nospace() << "QMetaType::Type(" << d->type << ')';
}
}
#endif
diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm
index 711a30e1fc..b5e3596de9 100644
--- a/src/widgets/styles/qmacstyle_mac.mm
+++ b/src/widgets/styles/qmacstyle_mac.mm
@@ -1878,7 +1878,7 @@ NSView *QMacStylePrivate::cocoaControl(QCocoaWidget widget) const
if ([bv isKindOfClass:[NSButton class]]) {
NSButton *bc = (NSButton *)bv;
- bc.title = nil;
+ bc.title = @"";
}
if ([bv isKindOfClass:[NSControl class]]) {
diff --git a/src/widgets/util/qcompleter.cpp b/src/widgets/util/qcompleter.cpp
index fedc928f61..559f024e5f 100644
--- a/src/widgets/util/qcompleter.cpp
+++ b/src/widgets/util/qcompleter.cpp
@@ -1337,6 +1337,11 @@ bool QCompleter::eventFilter(QObject *o, QEvent *e)
}
// default implementation for keys not handled by the widget when popup is open
+ if (ke->matches(QKeySequence::Cancel)) {
+ d->popup->hide();
+ return true;
+ }
+
switch (key) {
#ifdef QT_KEYPAD_NAVIGATION
case Qt::Key_Select:
@@ -1357,7 +1362,6 @@ bool QCompleter::eventFilter(QObject *o, QEvent *e)
break;
case Qt::Key_Backtab:
- case Qt::Key_Escape:
d->popup->hide();
break;
diff --git a/src/widgets/util/qscroller.cpp b/src/widgets/util/qscroller.cpp
index de12983f21..563c501356 100644
--- a/src/widgets/util/qscroller.cpp
+++ b/src/widgets/util/qscroller.cpp
@@ -976,7 +976,7 @@ bool QScroller::handleInput(Input input, const QPointF &position, qint64 timesta
{
Q_D(QScroller);
- qScrollerDebug() << "QScroller::handleInput(" << input << ", " << d->stateName(d->state) << ", " << position << ", " << timestamp << ")";
+ qScrollerDebug() << "QScroller::handleInput(" << input << ", " << d->stateName(d->state) << ", " << position << ", " << timestamp << ')';
struct statechange {
State state;
Input input;
@@ -1296,7 +1296,7 @@ void QScrollerPrivate::createScrollingSegments(qreal v, qreal startPos,
qreal lowerSnapPos = nextSnapPos(startPos, -1, orientation);
qreal higherSnapPos = nextSnapPos(startPos, 1, orientation);
- qScrollerDebug() << " Real Delta:" << lowerSnapPos <<"-"<<nextSnap <<"-"<<higherSnapPos;
+ qScrollerDebug() << " Real Delta:" << lowerSnapPos << '-' << nextSnap << '-' <<higherSnapPos;
// - check if we can reach another snap point
if (nextSnap > higherSnapPos || qIsNaN(higherSnapPos))
@@ -1703,7 +1703,7 @@ void QScrollerPrivate::setState(QScroller::State newstate)
if (state == newstate)
return;
- qScrollerDebug() << q << "QScroller::setState(" << stateName(newstate) << ")";
+ qScrollerDebug() << q << "QScroller::setState(" << stateName(newstate) << ')';
switch (newstate) {
case QScroller::Inactive:
diff --git a/src/widgets/util/qsystemtrayicon.cpp b/src/widgets/util/qsystemtrayicon.cpp
index 358e4c38d6..d22791048f 100644
--- a/src/widgets/util/qsystemtrayicon.cpp
+++ b/src/widgets/util/qsystemtrayicon.cpp
@@ -74,7 +74,7 @@ QT_BEGIN_NAMESPACE
\l{http://standards.freedesktop.org/systemtray-spec/systemtray-spec-0.2.html freedesktop.org}
XEmbed system tray specification.
\li All X11 desktop environments that implement the D-Bus
- \l{http://www.freedesktop.org/wiki/Specifications/StatusNotifierItem/ StatusNotifierItem}
+ \l{http://www.freedesktop.org/wiki/Specifications/StatusNotifierItem/StatusNotifierItem}
specification, including recent versions of KDE and Unity.
\li All supported versions of OS X. Note that the Growl
notification system must be installed for
diff --git a/src/widgets/widgets/qabstractbutton.cpp b/src/widgets/widgets/qabstractbutton.cpp
index 292bbc3325..a1707b9cab 100644
--- a/src/widgets/widgets/qabstractbutton.cpp
+++ b/src/widgets/widgets/qabstractbutton.cpp
@@ -1221,16 +1221,14 @@ void QAbstractButton::keyPressEvent(QKeyEvent *e)
}
break;
}
- case Qt::Key_Escape:
- if (d->down) {
+ default:
+ if (e->matches(QKeySequence::Cancel) && d->down) {
setDown(false);
repaint(); //flush paint event before invoking potentially expensive operation
QApplication::flush();
d->emitReleased();
- break;
+ return;
}
- // fall through
- default:
e->ignore();
}
}
diff --git a/src/widgets/widgets/qcalendarwidget.cpp b/src/widgets/widgets/qcalendarwidget.cpp
index 2150fc7a50..48b224fe13 100644
--- a/src/widgets/widgets/qcalendarwidget.cpp
+++ b/src/widgets/widgets/qcalendarwidget.cpp
@@ -776,7 +776,7 @@ bool QCalendarTextNavigator::eventFilter(QObject *o, QEvent *e)
applyDate();
emit editingFinished();
removeDateLabel();
- } else if (ke->key() == Qt::Key_Escape) {
+ } else if (ke->matches(QKeySequence::Cancel)) {
removeDateLabel();
} else if (e->type() == QEvent::KeyPress) {
createDateLabel();
@@ -3078,8 +3078,7 @@ void QCalendarWidget::resizeEvent(QResizeEvent * event)
void QCalendarWidget::keyPressEvent(QKeyEvent * event)
{
Q_D(QCalendarWidget);
- if(d->yearEdit->isVisible()&& event->key() == Qt::Key_Escape)
- {
+ if (d->yearEdit->isVisible()&& event->matches(QKeySequence::Cancel)) {
d->yearEdit->setValue(yearShown());
d->_q_yearEditingFinished();
return;
diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp
index 261a6ec2de..2a1742b652 100644
--- a/src/widgets/widgets/qcombobox.cpp
+++ b/src/widgets/widgets/qcombobox.cpp
@@ -654,8 +654,9 @@ void QComboBoxPrivateContainer::changeEvent(QEvent *e)
bool QComboBoxPrivateContainer::eventFilter(QObject *o, QEvent *e)
{
switch (e->type()) {
- case QEvent::ShortcutOverride:
- switch (static_cast<QKeyEvent*>(e)->key()) {
+ case QEvent::ShortcutOverride: {
+ QKeyEvent *keyEvent = static_cast<QKeyEvent*>(e);
+ switch (keyEvent->key()) {
case Qt::Key_Enter:
case Qt::Key_Return:
#ifdef QT_KEYPAD_NAVIGATION
@@ -667,17 +668,21 @@ bool QComboBoxPrivateContainer::eventFilter(QObject *o, QEvent *e)
}
return true;
case Qt::Key_Down:
- if (!(static_cast<QKeyEvent*>(e)->modifiers() & Qt::AltModifier))
+ if (!(keyEvent->modifiers() & Qt::AltModifier))
break;
// fall through
case Qt::Key_F4:
- case Qt::Key_Escape:
combo->hidePopup();
return true;
default:
+ if (keyEvent->matches(QKeySequence::Cancel)) {
+ combo->hidePopup();
+ return true;
+ }
break;
}
- break;
+ break;
+ }
case QEvent::MouseMove:
if (isVisible()) {
QMouseEvent *m = static_cast<QMouseEvent *>(e);
diff --git a/src/widgets/widgets/qdatetimeedit.cpp b/src/widgets/widgets/qdatetimeedit.cpp
index a8da78a025..42987df3ec 100644
--- a/src/widgets/widgets/qdatetimeedit.cpp
+++ b/src/widgets/widgets/qdatetimeedit.cpp
@@ -2655,7 +2655,7 @@ bool QCalendarPopup::event(QEvent *event)
{
if (event->type() == QEvent::KeyPress) {
QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
- if (keyEvent->key()== Qt::Key_Escape)
+ if (keyEvent->matches(QKeySequence::Cancel))
dateChanged = false;
}
return QWidget::event(event);
diff --git a/src/widgets/widgets/qeffects.cpp b/src/widgets/widgets/qeffects.cpp
index 708e90cc32..b256861d08 100644
--- a/src/widgets/widgets/qeffects.cpp
+++ b/src/widgets/widgets/qeffects.cpp
@@ -197,7 +197,7 @@ bool QAlphaWidget::eventFilter(QObject *o, QEvent *e)
break;
case QEvent::KeyPress: {
QKeyEvent *ke = (QKeyEvent*)e;
- if (ke->key() == Qt::Key_Escape) {
+ if (ke->matches(QKeySequence::Cancel)) {
showWidget = false;
} else {
duration = 0;
diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp
index 0556c02b64..6e37f91197 100644
--- a/src/widgets/widgets/qmenu.cpp
+++ b/src/widgets/widgets/qmenu.cpp
@@ -2679,7 +2679,7 @@ QMenu::event(QEvent *e)
if (kev->key() == Qt::Key_Up || kev->key() == Qt::Key_Down
|| kev->key() == Qt::Key_Left || kev->key() == Qt::Key_Right
|| kev->key() == Qt::Key_Enter || kev->key() == Qt::Key_Return
- || kev->key() == Qt::Key_Escape) {
+ || kev->matches(QKeySequence::Cancel)) {
e->accept();
return true;
}
@@ -2965,27 +2965,6 @@ void QMenu::keyPressEvent(QKeyEvent *e)
}
break;
- case Qt::Key_Escape:
-#ifdef QT_KEYPAD_NAVIGATION
- case Qt::Key_Back:
-#endif
- key_consumed = true;
- if (d->tornoff) {
- close();
- return;
- }
- {
- QPointer<QWidget> caused = d->causedPopup.widget;
- d->hideMenu(this); // hide after getting causedPopup
-#ifndef QT_NO_MENUBAR
- if (QMenuBar *mb = qobject_cast<QMenuBar*>(caused)) {
- mb->d_func()->setCurrentAction(d->menuAction);
- mb->d_func()->setKeyboardMode(true);
- }
-#endif
- }
- break;
-
case Qt::Key_Space:
if (!style()->styleHint(QStyle::SH_Menu_SpaceActivatesItem, 0, this))
break;
@@ -3022,6 +3001,28 @@ void QMenu::keyPressEvent(QKeyEvent *e)
key_consumed = false;
}
+ if (!key_consumed && (e->matches(QKeySequence::Cancel)
+#ifdef QT_KEYPAD_NAVIGATION
+ || e->key() == Qt::Key_Back
+#endif
+ )) {
+ key_consumed = true;
+ if (d->tornoff) {
+ close();
+ return;
+ }
+ {
+ QPointer<QWidget> caused = d->causedPopup.widget;
+ d->hideMenu(this); // hide after getting causedPopup
+#ifndef QT_NO_MENUBAR
+ if (QMenuBar *mb = qobject_cast<QMenuBar*>(caused)) {
+ mb->d_func()->setCurrentAction(d->menuAction);
+ mb->d_func()->setKeyboardMode(true);
+ }
+#endif
+ }
+ }
+
if (!key_consumed) { // send to menu bar
if ((!e->modifiers() || e->modifiers() == Qt::AltModifier || e->modifiers() == Qt::ShiftModifier) &&
e->text().length()==1) {
diff --git a/src/widgets/widgets/qmenubar.cpp b/src/widgets/widgets/qmenubar.cpp
index d382131075..2e48607f82 100644
--- a/src/widgets/widgets/qmenubar.cpp
+++ b/src/widgets/widgets/qmenubar.cpp
@@ -1122,14 +1122,14 @@ void QMenuBar::keyPressEvent(QKeyEvent *e)
}
break; }
- case Qt::Key_Escape:
+ default:
+ key_consumed = false;
+ }
+
+ if (!key_consumed && e->matches(QKeySequence::Cancel)) {
d->setCurrentAction(0);
d->setKeyboardMode(false);
key_consumed = true;
- break;
-
- default:
- key_consumed = false;
}
if(!key_consumed &&
@@ -1432,7 +1432,7 @@ bool QMenuBar::event(QEvent *e)
case QEvent::ShortcutOverride: {
QKeyEvent *kev = static_cast<QKeyEvent*>(e);
//we only filter out escape if there is a current action
- if (kev->key() == Qt::Key_Escape && d->currentAction) {
+ if (kev->matches(QKeySequence::Cancel) && d->currentAction) {
e->accept();
return true;
}
diff --git a/src/xml/doc/qtxml.qdocconf b/src/xml/doc/qtxml.qdocconf
index 419859ac8b..a23915487f 100644
--- a/src/xml/doc/qtxml.qdocconf
+++ b/src/xml/doc/qtxml.qdocconf
@@ -26,7 +26,7 @@ qhp.QtXml.subprojects.classes.sortPages = true
tagfile = ../../../doc/qtxml/qtxml.tags
-depends += qtcore qtnetwork qtdoc qtwidgets
+depends += qtcore qtnetwork qtdoc qtwidgets qmake
headerdirs += ..
diff --git a/src/xml/doc/snippets/rsslisting/handler.cpp b/src/xml/doc/snippets/rsslisting/handler.cpp
index 4825cf2f62..27e4a23fb4 100644
--- a/src/xml/doc/snippets/rsslisting/handler.cpp
+++ b/src/xml/doc/snippets/rsslisting/handler.cpp
@@ -174,7 +174,7 @@ bool Handler::characters (const QString &chars)
bool Handler::fatalError (const QXmlParseException & exception)
{
qWarning() << "Fatal error on line" << exception.lineNumber()
- << ", column" << exception.columnNumber() << ":"
+ << ", column" << exception.columnNumber() << ':'
<< exception.message();
return false;
diff --git a/src/xml/doc/snippets/simpleparse/main.cpp b/src/xml/doc/snippets/simpleparse/main.cpp
index 480dc1c528..cbb8ac96aa 100644
--- a/src/xml/doc/snippets/simpleparse/main.cpp
+++ b/src/xml/doc/snippets/simpleparse/main.cpp
@@ -78,7 +78,7 @@ int main(int argc, char **argv)
for (int i = 0; i < items; ++i) {
for (int j = 0; j < indentations[i]; ++j)
- std::cout << " ";
+ std::cout << ' ';
std::cout << names[i].toLocal8Bit().constData() << std::endl;
}
}
diff --git a/src/xml/sax/qxml.cpp b/src/xml/sax/qxml.cpp
index 8e382f76f6..97a3b070d8 100644
--- a/src/xml/sax/qxml.cpp
+++ b/src/xml/sax/qxml.cpp
@@ -6457,7 +6457,7 @@ bool QXmlSimpleReaderPrivate::isExpandedEntityValueTooLarge(QString *errorMessag
if (*expandedIt > entityCharacterLimit) {
if (errorMessage) {
*errorMessage = QString::fromLatin1("The XML entity \"%1\" expands to a string that is too large to process (%2 characters > %3).")
- .arg(entity, *expandedIt, entityCharacterLimit);
+ .arg(entity, QString::number(*expandedIt), QString::number(entityCharacterLimit));
}
return true;
}
diff --git a/tests/auto/corelib/global/qnumeric/tst_qnumeric.cpp b/tests/auto/corelib/global/qnumeric/tst_qnumeric.cpp
index 59a536ed25..6be8ff81cf 100644
--- a/tests/auto/corelib/global/qnumeric/tst_qnumeric.cpp
+++ b/tests/auto/corelib/global/qnumeric/tst_qnumeric.cpp
@@ -225,8 +225,8 @@ void tst_QNumeric::addOverflow_data()
// to QTest::toString and QTest::qCompare will remain.
template <typename Int> static void addOverflow_template()
{
-#if defined(Q_CC_MSVC) && Q_CC_MSVC < 1900
- QSKIP("Test disabled, this test generates an Internal Compiler Error compiling");
+#if defined(Q_CC_MSVC) && Q_CC_MSVC < 2000
+ QSKIP("Test disabled, this test generates an Internal Compiler Error compiling in release mode");
#else
const Int max = std::numeric_limits<Int>::max();
Int r;
diff --git a/tests/auto/corelib/io/qdir/tst_qdir.cpp b/tests/auto/corelib/io/qdir/tst_qdir.cpp
index 8a1777d7fd..2106a1cea8 100644
--- a/tests/auto/corelib/io/qdir/tst_qdir.cpp
+++ b/tests/auto/corelib/io/qdir/tst_qdir.cpp
@@ -68,6 +68,12 @@ QT_END_NAMESPACE
#endif
+static QByteArray msgDoesNotExist(const QString &name)
+{
+ return (QLatin1Char('"') + QDir::toNativeSeparators(name)
+ + QLatin1String("\" does not exist.")).toLocal8Bit();
+}
+
class tst_QDir : public QObject
{
Q_OBJECT
@@ -354,7 +360,7 @@ void tst_QDir::mkdir()
//make sure it really exists (ie that mkdir returns the right value)
QFileInfo fi(path);
- QVERIFY(fi.exists() && fi.isDir());
+ QVERIFY2(fi.exists() && fi.isDir(), msgDoesNotExist(path).constData());
}
void tst_QDir::makedirReturnCode()
@@ -378,7 +384,7 @@ void tst_QDir::makedirReturnCode()
f.open(QIODevice::WriteOnly);
f.write("test");
f.close();
- QVERIFY(f.exists());
+ QVERIFY2(f.exists(), msgDoesNotExist(f.fileName()).constData());
QVERIFY(!QDir::current().mkdir(dirName)); // calling mkdir on an existing file will fail.
QVERIFY(!QDir::current().mkpath(dirName)); // calling mkpath on an existing file will fail.
f.remove();
@@ -474,7 +480,7 @@ void tst_QDir::removeRecursivelyFailure()
QVERIFY(!QDir().rmdir(path));
QDir dir(path);
QVERIFY(!dir.removeRecursively()); // didn't work
- QVERIFY(dir.exists()); // still exists
+ QVERIFY2(dir.exists(), msgDoesNotExist(dir.absolutePath()).constData()); // still exists
QVERIFY(dirAsFile.setPermissions(QFile::Permissions(QFile::ReadOwner | QFile::WriteOwner | QFile::ExeOwner)));
QVERIFY(dir.removeRecursively());
@@ -527,14 +533,15 @@ void tst_QDir::exists_data()
QTest::newRow("simple dir") << (m_dataPath + "/resources") << true;
QTest::newRow("simple dir with slash") << (m_dataPath + "/resources/") << true;
#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE))
- QTest::newRow("unc 1") << "//" + QtNetworkSettings::winServerName() << true;
- QTest::newRow("unc 2") << "//" + QtNetworkSettings::winServerName() + "/" << true;
- QTest::newRow("unc 3") << "//" + QtNetworkSettings::winServerName() + "/testshare" << true;
- QTest::newRow("unc 4") << "//" + QtNetworkSettings::winServerName() + "/testshare/" << true;
- QTest::newRow("unc 5") << "//" + QtNetworkSettings::winServerName() + "/testshare/tmp" << true;
- QTest::newRow("unc 6") << "//" + QtNetworkSettings::winServerName() + "/testshare/tmp/" << true;
- QTest::newRow("unc 7") << "//" + QtNetworkSettings::winServerName() + "/testshare/adirthatshouldnotexist" << false;
- QTest::newRow("unc 8") << "//" + QtNetworkSettings::winServerName() + "/asharethatshouldnotexist" << false;
+ const QString uncRoot = QStringLiteral("//") + QtNetworkSettings::winServerName();
+ QTest::newRow("unc 1") << uncRoot << true;
+ QTest::newRow("unc 2") << uncRoot + QLatin1Char('/') << true;
+ QTest::newRow("unc 3") << uncRoot + "/testshare" << true;
+ QTest::newRow("unc 4") << uncRoot + "/testshare/" << true;
+ QTest::newRow("unc 5") << uncRoot + "/testshare/tmp" << true;
+ QTest::newRow("unc 6") << uncRoot + "/testshare/tmp/" << true;
+ QTest::newRow("unc 7") << uncRoot + "/testshare/adirthatshouldnotexist" << false;
+ QTest::newRow("unc 8") << uncRoot + "/asharethatshouldnotexist" << false;
QTest::newRow("unc 9") << "//ahostthatshouldnotexist" << false;
#endif
#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE))
@@ -566,7 +573,10 @@ void tst_QDir::exists()
QFETCH(bool, expected);
QDir dir(path);
- QCOMPARE(dir.exists(), expected);
+ if (expected)
+ QVERIFY2(dir.exists(), msgDoesNotExist(path).constData());
+ else
+ QVERIFY(!dir.exists());
}
void tst_QDir::isRelativePath_data()
@@ -802,7 +812,7 @@ void tst_QDir::entryList()
#endif //Q_NO_SYMLINKS
QDir dir(dirName);
- QVERIFY(dir.exists());
+ QVERIFY2(dir.exists(), msgDoesNotExist(dirName).constData());
QStringList actual = dir.entryList(nameFilters, (QDir::Filters)filterspec,
(QDir::SortFlags)sortspec);
@@ -845,8 +855,8 @@ void tst_QDir::entryListTimedSort()
QTemporaryFile aFile(entrylistPath + "A-XXXXXX.qws");
QTemporaryFile bFile(entrylistPath + "B-XXXXXX.qws");
- QVERIFY(aFile.open());
- QVERIFY(bFile.open());
+ QVERIFY2(aFile.open(), qPrintable(aFile.errorString()));
+ QVERIFY2(bFile.open(), qPrintable(bFile.errorString()));
{
QProcess p;
p.start(touchBinary, QStringList() << "-t" << "201306021513" << aFile.fileName());
@@ -888,18 +898,25 @@ void tst_QDir::entryListSimple_data()
#endif
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
- QTest::newRow("unc 1") << "//" + QtNetworkSettings::winServerName() << 2;
- QTest::newRow("unc 2") << "//" + QtNetworkSettings::winServerName() + "/" << 2;
- QTest::newRow("unc 3") << "//" + QtNetworkSettings::winServerName() + "/testshare" << 2;
- QTest::newRow("unc 4") << "//" + QtNetworkSettings::winServerName() + "/testshare/" << 2;
- QTest::newRow("unc 5") << "//" + QtNetworkSettings::winServerName() + "/testshare/tmp" << 2;
- QTest::newRow("unc 6") << "//" + QtNetworkSettings::winServerName() + "/testshare/tmp/" << 2;
- QTest::newRow("unc 7") << "//" + QtNetworkSettings::winServerName() + "/testshare/adirthatshouldnotexist" << 0;
- QTest::newRow("unc 8") << "//" + QtNetworkSettings::winServerName() + "/asharethatshouldnotexist" << 0;
+ const QString uncRoot = QStringLiteral("//") + QtNetworkSettings::winServerName();
+ QTest::newRow("unc 1") << uncRoot << 2;
+ QTest::newRow("unc 2") << uncRoot + QLatin1Char('/') << 2;
+ QTest::newRow("unc 3") << uncRoot + "/testshare" << 2;
+ QTest::newRow("unc 4") << uncRoot + "/testshare/" << 2;
+ QTest::newRow("unc 5") << uncRoot + "/testshare/tmp" << 2;
+ QTest::newRow("unc 6") << uncRoot + "/testshare/tmp/" << 2;
+ QTest::newRow("unc 7") << uncRoot + "/testshare/adirthatshouldnotexist" << 0;
+ QTest::newRow("unc 8") << uncRoot + "/asharethatshouldnotexist" << 0;
QTest::newRow("unc 9") << "//ahostthatshouldnotexist" << 0;
#endif
}
+static QByteArray msgEntryListFailed(int actual, int expectedMin, const QString &name)
+{
+ return QByteArray::number(actual) + " < " + QByteArray::number(expectedMin) + " in \""
+ + QFile::encodeName(QDir::toNativeSeparators(name)) + '"';
+}
+
void tst_QDir::entryListSimple()
{
QFETCH(QString, dirName);
@@ -907,7 +924,7 @@ void tst_QDir::entryListSimple()
QDir dir(dirName);
QStringList actual = dir.entryList();
- QVERIFY(actual.count() >= countMin);
+ QVERIFY2(actual.count() >= countMin, msgEntryListFailed(actual.count(), countMin, dirName).constData());
}
void tst_QDir::entryListWithSymLinks()
@@ -1121,7 +1138,7 @@ void tst_QDir::setNameFilters()
QFETCH(QStringList, expected);
QDir dir(dirName);
- QVERIFY(dir.exists());
+ QVERIFY2(dir.exists(), msgDoesNotExist(dirName).constData());
dir.setNameFilters(nameFilters);
QStringList actual = dir.entryList();
@@ -1504,7 +1521,7 @@ void tst_QDir::exists2()
QDir dir;
if (exists)
- QVERIFY(dir.exists(path));
+ QVERIFY2(dir.exists(path), msgDoesNotExist(path).constData());
else
QVERIFY(!dir.exists(path));
diff --git a/tests/auto/corelib/io/qfile/BLACKLIST b/tests/auto/corelib/io/qfile/BLACKLIST
new file mode 100644
index 0000000000..7aac313b12
--- /dev/null
+++ b/tests/auto/corelib/io/qfile/BLACKLIST
@@ -0,0 +1,5 @@
+# QTBUG-48455
+[readLineStdin]
+msvc-2015
+[readLineStdin_lineByLine]
+msvc-2015
diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp
index c1aed842cf..b4140e1115 100644
--- a/tests/auto/corelib/io/qfile/tst_qfile.cpp
+++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp
@@ -390,9 +390,30 @@ tst_QFile::tst_QFile() : m_oldDir(QDir::currentPath())
{
}
+static QByteArray msgOpenFailed(QIODevice::OpenMode om, const QFile &file)
+{
+ QString result;
+ QDebug(&result).noquote().nospace() << "Could not open \""
+ << QDir::toNativeSeparators(file.fileName()) << "\" using "
+ << om << ": " << file.errorString();
+ return result.toLocal8Bit();
+}
+
+static QByteArray msgOpenFailed(const QFile &file)
+{
+ return (QLatin1String("Could not open \"") + QDir::toNativeSeparators(file.fileName())
+ + QLatin1String("\": ") + file.errorString()).toLocal8Bit();
+}
+
+static QByteArray msgFileDoesNotExist(const QString &name)
+{
+ return (QLatin1Char('"') + QDir::toNativeSeparators(name)
+ + QLatin1String("\" does not exist.")).toLocal8Bit();
+}
+
void tst_QFile::initTestCase()
{
- QVERIFY(m_temporaryDir.isValid());
+ QVERIFY2(m_temporaryDir.isValid(), qPrintable(m_temporaryDir.errorString()));
m_stdinProcessDir = QFINDTESTDATA("stdinprocess");
QVERIFY(!m_stdinProcessDir.isEmpty());
m_testSourceFile = QFINDTESTDATA("tst_qfile.cpp");
@@ -418,19 +439,19 @@ void tst_QFile::initTestCase()
// create a file and make it read-only
QFile file(QString::fromLatin1(readOnlyFile));
- QVERIFY2(file.open(QFile::WriteOnly), qPrintable(file.errorString()));
+ QVERIFY2(file.open(QFile::WriteOnly), msgOpenFailed(file).constData());
file.write("a", 1);
file.close();
QVERIFY2(file.setPermissions(QFile::ReadOwner), qPrintable(file.errorString()));
// create another file and make it not readable
file.setFileName(QString::fromLatin1(noReadFile));
- QVERIFY2(file.open(QFile::WriteOnly), qPrintable(file.errorString()));
+ QVERIFY2(file.open(QFile::WriteOnly), msgOpenFailed(file).constData());
file.write("b", 1);
file.close();
#ifndef Q_OS_WIN // Not supported on Windows.
QVERIFY2(file.setPermissions(0), qPrintable(file.errorString()));
#else
- QVERIFY2(file.open(QFile::WriteOnly), qPrintable(file.errorString()));
+ QVERIFY2(file.open(QFile::WriteOnly), msgOpenFailed(file).constData());
#endif
}
@@ -455,19 +476,19 @@ void tst_QFile::cleanupTestCase()
void tst_QFile::exists()
{
QFile f( m_testFile );
- QVERIFY(f.exists());
+ QVERIFY2(f.exists(), msgFileDoesNotExist(m_testFile));
QFile file("nobodyhassuchafile");
file.remove();
QVERIFY(!file.exists());
QFile file2("nobodyhassuchafile");
- QVERIFY(file2.open(QIODevice::WriteOnly));
+ QVERIFY2(file2.open(QIODevice::WriteOnly), msgOpenFailed(file2).constData());
file2.close();
QVERIFY(file.exists());
- QVERIFY(file.open(QIODevice::WriteOnly));
+ QVERIFY2(file.open(QIODevice::WriteOnly), msgOpenFailed(file).constData());
file.close();
QVERIFY(file.exists());
@@ -475,8 +496,9 @@ void tst_QFile::exists()
QVERIFY(!file.exists());
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
- QFile unc("//" + QtNetworkSettings::winServerName() + "/testshare/readme.txt");
- QVERIFY(unc.exists());
+ const QString uncPath = "//" + QtNetworkSettings::winServerName() + "/testshare/readme.txt";
+ QFile unc(uncPath);
+ QVERIFY2(unc.exists(), msgFileDoesNotExist(uncPath).constData());
#endif
}
@@ -558,7 +580,12 @@ void tst_QFile::open()
if (filename.isEmpty())
QTest::ignoreMessage(QtWarningMsg, "QFSFileEngine::open: No file name specified");
- QCOMPARE(f.open( QIODevice::OpenMode(mode) ), ok);
+ const QIODevice::OpenMode om(mode);
+ const bool succeeded = f.open(om);
+ if (ok)
+ QVERIFY2(succeeded, msgOpenFailed(om, f).constData());
+ else
+ QVERIFY(!succeeded);
QTEST( f.error(), "status" );
}
@@ -566,7 +593,7 @@ void tst_QFile::open()
void tst_QFile::openUnbuffered()
{
QFile file(m_testFile);
- QVERIFY(file.open(QIODevice::ReadOnly | QIODevice::Unbuffered));
+ QVERIFY2(file.open(QIODevice::ReadOnly | QIODevice::Unbuffered), msgOpenFailed(file).constData());
char c = '\0';
QVERIFY(file.seek(1));
QCOMPARE(file.pos(), qint64(1));
@@ -618,7 +645,7 @@ void tst_QFile::size()
QFile f( filename );
QCOMPARE( f.size(), size );
- QVERIFY( f.open(QIODevice::ReadOnly) );
+ QVERIFY2(f.open(QIODevice::ReadOnly), msgOpenFailed(f).constData());
QCOMPARE( f.size(), size );
}
@@ -662,7 +689,7 @@ void tst_QFile::sizeNoExist()
void tst_QFile::seek()
{
QFile file("newfile.txt");
- file.open(QIODevice::WriteOnly);
+ QVERIFY2(file.open(QIODevice::WriteOnly), msgOpenFailed(file).constData());
QCOMPARE(file.size(), qint64(0));
QCOMPARE(file.pos(), qint64(0));
QVERIFY(file.seek(10));
@@ -674,7 +701,7 @@ void tst_QFile::seek()
void tst_QFile::setSize()
{
QFile f("createme.txt");
- QVERIFY(f.open(QIODevice::Truncate | QIODevice::ReadWrite));
+ QVERIFY2(f.open(QIODevice::Truncate | QIODevice::ReadWrite), msgOpenFailed(f).constData());
f.putChar('a');
f.seek(0);
@@ -712,7 +739,7 @@ void tst_QFile::setSize()
void tst_QFile::setSizeSeek()
{
QFile f("setsizeseek.txt");
- QVERIFY(f.open(QFile::WriteOnly));
+ QVERIFY2(f.open(QFile::WriteOnly), msgOpenFailed(f).constData());
f.write("ABCD");
QCOMPARE(f.pos(), qint64(4));
@@ -734,7 +761,7 @@ void tst_QFile::setSizeSeek()
void tst_QFile::atEnd()
{
QFile f( m_testFile );
- QVERIFY(f.open( QIODevice::ReadOnly ));
+ QVERIFY2(f.open(QFile::ReadOnly), msgOpenFailed(f).constData());
int size = f.size();
f.seek( size );
@@ -747,7 +774,7 @@ void tst_QFile::atEnd()
void tst_QFile::readLine()
{
QFile f( m_testFile );
- QVERIFY(f.open( QIODevice::ReadOnly ));
+ QVERIFY2(f.open(QFile::ReadOnly), msgOpenFailed(f).constData());
int i = 0;
char p[128];
@@ -767,7 +794,8 @@ void tst_QFile::readLine()
void tst_QFile::readLine2()
{
QFile f( m_testFile );
- f.open( QIODevice::ReadOnly );
+ QVERIFY2(f.open(QFile::ReadOnly), msgOpenFailed(f).constData());
+
char p[128];
QCOMPARE(f.readLine(p, 60), qlonglong(59));
@@ -785,7 +813,7 @@ void tst_QFile::readLineNullInLine()
{
QFile::remove("nullinline.txt");
QFile file("nullinline.txt");
- QVERIFY(file.open(QIODevice::ReadWrite));
+ QVERIFY2(file.open(QFile::ReadWrite), msgOpenFailed(file).constData());
QVERIFY(file.write("linewith\0null\nanotherline\0withnull\n\0\nnull\0", 42) > 0);
QVERIFY(file.flush());
file.reset();
@@ -816,10 +844,8 @@ void tst_QFile::readAll()
QFETCH( QString, fileName );
QFile file(fileName);
- if (textMode)
- QVERIFY(file.open(QFile::Text | QFile::ReadOnly));
- else
- QVERIFY(file.open(QFile::ReadOnly));
+ const QIODevice::OpenMode om = textMode ? (QFile::Text | QFile::ReadOnly) : QFile::ReadOnly;
+ QVERIFY2(file.open(om), msgOpenFailed(om, file).constData());
QByteArray a = file.readAll();
file.reset();
@@ -848,8 +874,8 @@ void tst_QFile::readAllBuffer()
QByteArray data1("This is arguably a very simple text.");
QByteArray data2("This is surely not as simple a test.");
- QVERIFY( writer.open(QIODevice::ReadWrite | QIODevice::Unbuffered) );
- QVERIFY( reader.open(QIODevice::ReadOnly) );
+ QVERIFY2(writer.open(QIODevice::ReadWrite | QIODevice::Unbuffered), msgOpenFailed(writer).constData());
+ QVERIFY2(reader.open(QIODevice::ReadOnly), msgOpenFailed(reader).constData());
QCOMPARE( writer.write(data1), qint64(data1.size()) );
QVERIFY( writer.seek(0) );
@@ -868,6 +894,32 @@ void tst_QFile::readAllBuffer()
QFile::remove(fileName);
}
+#ifndef QT_NO_PROCESS
+class StdinReaderProcessGuard { // Ensure the stdin reader process is stopped on destruction.
+ Q_DISABLE_COPY(StdinReaderProcessGuard)
+
+public:
+ StdinReaderProcessGuard(QProcess *p) : m_process(p) {}
+ ~StdinReaderProcessGuard() { stop(); }
+
+ bool stop(int msecs = 30000)
+ {
+ if (m_process->state() != QProcess::Running)
+ return true;
+ m_process->closeWriteChannel();
+ if (m_process->waitForFinished(msecs))
+ return m_process->exitStatus() == QProcess::NormalExit && !m_process->exitCode();
+ m_process->terminate();
+ if (!m_process->waitForFinished())
+ m_process->kill();
+ return false;
+ }
+
+private:
+ QProcess *m_process;
+};
+#endif // !QT_NO_PROCESS
+
#if !defined(Q_OS_WINCE)
void tst_QFile::readAllStdin()
{
@@ -877,18 +929,17 @@ void tst_QFile::readAllStdin()
QByteArray lotsOfData(1024, '@'); // 10 megs
QProcess process;
+ StdinReaderProcessGuard processGuard(&process);
process.start(m_stdinProcessDir + QStringLiteral("/stdinprocess"), QStringList(QStringLiteral("all")));
QVERIFY2(process.waitForStarted(), qPrintable(process.errorString()));
for (int i = 0; i < 5; ++i) {
QTest::qWait(1000);
process.write(lotsOfData);
- while (process.bytesToWrite() > 0) {
+ while (process.bytesToWrite() > 0)
QVERIFY(process.waitForBytesWritten());
- }
}
- process.closeWriteChannel();
- process.waitForFinished();
+ QVERIFY(processGuard.stop());
QCOMPARE(process.readAll().size(), lotsOfData.size() * 5);
#endif
}
@@ -908,6 +959,7 @@ void tst_QFile::readLineStdin()
for (int i = 0; i < 2; ++i) {
QProcess process;
+ StdinReaderProcessGuard processGuard(&process);
process.start(m_stdinProcessDir + QStringLiteral("/stdinprocess"),
QStringList() << QStringLiteral("line") << QString::number(i),
QIODevice::Text | QIODevice::ReadWrite);
@@ -915,13 +967,11 @@ void tst_QFile::readLineStdin()
for (int i = 0; i < 5; ++i) {
QTest::qWait(1000);
process.write(lotsOfData);
- while (process.bytesToWrite() > 0) {
+ while (process.bytesToWrite() > 0)
QVERIFY(process.waitForBytesWritten());
- }
}
- process.closeWriteChannel();
- QVERIFY(process.waitForFinished(5000));
+ QVERIFY(processGuard.stop(5000));
QByteArray array = process.readAll();
QCOMPARE(array.size(), lotsOfData.size() * 5);
@@ -942,6 +992,7 @@ void tst_QFile::readLineStdin_lineByLine()
#else
for (int i = 0; i < 2; ++i) {
QProcess process;
+ StdinReaderProcessGuard processGuard(&process);
process.start(m_stdinProcessDir + QStringLiteral("/stdinprocess"),
QStringList() << QStringLiteral("line") << QString::number(i),
QIODevice::Text | QIODevice::ReadWrite);
@@ -956,8 +1007,7 @@ void tst_QFile::readLineStdin_lineByLine()
QCOMPARE(process.readAll(), line);
}
- process.closeWriteChannel();
- QVERIFY(process.waitForFinished(5000));
+ QVERIFY(processGuard.stop(5000));
}
#endif
}
@@ -967,7 +1017,7 @@ void tst_QFile::text()
{
// dosfile.txt is a binary CRLF file
QFile file(m_dosFile);
- QVERIFY(file.open(QFile::Text | QFile::ReadOnly));
+ QVERIFY2(file.open(QFile::Text | QFile::ReadOnly), msgOpenFailed(file).constData());
QCOMPARE(file.readLine(),
QByteArray("/dev/system/root / reiserfs acl,user_xattr 1 1\n"));
QCOMPARE(file.readLine(),
@@ -980,7 +1030,7 @@ void tst_QFile::text()
void tst_QFile::missingEndOfLine()
{
QFile file(m_noEndOfLineFile);
- QVERIFY(file.open(QFile::ReadOnly));
+ QVERIFY2(file.open(QFile::ReadOnly), msgOpenFailed(file).constData());
int nlines = 0;
while (!file.atEnd()) {
@@ -1026,7 +1076,7 @@ void tst_QFile::getch()
void tst_QFile::ungetChar()
{
QFile f(m_testFile);
- QVERIFY(f.open(QIODevice::ReadOnly));
+ QVERIFY2(f.open(QFile::ReadOnly), msgOpenFailed(f).constData());
QByteArray array = f.readLine();
QCOMPARE(array.constData(), "----------------------------------------------------------\n");
@@ -1044,7 +1094,7 @@ void tst_QFile::ungetChar()
QFile::remove("genfile.txt");
QFile out("genfile.txt");
- QVERIFY(out.open(QIODevice::ReadWrite));
+ QVERIFY2(out.open(QIODevice::ReadWrite), msgOpenFailed(out).constData());
out.write("123");
out.seek(0);
QCOMPARE(out.readAll().constData(), "123");
@@ -1127,7 +1177,7 @@ void tst_QFile::createFile()
QVERIFY( !QFile::exists( "createme.txt" ) );
QFile f( "createme.txt" );
- QVERIFY( f.open( QIODevice::WriteOnly ) );
+ QVERIFY2( f.open(QIODevice::WriteOnly), msgOpenFailed(f).constData());
f.close();
QVERIFY( QFile::exists( "createme.txt" ) );
}
@@ -1140,11 +1190,11 @@ void tst_QFile::append()
QVERIFY(!QFile::exists(name));
QFile f(name);
- QVERIFY(f.open(QIODevice::WriteOnly | QIODevice::Truncate));
+ QVERIFY2(f.open(QIODevice::WriteOnly | QIODevice::Truncate), msgOpenFailed(f).constData());
f.putChar('a');
f.close();
- QVERIFY(f.open(QIODevice::Append));
+ QVERIFY2(f.open(QIODevice::Append), msgOpenFailed(f).constData());
QCOMPARE(f.pos(), 1);
f.putChar('a');
f.close();
@@ -1181,7 +1231,7 @@ void tst_QFile::permissions()
QFETCH(bool, create);
if (create) {
QFile fc(file);
- QVERIFY(fc.open(QFile::WriteOnly));
+ QVERIFY2(fc.open(QFile::WriteOnly), msgOpenFailed(fc).constData());
QVERIFY(fc.write("hello\n"));
fc.close();
}
@@ -1230,7 +1280,7 @@ void tst_QFile::setPermissions()
QVERIFY( !QFile::exists( "createme.txt" ) );
QFile f("createme.txt");
- QVERIFY(f.open(QIODevice::WriteOnly | QIODevice::Truncate));
+ QVERIFY2(f.open(QIODevice::WriteOnly | QIODevice::Truncate), msgOpenFailed(f).constData());
f.putChar('a');
f.close();
@@ -1247,8 +1297,8 @@ void tst_QFile::copy()
QFile::remove("test2");
QVERIFY(QFile::copy(m_testSourceFile, "tst_qfile_copy.cpp"));
QFile in1(m_testSourceFile), in2("tst_qfile_copy.cpp");
- QVERIFY(in1.open(QFile::ReadOnly));
- QVERIFY(in2.open(QFile::ReadOnly));
+ QVERIFY2(in1.open(QFile::ReadOnly), msgOpenFailed(in1).constData());
+ QVERIFY2(in2.open(QFile::ReadOnly), msgOpenFailed(in2).constData());
QByteArray data1 = in1.readAll(), data2 = in2.readAll();
QCOMPARE(data1, data2);
QFile::remove( "main_copy.cpp" );
@@ -1261,8 +1311,8 @@ void tst_QFile::copyAfterFail()
QFile file1("file-to-be-copied.txt");
QFile file2("existing-file.txt");
- QVERIFY(file1.open(QIODevice::ReadWrite) && "(test-precondition)");
- QVERIFY(file2.open(QIODevice::ReadWrite) && "(test-precondition)");
+ QVERIFY2(file1.open(QIODevice::ReadWrite), msgOpenFailed(file1).constData());
+ QVERIFY2(file2.open(QIODevice::ReadWrite), msgOpenFailed(file1).constData());
file2.close();
QVERIFY(!QFile::exists("copied-file-1.txt") && "(test-precondition)");
QVERIFY(!QFile::exists("copied-file-2.txt") && "(test-precondition)");
@@ -1331,7 +1381,7 @@ void tst_QFile::copyFallback()
QVERIFY(QFile::remove("file-copy-destination.txt"));
// Fallback copy of open file.
- QVERIFY(file.open(QIODevice::ReadOnly));
+ QVERIFY2(file.open(QIODevice::ReadOnly), msgOpenFailed(file).constData());
QVERIFY(file.copy("file-copy-destination.txt"));
QVERIFY(QFile::exists("file-copy-destination.txt"));
QVERIFY(!file.isOpen());
@@ -1401,7 +1451,7 @@ void tst_QFile::link()
QCOMPARE(info2.symLinkTarget(), referenceTarget);
QFile link("myLink.lnk");
- QVERIFY(link.open(QIODevice::ReadOnly));
+ QVERIFY2(link.open(QIODevice::ReadOnly), msgOpenFailed(link).constData());
QCOMPARE(link.symLinkTarget(), referenceTarget);
link.close();
@@ -1483,15 +1533,15 @@ void tst_QFile::readTextFile()
QFETCH(QByteArray, out);
QFile winfile("winfile.txt");
- QVERIFY(winfile.open(QFile::WriteOnly | QFile::Truncate));
+ QVERIFY2(winfile.open(QFile::WriteOnly | QFile::Truncate), msgOpenFailed(winfile).constData());
winfile.write(in);
winfile.close();
- QVERIFY(winfile.open(QFile::ReadOnly));
+ QVERIFY2(winfile.open(QFile::ReadOnly), msgOpenFailed(winfile).constData());
QCOMPARE(winfile.readAll(), in);
winfile.close();
- QVERIFY(winfile.open(QFile::ReadOnly | QFile::Text));
+ QVERIFY2(winfile.open(QFile::ReadOnly | QFile::Text), msgOpenFailed(winfile).constData());
QCOMPARE(winfile.readAll(), out);
}
@@ -1499,13 +1549,13 @@ void tst_QFile::readTextFile2()
{
{
QFile file(m_testLogFile);
- QVERIFY(file.open(QIODevice::ReadOnly));
+ QVERIFY2(file.open(QIODevice::ReadOnly), msgOpenFailed(file).constData());
file.read(4097);
}
{
QFile file(m_testLogFile);
- QVERIFY(file.open(QIODevice::ReadOnly | QIODevice::Text));
+ QVERIFY2(file.open(QIODevice::ReadOnly | QIODevice::Text), msgOpenFailed(file).constData());
file.read(4097);
}
}
@@ -1532,7 +1582,8 @@ void tst_QFile::writeTextFile()
QFETCH(QByteArray, in);
QFile file("textfile.txt");
- QVERIFY(file.open(QFile::WriteOnly | QFile::Truncate | QFile::Text));
+ QVERIFY2(file.open(QFile::WriteOnly | QFile::Truncate | QFile::Text),
+ msgOpenFailed(file).constData());
QByteArray out = in;
#ifdef Q_OS_WIN
out.replace('\n', "\r\n");
@@ -1555,8 +1606,10 @@ void tst_QFile::largeUncFileSupport()
{
// 1) Native file handling.
QFile file(largeFile);
+ QVERIFY2(file.exists(), msgFileDoesNotExist(largeFile));
+
QCOMPARE(file.size(), size);
- QVERIFY(file.open(QIODevice::ReadOnly));
+ QVERIFY2(file.open(QIODevice::ReadOnly), msgOpenFailed(file).constData());
QCOMPARE(file.size(), size);
QVERIFY(file.seek(dataOffset));
QCOMPARE(file.read(knownData.size()), knownData);
@@ -1593,13 +1646,13 @@ void tst_QFile::flush()
{
QFile file(fileName);
- QVERIFY(file.open(QFile::WriteOnly));
+ QVERIFY2(file.open(QFile::WriteOnly), msgOpenFailed(file).constData());
QCOMPARE(file.write("abc", 3),qint64(3));
}
{
QFile file(fileName);
- QVERIFY(file.open(QFile::WriteOnly | QFile::Append));
+ QVERIFY2(file.open(QFile::WriteOnly | QFile::Append), msgOpenFailed(file).constData());
QCOMPARE(file.pos(), qlonglong(3));
QCOMPARE(file.write("def", 3), qlonglong(3));
QCOMPARE(file.pos(), qlonglong(6));
@@ -1607,7 +1660,7 @@ void tst_QFile::flush()
{
QFile file("stdfile.txt");
- QVERIFY(file.open(QFile::ReadOnly));
+ QVERIFY2(file.open(QFile::ReadOnly), msgOpenFailed(file).constData());
QCOMPARE(file.readAll(), QByteArray("abcdef"));
}
}
@@ -1617,7 +1670,7 @@ void tst_QFile::bufferedRead()
QFile::remove("stdfile.txt");
QFile file("stdfile.txt");
- QVERIFY(file.open(QFile::WriteOnly));
+ QVERIFY2(file.open(QFile::WriteOnly), msgOpenFailed(file).constData());
file.write("abcdef");
file.close();
@@ -1634,7 +1687,7 @@ void tst_QFile::bufferedRead()
{
QFile file;
- QVERIFY(file.open(stdFile, QFile::ReadOnly));
+ QVERIFY2(file.open(stdFile, QFile::ReadOnly), msgOpenFailed(file).constData());
QCOMPARE(file.pos(), qlonglong(1));
QCOMPARE(file.read(&c, 1), qlonglong(1));
QCOMPARE(c, 'b');
@@ -1648,7 +1701,7 @@ void tst_QFile::bufferedRead()
void tst_QFile::isSequential()
{
QFile zero("/dev/null");
- QVERIFY(zero.open(QFile::ReadOnly));
+ QVERIFY2(zero.open(QFile::ReadOnly), msgOpenFailed(zero).constData());
QVERIFY(zero.isSequential());
}
#endif
@@ -1662,15 +1715,15 @@ void tst_QFile::truncate()
{
for (int i = 0; i < 2; ++i) {
QFile file("truncate.txt");
- QVERIFY(file.open(QFile::WriteOnly));
+ QVERIFY2(file.open(QFile::WriteOnly), msgOpenFailed(file).constData());
file.write(QByteArray(200, '@'));
file.close();
- QVERIFY(file.open((i ? QFile::WriteOnly : QFile::ReadWrite) | QFile::Truncate));
+ QVERIFY2(file.open((i ? QFile::WriteOnly : QFile::ReadWrite) | QFile::Truncate), msgOpenFailed(file).constData());
file.write(QByteArray(100, '$'));
file.close();
- QVERIFY(file.open(QFile::ReadOnly));
+ QVERIFY2(file.open(QFile::ReadOnly), msgOpenFailed(file).constData());
QCOMPARE(file.readAll(), QByteArray(100, '$'));
}
}
@@ -1679,13 +1732,13 @@ void tst_QFile::seekToPos()
{
{
QFile file("seekToPos.txt");
- QVERIFY(file.open(QFile::WriteOnly));
+ QVERIFY2(file.open(QFile::WriteOnly), msgOpenFailed(file).constData());
file.write("a\r\nb\r\nc\r\n");
file.flush();
}
QFile file("seekToPos.txt");
- QVERIFY(file.open(QFile::ReadOnly | QFile::Text));
+ QVERIFY2(file.open(QFile::ReadOnly | QFile::Text), msgOpenFailed(file).constData());
file.seek(1);
char c;
QVERIFY(file.getChar(&c));
@@ -1707,7 +1760,7 @@ void tst_QFile::seekAfterEndOfFile()
QFile::remove(filename);
{
QFile file(filename);
- QVERIFY(file.open(QFile::WriteOnly));
+ QVERIFY2(file.open(QFile::WriteOnly), msgOpenFailed(file).constData());
file.write("abcd");
QCOMPARE(file.size(), qint64(4));
file.seek(8);
@@ -1723,7 +1776,7 @@ void tst_QFile::seekAfterEndOfFile()
}
QFile file(filename);
- QVERIFY(file.open(QFile::ReadOnly));
+ QVERIFY2(file.open(QFile::ReadOnly), msgOpenFailed(file).constData());
QByteArray contents = file.readAll();
QCOMPARE(contents.left(12), QByteArray("abcdefghijkl", 12));
//bytes 12-15 are uninitialised so we don't care what they read as.
@@ -1741,7 +1794,7 @@ void tst_QFile::FILEReadWrite()
// create test file
{
QFile f("FILEReadWrite.txt");
- QVERIFY(f.open(QFile::WriteOnly));
+ QVERIFY2(f.open(QFile::WriteOnly), msgOpenFailed(f).constData());
QDataStream ds(&f);
qint8 c = 0;
ds << c;
@@ -1777,7 +1830,7 @@ void tst_QFile::FILEReadWrite()
#endif
QVERIFY(fp);
QFile file;
- QVERIFY(file.open(fp, QFile::ReadWrite));
+ QVERIFY2(file.open(fp, QFile::ReadWrite), msgOpenFailed(file).constData());
QDataStream sfile(&file) ;
qint8 var1,var2,var3,var4;
@@ -1814,7 +1867,7 @@ void tst_QFile::FILEReadWrite()
// check modified file
{
QFile f("FILEReadWrite.txt");
- QVERIFY(f.open(QFile::ReadOnly));
+ QVERIFY2(f.open(QFile::ReadOnly), msgOpenFailed(file).constData());
QDataStream ds(&f);
qint8 c = 0;
ds >> c;
@@ -1928,14 +1981,14 @@ void tst_QFile::i18nFileName()
}
{
QFile file(fileName);
- QVERIFY(file.open(QFile::WriteOnly | QFile::Text));
+ QVERIFY2(file.open(QFile::WriteOnly | QFile::Text), msgOpenFailed(file).constData());
QTextStream ts(&file);
ts.setCodec("UTF-8");
ts << fileName << endl;
}
{
QFile file(fileName);
- QVERIFY(file.open(QFile::ReadOnly | QFile::Text));
+ QVERIFY2(file.open(QFile::ReadOnly | QFile::Text), msgOpenFailed(file).constData());
QTextStream ts(&file);
ts.setCodec("UTF-8");
QString line = ts.readLine();
@@ -1983,13 +2036,13 @@ void tst_QFile::longFileName()
QEXPECT_FAIL("244 chars", "Full pathname must be less than 260 chars", Abort);
QEXPECT_FAIL("244 chars to absolutepath", "Full pathname must be less than 260 chars", Abort);
#endif
- QVERIFY(file.open(QFile::WriteOnly | QFile::Text));
+ QVERIFY2(file.open(QFile::WriteOnly | QFile::Text), msgOpenFailed(file).constData());
QTextStream ts(&file);
ts << fileName << endl;
}
{
QFile file(fileName);
- QVERIFY(file.open(QFile::ReadOnly | QFile::Text));
+ QVERIFY2(file.open(QFile::ReadOnly | QFile::Text), msgOpenFailed(file).constData());
QTextStream ts(&file);
QString line = ts.readLine();
QCOMPARE(line, fileName);
@@ -1998,7 +2051,7 @@ void tst_QFile::longFileName()
{
QVERIFY(QFile::copy(fileName, newName));
QFile file(newName);
- QVERIFY(file.open(QFile::ReadOnly | QFile::Text));
+ QVERIFY2(file.open(QFile::ReadOnly | QFile::Text), msgOpenFailed(file).constData());
QTextStream ts(&file);
QString line = ts.readLine();
QCOMPARE(line, fileName);
@@ -2008,12 +2061,12 @@ void tst_QFile::longFileName()
{
QVERIFY(QFile::rename(fileName, newName));
QFile file(newName);
- QVERIFY(file.open(QFile::ReadOnly | QFile::Text));
+ QVERIFY2(file.open(QFile::ReadOnly | QFile::Text), msgOpenFailed(file).constData());
QTextStream ts(&file);
QString line = ts.readLine();
QCOMPARE(line, fileName);
}
- QVERIFY(QFile::exists(newName));
+ QVERIFY2(QFile::exists(newName), msgFileDoesNotExist(newName).constData());
}
#ifdef QT_BUILD_INTERNAL
@@ -2146,7 +2199,7 @@ void tst_QFile::remove_and_exists()
bool opened = f.open(QIODevice::WriteOnly);
QVERIFY(opened);
- f.write(QString("testing that remove/exists work...").toLatin1());
+ f.write("testing that remove/exists work...");
f.close();
QVERIFY(f.exists());
@@ -2165,7 +2218,7 @@ void tst_QFile::removeOpenFile()
QVERIFY(!f.exists());
bool opened = f.open(QIODevice::WriteOnly);
QVERIFY(opened);
- f.write(QString("testing that remove closes the file first...").toLatin1());
+ f.write("testing that remove closes the file first...");
bool removed = f.remove(); // remove should both close and remove the file
QVERIFY(removed);
@@ -2184,7 +2237,7 @@ void tst_QFile::removeOpenFile()
QVERIFY(!f.exists());
bool opened = f.open(QIODevice::WriteOnly);
QVERIFY(opened);
- f.write(QString("testing that remove closes the file first...").toLatin1());
+ f.write("testing that remove closes the file first...");
f.close();
}
@@ -2208,7 +2261,7 @@ void tst_QFile::fullDisk()
if (!file.exists())
QSKIP("/dev/full doesn't exist on this system");
- QVERIFY(file.open(QIODevice::WriteOnly));
+ QVERIFY2(file.open(QIODevice::WriteOnly), msgOpenFailed(file).constData());
file.write("foobar", 6);
QVERIFY(!file.flush());
@@ -2235,7 +2288,7 @@ void tst_QFile::fullDisk()
QCOMPARE(file.error(), QFile::NoError);
// try again without flush:
- QVERIFY(file.open(QIODevice::WriteOnly));
+ QVERIFY2(file.open(QIODevice::WriteOnly), msgOpenFailed(file).constData());
file.write("foobar", 6);
file.close();
QVERIFY(file.error() != QFile::NoError);
@@ -2288,8 +2341,7 @@ void tst_QFile::writeLargeDataBlock()
{
QFile file(fileName);
- QVERIFY2( openFile(file, QIODevice::WriteOnly, (FileType)type),
- qPrintable(QString("Couldn't open file for writing: [%1]").arg(fileName)) );
+ QVERIFY2(openFile(file, QIODevice::WriteOnly, (FileType)type), msgOpenFailed(file));
qint64 fileWriteOriginalData = file.write(originalData);
qint64 originalDataSize = (qint64)originalData.size();
#if defined(Q_OS_WIN)
@@ -2332,7 +2384,7 @@ void tst_QFile::writeLargeDataBlock()
void tst_QFile::readFromWriteOnlyFile()
{
QFile file("writeonlyfile");
- QVERIFY(file.open(QFile::WriteOnly));
+ QVERIFY2(file.open(QFile::WriteOnly), msgOpenFailed(file).constData());
char c;
QTest::ignoreMessage(QtWarningMsg, "QIODevice::read (QFile, \"writeonlyfile\"): WriteOnly device");
QCOMPARE(file.read(&c, 1), qint64(-1));
@@ -2341,7 +2393,7 @@ void tst_QFile::readFromWriteOnlyFile()
void tst_QFile::writeToReadOnlyFile()
{
QFile file("readonlyfile");
- QVERIFY(file.open(QFile::ReadOnly));
+ QVERIFY2(file.open(QFile::ReadOnly), msgOpenFailed(file).constData());
char c = 0;
QTest::ignoreMessage(QtWarningMsg, "QIODevice::write (QFile, \"readonlyfile\"): ReadOnly device");
QCOMPARE(file.write(&c, 1), qint64(-1));
@@ -2363,13 +2415,13 @@ void tst_QFile::virtualFile()
// consistency check
QFileInfo fi(fname);
- QVERIFY(fi.exists());
+ QVERIFY2(fi.exists(), msgFileDoesNotExist(fname).constData());
QVERIFY(fi.isFile());
QCOMPARE(fi.size(), Q_INT64_C(0));
// open the file
QFile f(fname);
- QVERIFY(f.open(QIODevice::ReadOnly));
+ QVERIFY2(f.open(QIODevice::ReadOnly), msgOpenFailed(f).constData());
QCOMPARE(f.size(), Q_INT64_C(0));
QVERIFY(f.atEnd());
@@ -2413,7 +2465,7 @@ void tst_QFile::textFile()
::fclose(fs);
QFile file("writeabletextfile");
- QVERIFY(file.open(QIODevice::ReadOnly));
+ QVERIFY2(file.open(QIODevice::ReadOnly), msgOpenFailed(file).constData());
QByteArray data = file.readAll();
@@ -2543,8 +2595,8 @@ void tst_QFile::renameMultiple()
// create the file if it doesn't exist
QFile file("file-to-be-renamed.txt");
QFile file2("existing-file.txt");
- QVERIFY(file.open(QIODevice::ReadWrite) && "(test-precondition)");
- QVERIFY(file2.open(QIODevice::ReadWrite) && "(test-precondition)");
+ QVERIFY2(file.open(QIODevice::ReadWrite), msgOpenFailed(file).constData());
+ QVERIFY2(file2.open(QIODevice::ReadWrite), msgOpenFailed(file2).constData());
// any stale files from previous test failures?
QFile::remove("file-renamed-once.txt");
@@ -2583,10 +2635,10 @@ void tst_QFile::renameMultiple()
void tst_QFile::appendAndRead()
{
QFile writeFile(QLatin1String("appendfile.txt"));
- QVERIFY(writeFile.open(QIODevice::WriteOnly | QIODevice::Truncate));
+ QVERIFY2(writeFile.open(QIODevice::WriteOnly | QIODevice::Truncate), msgOpenFailed(writeFile).constData());
QFile readFile(QLatin1String("appendfile.txt"));
- QVERIFY(readFile.open(QIODevice::ReadOnly));
+ QVERIFY2(readFile.open(QIODevice::ReadOnly), msgOpenFailed(readFile).constData());
// Write to the end of the file, then read that character back, and so on.
for (int i = 0; i < 100; ++i) {
@@ -2612,11 +2664,13 @@ void tst_QFile::miscWithUncPathAsCurrentDir()
{
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
QString current = QDir::currentPath();
- QVERIFY(QDir::setCurrent("//" + QtNetworkSettings::winServerName() + "/testshare"));
+ const QString path = QLatin1String("//") + QtNetworkSettings::winServerName()
+ + QLatin1String("/testshare");
+ QVERIFY2(QDir::setCurrent(path), qPrintable(QDir::toNativeSeparators(path)));
QFile file("test.pri");
- QVERIFY(file.exists());
+ QVERIFY2(file.exists(), msgFileDoesNotExist(file.fileName()).constData());
QCOMPARE(int(file.size()), 34);
- QVERIFY(file.open(QIODevice::ReadOnly));
+ QVERIFY2(file.open(QIODevice::ReadOnly), msgOpenFailed(file).constData());
QVERIFY(QDir::setCurrent(current));
#endif
}
@@ -2634,7 +2688,7 @@ void tst_QFile::handle()
int fd;
#if !defined(Q_OS_WINCE)
QFile file(m_testSourceFile);
- QVERIFY(file.open(QIODevice::ReadOnly));
+ QVERIFY2(file.open(QIODevice::ReadOnly), msgOpenFailed(file).constData());
fd = int(file.handle());
QVERIFY(fd > 2);
QCOMPARE(int(file.handle()), fd);
@@ -2648,7 +2702,7 @@ void tst_QFile::handle()
// same, but read from QFile first now
file.close();
- QVERIFY(file.open(QIODevice::ReadOnly | QIODevice::Unbuffered));
+ QVERIFY2(file.open(QIODevice::ReadOnly | QIODevice::Unbuffered), msgOpenFailed(file).constData());
fd = int(file.handle());
QVERIFY(fd > 2);
QVERIFY(file.getChar(&c));
@@ -2690,7 +2744,7 @@ void tst_QFile::nativeHandleLeaks()
{
QFile file("qt_file.tmp");
- QVERIFY( file.open(QIODevice::ReadWrite) );
+ QVERIFY2(file.open(QIODevice::ReadWrite), msgOpenFailed(file).constData());
fd1 = file.handle();
QVERIFY( -1 != fd1 );
@@ -2709,7 +2763,7 @@ void tst_QFile::nativeHandleLeaks()
{
QFile file("qt_file.tmp");
- QVERIFY( file.open(QIODevice::ReadOnly) );
+ QVERIFY2(file.open(QIODevice::ReadOnly), msgOpenFailed(file).constData());
fd2 = file.handle();
QVERIFY( -1 != fd2 );
@@ -2755,7 +2809,7 @@ void tst_QFile::readEof()
{
QFile file(filename);
- QVERIFY(file.open(QIODevice::ReadOnly | mode));
+ QVERIFY2(file.open(QIODevice::ReadOnly | mode), msgOpenFailed(file).constData());
bool isSequential = file.isSequential();
if (!isSequential) {
QVERIFY(file.seek(245));
@@ -2777,7 +2831,7 @@ void tst_QFile::readEof()
{
QFile file(filename);
- QVERIFY(file.open(QIODevice::ReadOnly | mode));
+ QVERIFY2(file.open(QIODevice::ReadOnly | mode), msgOpenFailed(file).constData());
bool isSequential = file.isSequential();
if (!isSequential) {
QVERIFY(file.seek(245));
@@ -2798,7 +2852,7 @@ void tst_QFile::readEof()
{
QFile file(filename);
- QVERIFY(file.open(QIODevice::ReadOnly | mode));
+ QVERIFY2(file.open(QIODevice::ReadOnly | mode), msgOpenFailed(file).constData());
bool isSequential = file.isSequential();
if (!isSequential) {
QVERIFY(file.seek(245));
@@ -2820,7 +2874,7 @@ void tst_QFile::readEof()
{
QFile file(filename);
- QVERIFY(file.open(QIODevice::ReadOnly | mode));
+ QVERIFY2(file.open(QIODevice::ReadOnly | mode), msgOpenFailed(file).constData());
bool isSequential = file.isSequential();
if (!isSequential) {
QVERIFY(file.seek(245));
@@ -2841,7 +2895,7 @@ void tst_QFile::readEof()
{
QFile file(filename);
- QVERIFY(file.open(QIODevice::ReadOnly | mode));
+ QVERIFY2(file.open(QIODevice::ReadOnly | mode), msgOpenFailed(file).constData());
bool isSequential = file.isSequential();
if (!isSequential) {
QVERIFY(file.seek(245));
@@ -2867,7 +2921,7 @@ void tst_QFile::posAfterFailedStat()
QFile::remove("tmp.txt");
QFile file("tmp.txt");
QVERIFY(!file.exists());
- QVERIFY(file.open(QIODevice::Append));
+ QVERIFY2(file.open(QIODevice::Append), msgOpenFailed(file).constData());
QVERIFY(file.exists());
file.write("qt430", 5);
QVERIFY(!file.isSequential());
@@ -2922,11 +2976,11 @@ void tst_QFile::map()
QCOMPARE(file.error(), QFile::PermissionsError);
// make a file
- QVERIFY(file.open(QFile::ReadWrite));
+ QVERIFY2(file.open(QFile::ReadWrite), msgOpenFailed(file).constData());
QVERIFY(file.resize(fileSize));
QVERIFY(file.flush());
file.close();
- QVERIFY(file.open(QFile::ReadWrite));
+ QVERIFY2(file.open(QFile::ReadWrite), msgOpenFailed(file).constData());
memory = file.map(offset, size);
if (error != QFile::NoError) {
QVERIFY(file.error() != QFile::NoError);
@@ -3061,13 +3115,14 @@ void tst_QFile::mapOpenMode()
QFile file(fileName);
// make a file
- QVERIFY(file.open(QFile::ReadWrite));
+ QVERIFY2(file.open(QFile::ReadWrite), msgOpenFailed(file).constData());
QVERIFY(file.write(pattern));
QVERIFY(file.flush());
file.close();
// open according to our mode
- QVERIFY(file.open(QIODevice::OpenMode(openMode)));
+ const QIODevice::OpenMode om(openMode);
+ QVERIFY2(file.open(om), msgOpenFailed(om, file).constData());
uchar *memory = file.map(0, fileSize, QFileDevice::MemoryMapFlags(flags));
#if defined(Q_OS_WINCE)
@@ -3116,7 +3171,8 @@ void tst_QFile::mapWrittenFile()
QFile::remove(fileName);
}
QFile file(fileName);
- QVERIFY(file.open(QIODevice::ReadWrite | QFile::OpenMode(mode)));
+ const QIODevice::OpenMode om = QIODevice::ReadWrite | QIODevice::OpenMode(mode);
+ QVERIFY2(file.open(om), msgOpenFailed(om, file).constData());
QCOMPARE(file.write(data, sizeof data), qint64(sizeof data));
if ((mode & QIODevice::Unbuffered) == 0)
file.flush();
@@ -3328,7 +3384,7 @@ void tst_QFile::caseSensitivity()
QString filename("File.txt");
{
QFile f(filename);
- QVERIFY(f.open(QIODevice::WriteOnly));
+ QVERIFY2(f.open(QIODevice::WriteOnly), msgOpenFailed(f));
QVERIFY(f.write(testData));
f.close();
}
diff --git a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp
index 0319568229..1d49c8e3b9 100644
--- a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp
+++ b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp
@@ -149,6 +149,25 @@ static QString seedAndTemplate()
qsrand(QDateTime::currentDateTimeUtc().toTime_t());
return QDir::tempPath() + "/tst_qfileinfo-XXXXXX";
}
+
+static QByteArray msgDoesNotExist(const QString &name)
+{
+ return (QLatin1Char('"') + QDir::toNativeSeparators(name)
+ + QLatin1String("\" does not exist.")).toLocal8Bit();
+}
+
+static QByteArray msgIsNoDirectory(const QString &name)
+{
+ return (QLatin1Char('"') + QDir::toNativeSeparators(name)
+ + QLatin1String("\" is not a directory.")).toLocal8Bit();
+}
+
+static QByteArray msgIsNotRoot(const QString &name)
+{
+ return (QLatin1Char('"') + QDir::toNativeSeparators(name)
+ + QLatin1String("\" is no root directory.")).toLocal8Bit();
+}
+
class tst_QFileInfo : public QObject
{
Q_OBJECT
@@ -317,7 +336,7 @@ static QFileInfoPrivate* getPrivate(QFileInfo &info)
void tst_QFileInfo::copy()
{
QTemporaryFile t;
- t.open();
+ QVERIFY2(t.open(), qPrintable(t.errorString()));
QFileInfo info(t.fileName());
QVERIFY(info.exists());
@@ -414,13 +433,14 @@ void tst_QFileInfo::isDir_data()
//QTest::newRow("drive 2") << "t:s" << false;
#endif
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
- QTest::newRow("unc 1") << "//" + QtNetworkSettings::winServerName() << true;
- QTest::newRow("unc 2") << "//" + QtNetworkSettings::winServerName() + "/" << true;
- QTest::newRow("unc 3") << "//" + QtNetworkSettings::winServerName() + "/testshare" << true;
- QTest::newRow("unc 4") << "//" + QtNetworkSettings::winServerName() + "/testshare/" << true;
- QTest::newRow("unc 5") << "//" + QtNetworkSettings::winServerName() + "/testshare/tmp" << true;
- QTest::newRow("unc 6") << "//" + QtNetworkSettings::winServerName() + "/testshare/tmp/" << true;
- QTest::newRow("unc 7") << "//" + QtNetworkSettings::winServerName() + "/testshare/adirthatshouldnotexist" << false;
+ const QString uncRoot = QStringLiteral("//") + QtNetworkSettings::winServerName();
+ QTest::newRow("unc 1") << uncRoot << true;
+ QTest::newRow("unc 2") << uncRoot + QLatin1Char('/') << true;
+ QTest::newRow("unc 3") << uncRoot + "/testshare" << true;
+ QTest::newRow("unc 4") << uncRoot + "/testshare/" << true;
+ QTest::newRow("unc 5") << uncRoot + "/testshare/tmp" << true;
+ QTest::newRow("unc 6") << uncRoot + "/testshare/tmp/" << true;
+ QTest::newRow("unc 7") << uncRoot + "/testshare/adirthatshouldnotexist" << false;
#endif
}
@@ -429,8 +449,11 @@ void tst_QFileInfo::isDir()
QFETCH(QString, path);
QFETCH(bool, expected);
- QFileInfo fi(path);
- QCOMPARE(fi.isDir(), expected);
+ const bool isDir = QFileInfo(path).isDir();
+ if (expected)
+ QVERIFY2(isDir, msgIsNoDirectory(path).constData());
+ else
+ QVERIFY(!isDir);
}
void tst_QFileInfo::isRoot_data()
@@ -453,10 +476,11 @@ void tst_QFileInfo::isRoot_data()
#endif
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
- QTest::newRow("unc 1") << "//" + QtNetworkSettings::winServerName() << true;
- QTest::newRow("unc 2") << "//" + QtNetworkSettings::winServerName() + "/" << true;
- QTest::newRow("unc 3") << "//" + QtNetworkSettings::winServerName() + "/testshare" << false;
- QTest::newRow("unc 4") << "//" + QtNetworkSettings::winServerName() + "/testshare/" << false;
+ const QString uncRoot = QStringLiteral("//") + QtNetworkSettings::winServerName();
+ QTest::newRow("unc 1") << uncRoot << true;
+ QTest::newRow("unc 2") << uncRoot + QLatin1Char('/') << true;
+ QTest::newRow("unc 3") << uncRoot + "/testshare" << false;
+ QTest::newRow("unc 4") << uncRoot + "/testshare/" << false;
QTest::newRow("unc 7") << "//ahostthatshouldnotexist" << false;
#endif
}
@@ -466,8 +490,11 @@ void tst_QFileInfo::isRoot()
QFETCH(QString, path);
QFETCH(bool, expected);
- QFileInfo fi(path);
- QCOMPARE(fi.isRoot(), expected);
+ const bool isRoot = QFileInfo(path).isRoot();
+ if (expected)
+ QVERIFY2(isRoot, msgIsNotRoot(path).constData());
+ else
+ QVERIFY(!isRoot);
}
void tst_QFileInfo::exists_data()
@@ -493,14 +520,15 @@ void tst_QFileInfo::exists_data()
QTest::newRow("simple dir with slash") << (m_resourcesDir + QLatin1Char('/')) << true;
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
- QTest::newRow("unc 1") << "//" + QtNetworkSettings::winServerName() << true;
- QTest::newRow("unc 2") << "//" + QtNetworkSettings::winServerName() + "/" << true;
- QTest::newRow("unc 3") << "//" + QtNetworkSettings::winServerName() + "/testshare" << true;
- QTest::newRow("unc 4") << "//" + QtNetworkSettings::winServerName() + "/testshare/" << true;
- QTest::newRow("unc 5") << "//" + QtNetworkSettings::winServerName() + "/testshare/tmp" << true;
- QTest::newRow("unc 6") << "//" + QtNetworkSettings::winServerName() + "/testshare/tmp/" << true;
- QTest::newRow("unc 7") << "//" + QtNetworkSettings::winServerName() + "/testshare/adirthatshouldnotexist" << false;
- QTest::newRow("unc 8") << "//" + QtNetworkSettings::winServerName() + "/asharethatshouldnotexist" << false;
+ const QString uncRoot = QStringLiteral("//") + QtNetworkSettings::winServerName();
+ QTest::newRow("unc 1") << uncRoot << true;
+ QTest::newRow("unc 2") << uncRoot + QLatin1Char('/') << true;
+ QTest::newRow("unc 3") << uncRoot + "/testshare" << true;
+ QTest::newRow("unc 4") << uncRoot + "/testshare/" << true;
+ QTest::newRow("unc 5") << uncRoot + "/testshare/tmp" << true;
+ QTest::newRow("unc 6") << uncRoot + "/testshare/tmp/" << true;
+ QTest::newRow("unc 7") << uncRoot + "/testshare/adirthatshouldnotexist" << false;
+ QTest::newRow("unc 8") << uncRoot + "/asharethatshouldnotexist" << false;
QTest::newRow("unc 9") << "//ahostthatshouldnotexist" << false;
#endif
}
@@ -511,8 +539,12 @@ void tst_QFileInfo::exists()
QFETCH(bool, expected);
QFileInfo fi(path);
- QCOMPARE(fi.exists(), expected);
- QCOMPARE(QFileInfo::exists(path), expected);
+ const bool exists = fi.exists();
+ QCOMPARE(exists, QFileInfo::exists(path));
+ if (expected)
+ QVERIFY2(exists, msgDoesNotExist(path).constData());
+ else
+ QVERIFY(!exists);
}
void tst_QFileInfo::absolutePath_data()
@@ -612,7 +644,7 @@ void tst_QFileInfo::canonicalPath()
{
QTemporaryFile tempFile;
tempFile.setAutoRemove(true);
- tempFile.open();
+ QVERIFY2(tempFile.open(), qPrintable(tempFile.errorString()));
QFileInfo fi(tempFile.fileName());
QCOMPARE(fi.canonicalPath(), QFileInfo(QDir::tempPath()).canonicalFilePath());
}
@@ -994,7 +1026,7 @@ void tst_QFileInfo::systemFiles()
QSKIP("This is a Windows only test");
#endif
QFileInfo fi("c:\\pagefile.sys");
- QVERIFY(fi.exists());
+ QVERIFY2(fi.exists(), msgDoesNotExist(fi.absoluteFilePath()).constData());
QVERIFY(fi.size() > 0);
QVERIFY(fi.lastModified().isValid());
}
@@ -1479,7 +1511,7 @@ void tst_QFileInfo::ntfsJunctionPointsAndSymlinks_data()
QTest::newRow("dummy") << target.path() << false << "" << target.canonicalPath();
QSKIP("link not supported by FS or insufficient privilege");
}
- QVERIFY(file.exists());
+ QVERIFY2(file.exists(), msgDoesNotExist(file.fileName()).constData());
QTest::newRow("absolute dir symlink") << absSymlink << true << QDir::fromNativeSeparators(absTarget) << target.canonicalPath();
QTest::newRow("relative dir symlink") << relSymlink << true << QDir::fromNativeSeparators(relTarget) << target.canonicalPath();
@@ -1510,7 +1542,7 @@ void tst_QFileInfo::ntfsJunctionPointsAndSymlinks_data()
QFile file(fileInJunction.absoluteFilePath());
file.open(QIODevice::ReadWrite);
file.close();
- QVERIFY(file.exists());
+ QVERIFY2(file.exists(), msgDoesNotExist(file.fileName()).constData());
QTest::newRow("file in junction") << fileInJunction.absoluteFilePath() << false << "" << fileInJunction.canonicalFilePath();
target = QDir::rootPath();
@@ -1602,7 +1634,7 @@ void tst_QFileInfo::isWritable()
#else
QFileInfo fi("c:\\pagefile.sys");
#endif
- QVERIFY(fi.exists());
+ QVERIFY2(fi.exists(), msgDoesNotExist(fi.absoluteFilePath()).constData());
QVERIFY(!fi.isWritable());
#endif
#if defined (Q_OS_QNX) // On QNX /etc is usually on a read-only filesystem
@@ -1860,7 +1892,7 @@ void tst_QFileInfo::owner()
QVERIFY(testFile.write(testData) != -1);
}
QFileInfo fi(fileName);
- QVERIFY(fi.exists());
+ QVERIFY2(fi.exists(), msgDoesNotExist(fi.absoluteFilePath()).constData());
QCOMPARE(fi.owner(), userName);
QFile::remove(fileName);
@@ -1895,7 +1927,7 @@ void tst_QFileInfo::group()
QVERIFY(testFile.write(testData) != -1);
testFile.close();
QFileInfo fi(fileName);
- QVERIFY(fi.exists());
+ QVERIFY2(fi.exists(), msgDoesNotExist(fi.absoluteFilePath()).constData());
QCOMPARE(fi.group(), expected);
}
diff --git a/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp b/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp
index a0434aa8ee..026743257c 100644
--- a/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp
+++ b/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp
@@ -126,7 +126,7 @@ void tst_QFileSystemWatcher::basicTest()
// create test file
QTemporaryDir temporaryDirectory(m_tempDirPattern);
- QVERIFY(temporaryDirectory.isValid());
+ QVERIFY2(temporaryDirectory.isValid(), qPrintable(temporaryDirectory.errorString()));
QFile testFile(temporaryDirectory.path() + QLatin1Char('/') + testFileName);
QVERIFY(testFile.open(QIODevice::WriteOnly | QIODevice::Truncate));
testFile.write(QByteArray("hello"));
@@ -263,7 +263,7 @@ void tst_QFileSystemWatcher::watchDirectory()
QFETCH(QString, backend);
QTemporaryDir temporaryDirectory(m_tempDirPattern);
- QVERIFY(temporaryDirectory.isValid());
+ QVERIFY2(temporaryDirectory.isValid(), qPrintable(temporaryDirectory.errorString()));
QDir temporaryDir(temporaryDirectory.path());
const QString testDirName = QStringLiteral("testDir");
@@ -498,7 +498,7 @@ void tst_QFileSystemWatcher::watchFileAndItsDirectory()
QFETCH(QString, backend);
QTemporaryDir temporaryDirectory(m_tempDirPattern);
- QVERIFY(temporaryDirectory.isValid());
+ QVERIFY2(temporaryDirectory.isValid(), qPrintable(temporaryDirectory.errorString()));
QDir temporaryDir(temporaryDirectory.path());
const QString testDirName = QStringLiteral("testDir");
@@ -605,7 +605,7 @@ void tst_QFileSystemWatcher::nonExistingFile()
void tst_QFileSystemWatcher::removeFileAndUnWatch()
{
QTemporaryDir temporaryDirectory(m_tempDirPattern);
- QVERIFY(temporaryDirectory.isValid());
+ QVERIFY2(temporaryDirectory.isValid(), qPrintable(temporaryDirectory.errorString()));
const QString filename = temporaryDirectory.path() + QStringLiteral("/foo.txt");
@@ -664,7 +664,7 @@ void tst_QFileSystemWatcher::QTBUG2331()
QFETCH(QString, backend);
QTemporaryDir temporaryDirectory(m_tempDirPattern);
- QVERIFY(temporaryDirectory.isValid());
+ QVERIFY2(temporaryDirectory.isValid(), qPrintable(temporaryDirectory.errorString()));
QFileSystemWatcher watcher;
watcher.setObjectName(QLatin1String("_qt_autotest_force_engine_") + backend);
QVERIFY(watcher.addPath(temporaryDirectory.path()));
@@ -724,7 +724,8 @@ void tst_QFileSystemWatcher::signalsEmittedAfterFileMoved()
{
const int fileCount = 10;
QTemporaryDir temporaryDirectory(m_tempDirPattern);
- QVERIFY(temporaryDirectory.isValid());
+ QVERIFY2(temporaryDirectory.isValid(), qPrintable(temporaryDirectory.errorString()));
+
QDir testDir(temporaryDirectory.path());
QVERIFY(testDir.mkdir("movehere"));
QString movePath = testDir.filePath("movehere");
diff --git a/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp b/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp
index 27614e0eb8..21c5696d1d 100644
--- a/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp
+++ b/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp
@@ -80,6 +80,7 @@ void tst_QLockFile::initTestCase()
#elif defined(QT_NO_PROCESS)
QSKIP("This test requires QProcess support");
#else
+ QVERIFY2(dir.isValid(), qPrintable(dir.errorString()));
// chdir to our testdata path and execute helper apps relative to that.
QString testdata_dir = QFileInfo(QFINDTESTDATA("qlockfiletesthelper")).absolutePath();
QVERIFY2(QDir::setCurrent(testdata_dir), qPrintable("Could not chdir to " + testdata_dir));
diff --git a/tests/auto/corelib/io/qprocess/BLACKLIST b/tests/auto/corelib/io/qprocess/BLACKLIST
index dcd913ca49..216faa7fb4 100644
--- a/tests/auto/corelib/io/qprocess/BLACKLIST
+++ b/tests/auto/corelib/io/qprocess/BLACKLIST
@@ -1,2 +1,5 @@
[lockupsInStartDetached]
redhatenterpriselinuxworkstation-6.6
+# QTBUG-48455
+[fileWriterProcess]
+msvc-2015
diff --git a/tests/auto/corelib/io/qprocess/fileWriterProcess/main.cpp b/tests/auto/corelib/io/qprocess/fileWriterProcess/main.cpp
index 411c7e334b..25cb66f9d2 100644
--- a/tests/auto/corelib/io/qprocess/fileWriterProcess/main.cpp
+++ b/tests/auto/corelib/io/qprocess/fileWriterProcess/main.cpp
@@ -33,20 +33,26 @@
#include <QCoreApplication>
#include <QFile>
+#include <stdio.h>
+
int main(int argc, char **argv)
{
QCoreApplication ca(argc, argv);
QFile f;
f.open(stdin, QIODevice::ReadOnly);
- QString input;
+ QByteArray input;
char buf[1024];
qint64 len;
while ((len = f.read(buf, 1024)) > 0)
- input += QByteArray(buf, len);
+ input.append(buf, len);
f.close();
QFile f2("fileWriterProcess.txt");
- f2.open(QIODevice::WriteOnly | QIODevice::Truncate);
- f2.write(input.toLatin1());
+ if (!f2.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
+ fprintf(stderr, "Cannot open %s for writing: %s\n",
+ qPrintable(f2.fileName()), qPrintable(f2.errorString()));
+ return 1;
+ }
+ f2.write(input);
f2.close();
return 0;
}
diff --git a/tests/auto/corelib/io/qprocess/testDetached/main.cpp b/tests/auto/corelib/io/qprocess/testDetached/main.cpp
index bbcc7033c7..760306ea17 100644
--- a/tests/auto/corelib/io/qprocess/testDetached/main.cpp
+++ b/tests/auto/corelib/io/qprocess/testDetached/main.cpp
@@ -57,7 +57,8 @@ int main(int argc, char **argv)
QFile f(args.at(1));
if (!f.open(QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text)) {
- fprintf(stderr, "Cannot open %s for writing", qPrintable(f.fileName()));
+ fprintf(stderr, "Cannot open %s for writing: %s\n",
+ qPrintable(f.fileName()), qPrintable(f.errorString()));
return 1;
}
diff --git a/tests/auto/corelib/io/qprocess/testExitCodes/main.cpp b/tests/auto/corelib/io/qprocess/testExitCodes/main.cpp
index c92d7f515f..c3cf9f56c7 100644
--- a/tests/auto/corelib/io/qprocess/testExitCodes/main.cpp
+++ b/tests/auto/corelib/io/qprocess/testExitCodes/main.cpp
@@ -33,8 +33,8 @@
#include <stdlib.h>
-int main(int /* argc */, char **argv)
+int main(int argc, char **argv)
{
- return atoi(argv[1]);
+ return argc >= 2 ? atoi(argv[1]) : -1;
}
diff --git a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp
index 426c378967..83da28767f 100644
--- a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp
+++ b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp
@@ -62,6 +62,10 @@ if (ret == false) \
QVERIFY(ret); \
}
+typedef void (QProcess::*QProcessFinishedSignal1)(int);
+typedef void (QProcess::*QProcessFinishedSignal2)(int, QProcess::ExitStatus);
+typedef void (QProcess::*QProcessErrorSignal)(QProcess::ProcessError);
+
class tst_QProcess : public QObject
{
Q_OBJECT
@@ -69,6 +73,7 @@ class tst_QProcess : public QObject
public slots:
void initTestCase();
void cleanupTestCase();
+ void init();
#ifndef QT_NO_PROCESS
private slots:
@@ -174,7 +179,6 @@ protected slots:
#endif
private:
- QProcess *process;
qint64 bytesAvailable;
#endif //QT_NO_PROCESS
};
@@ -197,6 +201,11 @@ void tst_QProcess::cleanupTestCase()
#endif
}
+void tst_QProcess::init()
+{
+ bytesAvailable = 0;
+}
+
#ifndef QT_NO_PROCESS
// Testing get/set functions
@@ -257,10 +266,10 @@ void tst_QProcess::simpleStart()
{
qRegisterMetaType<QProcess::ProcessState>("QProcess::ProcessState");
- process = new QProcess;
- QSignalSpy spy(process, &QProcess::stateChanged);
+ QScopedPointer<QProcess> process(new QProcess);
+ QSignalSpy spy(process.data(), &QProcess::stateChanged);
QVERIFY(spy.isValid());
- connect(process, SIGNAL(readyRead()), this, SLOT(readFromProcess()));
+ connect(process.data(), &QIODevice::readyRead, this, &tst_QProcess::readFromProcess);
/* valgrind dislike SUID binaries(those that have the `s'-flag set), which
* makes it fail to start the process. For this reason utilities like `ping' won't
@@ -272,8 +281,7 @@ void tst_QProcess::simpleStart()
QCOMPARE(process->state(), QProcess::Running);
QTRY_COMPARE(process->state(), QProcess::NotRunning);
- delete process;
- process = 0;
+ process.reset();
QCOMPARE(spy.count(), 3);
QCOMPARE(qvariant_cast<QProcess::ProcessState>(spy.at(0).at(0)), QProcess::Starting);
@@ -325,9 +333,8 @@ void tst_QProcess::execute()
void tst_QProcess::startDetached()
{
- QProcess proc;
- QVERIFY(proc.startDetached("testProcessNormal/testProcessNormal",
- QStringList() << "arg1" << "arg2"));
+ QVERIFY(QProcess::startDetached("testProcessNormal/testProcessNormal",
+ QStringList() << "arg1" << "arg2"));
#ifdef QPROCESS_USE_SPAWN
QEXPECT_FAIL("", "QProcess cannot detect failure to start when using posix_spawn()", Continue);
#endif
@@ -336,18 +343,20 @@ void tst_QProcess::startDetached()
void tst_QProcess::readFromProcess()
{
+ QProcess *process = qobject_cast<QProcess *>(sender());
+ QVERIFY(process);
int lines = 0;
while (process->canReadLine()) {
++lines;
- QByteArray line = process->readLine();
+ process->readLine();
}
}
void tst_QProcess::crashTest()
{
qRegisterMetaType<QProcess::ProcessState>("QProcess::ProcessState");
- process = new QProcess;
- QSignalSpy stateSpy(process, &QProcess::stateChanged);
+ QScopedPointer<QProcess> process(new QProcess);
+ QSignalSpy stateSpy(process.data(), &QProcess::stateChanged);
QVERIFY(stateSpy.isValid());
process->start("testProcessCrash/testProcessCrash");
QVERIFY(process->waitForStarted(5000));
@@ -355,9 +364,9 @@ void tst_QProcess::crashTest()
qRegisterMetaType<QProcess::ProcessError>("QProcess::ProcessError");
qRegisterMetaType<QProcess::ExitStatus>("QProcess::ExitStatus");
- QSignalSpy spy(process, &QProcess::errorOccurred);
- QSignalSpy spy2(process, static_cast<void (QProcess::*)(QProcess::ProcessError)>(&QProcess::error));
- QSignalSpy spy3(process, static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished));
+ QSignalSpy spy(process.data(), &QProcess::errorOccurred);
+ QSignalSpy spy2(process.data(), static_cast<QProcessErrorSignal>(&QProcess::error));
+ QSignalSpy spy3(process.data(), static_cast<QProcessFinishedSignal2>(&QProcess::finished));
QVERIFY(spy.isValid());
QVERIFY(spy2.isValid());
@@ -376,8 +385,8 @@ void tst_QProcess::crashTest()
QCOMPARE(process->exitStatus(), QProcess::CrashExit);
- delete process;
- process = 0;
+ // delete process;
+ process.reset();
QCOMPARE(stateSpy.count(), 3);
QCOMPARE(qvariant_cast<QProcess::ProcessState>(stateSpy.at(0).at(0)), QProcess::Starting);
@@ -387,20 +396,21 @@ void tst_QProcess::crashTest()
void tst_QProcess::crashTest2()
{
- process = new QProcess;
- process->start("testProcessCrash/testProcessCrash");
- QVERIFY(process->waitForStarted(5000));
+ QProcess process;
+ process.start("testProcessCrash/testProcessCrash");
+ QVERIFY(process.waitForStarted(5000));
qRegisterMetaType<QProcess::ProcessError>("QProcess::ProcessError");
qRegisterMetaType<QProcess::ExitStatus>("QProcess::ExitStatus");
- QSignalSpy spy(process, static_cast<void (QProcess::*)(QProcess::ProcessError)>(&QProcess::errorOccurred));
- QSignalSpy spy2(process, static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished));
+ QSignalSpy spy(&process, static_cast<QProcessErrorSignal>(&QProcess::errorOccurred));
+ QSignalSpy spy2(&process, static_cast<QProcessFinishedSignal2>(&QProcess::finished));
QVERIFY(spy.isValid());
QVERIFY(spy2.isValid());
- QObject::connect(process, SIGNAL(finished(int)), this, SLOT(exitLoopSlot()));
+ QObject::connect(&process, static_cast<QProcessFinishedSignal1>(&QProcess::finished),
+ this, &tst_QProcess::exitLoopSlot);
QTestEventLoop::instance().enterLoop(30);
if (QTestEventLoop::instance().timeout())
@@ -412,10 +422,7 @@ void tst_QProcess::crashTest2()
QCOMPARE(spy2.count(), 1);
QCOMPARE(*static_cast<const QProcess::ExitStatus *>(spy2.at(0).at(1).constData()), QProcess::CrashExit);
- QCOMPARE(process->exitStatus(), QProcess::CrashExit);
-
- delete process;
- process = 0;
+ QCOMPARE(process.exitStatus(), QProcess::CrashExit);
}
#ifndef Q_OS_WINCE
@@ -438,24 +445,24 @@ void tst_QProcess::echoTest()
{
QFETCH(QByteArray, input);
- process = new QProcess;
- connect(process, SIGNAL(readyRead()), this, SLOT(exitLoopSlot()));
+ QProcess process;
+ connect(&process, &QIODevice::readyRead, this, &tst_QProcess::exitLoopSlot);
- process->start("testProcessEcho/testProcessEcho");
- QVERIFY(process->waitForStarted(5000));
+ process.start("testProcessEcho/testProcessEcho");
+ QVERIFY(process.waitForStarted(5000));
- process->write(input);
+ process.write(input);
QTime stopWatch;
stopWatch.start();
do {
- QVERIFY(process->isOpen());
+ QVERIFY(process.isOpen());
QTestEventLoop::instance().enterLoop(2);
- } while (stopWatch.elapsed() < 60000 && process->bytesAvailable() < input.size());
+ } while (stopWatch.elapsed() < 60000 && process.bytesAvailable() < input.size());
if (stopWatch.elapsed() >= 60000)
QFAIL("Timed out");
- QByteArray message = process->readAll();
+ QByteArray message = process.readAll();
QCOMPARE(message.size(), input.size());
char *c1 = message.data();
@@ -468,13 +475,11 @@ void tst_QProcess::echoTest()
}
QCOMPARE(*c1, *c2);
- process->write("", 1);
-
- QVERIFY(process->waitForFinished(5000));
-
+ process.write("", 1);
- delete process;
- process = 0;
+ QVERIFY(process.waitForFinished(5000));
+ QCOMPARE(process.exitStatus(), QProcess::NormalExit);
+ QCOMPARE(process.exitCode(), 0);
}
#endif
@@ -488,17 +493,17 @@ void tst_QProcess::exitLoopSlot()
void tst_QProcess::echoTest2()
{
- process = new QProcess;
- connect(process, SIGNAL(readyRead()), this, SLOT(exitLoopSlot()));
+ QProcess process;
+ connect(&process, &QIODevice::readyRead, this, &tst_QProcess::exitLoopSlot);
- process->start("testProcessEcho2/testProcessEcho2");
- QVERIFY(process->waitForStarted(5000));
- QVERIFY(!process->waitForReadyRead(250));
- QCOMPARE(process->error(), QProcess::Timedout);
+ process.start("testProcessEcho2/testProcessEcho2");
+ QVERIFY(process.waitForStarted(5000));
+ QVERIFY(!process.waitForReadyRead(250));
+ QCOMPARE(process.error(), QProcess::Timedout);
- process->write("Hello");
- QSignalSpy spy1(process, &QProcess::readyReadStandardOutput);
- QSignalSpy spy2(process, &QProcess::readyReadStandardError);
+ process.write("Hello");
+ QSignalSpy spy1(&process, &QProcess::readyReadStandardOutput);
+ QSignalSpy spy2(&process, &QProcess::readyReadStandardError);
QVERIFY(spy1.isValid());
QVERIFY(spy2.isValid());
@@ -509,11 +514,11 @@ void tst_QProcess::echoTest2()
QTestEventLoop::instance().enterLoop(1);
if (stopWatch.elapsed() >= 30000)
QFAIL("Timed out");
- process->setReadChannel(QProcess::StandardOutput);
- qint64 baso = process->bytesAvailable();
+ process.setReadChannel(QProcess::StandardOutput);
+ qint64 baso = process.bytesAvailable();
- process->setReadChannel(QProcess::StandardError);
- qint64 base = process->bytesAvailable();
+ process.setReadChannel(QProcess::StandardError);
+ qint64 base = process.bytesAvailable();
if (baso == 5 && base == 5)
break;
}
@@ -521,14 +526,13 @@ void tst_QProcess::echoTest2()
QVERIFY(spy1.count() > 0);
QVERIFY(spy2.count() > 0);
- QCOMPARE(process->readAllStandardOutput(), QByteArray("Hello"));
- QCOMPARE(process->readAllStandardError(), QByteArray("Hello"));
-
- process->write("", 1);
- QVERIFY(process->waitForFinished(5000));
+ QCOMPARE(process.readAllStandardOutput(), QByteArray("Hello"));
+ QCOMPARE(process.readAllStandardError(), QByteArray("Hello"));
- delete process;
- process = 0;
+ process.write("", 1);
+ QVERIFY(process.waitForFinished(5000));
+ QCOMPARE(process.exitStatus(), QProcess::NormalExit);
+ QCOMPARE(process.exitCode(), 0);
}
#endif
@@ -545,6 +549,8 @@ void tst_QProcess::echoTestGui()
process.write("q");
QVERIFY(process.waitForFinished(50000));
+ QCOMPARE(process.exitStatus(), QProcess::NormalExit);
+ QCOMPARE(process.exitCode(), 0);
QCOMPARE(process.readAllStandardOutput(), QByteArray("Hello"));
QCOMPARE(process.readAllStandardError(), QByteArray("Hello"));
@@ -583,6 +589,8 @@ void tst_QProcess::batFiles()
proc.start(batFile, QStringList());
QVERIFY(proc.waitForFinished(5000));
+ QCOMPARE(proc.exitStatus(), QProcess::NormalExit);
+ QCOMPARE(proc.exitCode(), 0);
QVERIFY(proc.bytesAvailable() > 0);
@@ -616,21 +624,18 @@ void tst_QProcess::exitStatus_data()
void tst_QProcess::exitStatus()
{
- process = new QProcess;
+ QProcess process;
QFETCH(QStringList, processList);
QFETCH(QList<QProcess::ExitStatus>, exitStatus);
QCOMPARE(exitStatus.count(), processList.count());
for (int i = 0; i < processList.count(); ++i) {
- process->start(processList.at(i));
- QVERIFY(process->waitForStarted(5000));
- QVERIFY(process->waitForFinished(30000));
+ process.start(processList.at(i));
+ QVERIFY(process.waitForStarted(5000));
+ QVERIFY(process.waitForFinished(30000));
- QCOMPARE(process->exitStatus(), exitStatus.at(i));
+ QCOMPARE(process.exitStatus(), exitStatus.at(i));
}
-
- process->deleteLater();
- process = 0;
}
#ifndef Q_OS_WINCE
@@ -638,23 +643,22 @@ void tst_QProcess::exitStatus()
void tst_QProcess::loopBackTest()
{
- process = new QProcess;
- process->start("testProcessEcho/testProcessEcho");
- QVERIFY(process->waitForStarted(5000));
+ QProcess process;
+ process.start("testProcessEcho/testProcessEcho");
+ QVERIFY(process.waitForStarted(5000));
for (int i = 0; i < 100; ++i) {
- process->write("Hello");
+ process.write("Hello");
do {
- QVERIFY(process->waitForReadyRead(5000));
- } while (process->bytesAvailable() < 5);
- QCOMPARE(process->readAll(), QByteArray("Hello"));
+ QVERIFY(process.waitForReadyRead(5000));
+ } while (process.bytesAvailable() < 5);
+ QCOMPARE(process.readAll(), QByteArray("Hello"));
}
- process->write("", 1);
- QVERIFY(process->waitForFinished(5000));
-
- delete process;
- process = 0;
+ process.write("", 1);
+ QVERIFY(process.waitForFinished(5000));
+ QCOMPARE(process.exitStatus(), QProcess::NormalExit);
+ QCOMPARE(process.exitCode(), 0);
}
#endif
@@ -663,35 +667,32 @@ void tst_QProcess::loopBackTest()
void tst_QProcess::readTimeoutAndThenCrash()
{
- process = new QProcess;
- process->start("testProcessEcho/testProcessEcho");
- if (process->state() != QProcess::Starting)
- QCOMPARE(process->state(), QProcess::Running);
+ QProcess process;
+ process.start("testProcessEcho/testProcessEcho");
+ if (process.state() != QProcess::Starting)
+ QCOMPARE(process.state(), QProcess::Running);
- QVERIFY(process->waitForStarted(5000));
- QCOMPARE(process->state(), QProcess::Running);
+ QVERIFY(process.waitForStarted(5000));
+ QCOMPARE(process.state(), QProcess::Running);
- QVERIFY(!process->waitForReadyRead(5000));
- QCOMPARE(process->error(), QProcess::Timedout);
+ QVERIFY(!process.waitForReadyRead(5000));
+ QCOMPARE(process.error(), QProcess::Timedout);
qRegisterMetaType<QProcess::ProcessError>("QProcess::ProcessError");
- QSignalSpy spy(process, &QProcess::errorOccurred);
- QSignalSpy spy2(process, static_cast<void (QProcess::*)(QProcess::ProcessError)>(&QProcess::error));
+ QSignalSpy spy(&process, &QProcess::errorOccurred);
+ QSignalSpy spy2(&process, static_cast<QProcessErrorSignal>(&QProcess::error));
QVERIFY(spy.isValid());
QVERIFY(spy2.isValid());
- process->kill();
+ process.kill();
- QVERIFY(process->waitForFinished(5000));
- QCOMPARE(process->state(), QProcess::NotRunning);
+ QVERIFY(process.waitForFinished(5000));
+ QCOMPARE(process.state(), QProcess::NotRunning);
QCOMPARE(spy.count(), 1);
QCOMPARE(*static_cast<const QProcess::ProcessError *>(spy.at(0).at(0).constData()), QProcess::Crashed);
QCOMPARE(spy2.count(), 1);
QCOMPARE(*static_cast<const QProcess::ProcessError *>(spy2.at(0).at(0).constData()), QProcess::Crashed);
-
- delete process;
- process = 0;
}
#endif
@@ -738,6 +739,8 @@ void tst_QProcess::deadWhileReading()
QCOMPARE(output.count("\n"), 10*1024);
process.waitForFinished();
+ QCOMPARE(process.exitStatus(), QProcess::NormalExit);
+ QCOMPARE(process.exitCode(), 0);
}
#endif
@@ -749,23 +752,27 @@ void tst_QProcess::restartProcessDeadlock()
// The purpose of this test is to detect whether restarting a
// process in the finished() connected slot causes a deadlock
// because of the way QProcessManager uses its locks.
- QProcess proc;
- process = &proc;
- connect(process, SIGNAL(finished(int)), this, SLOT(restartProcess()));
+ QProcess process;
+ connect(&process, static_cast<QProcessFinishedSignal1>(&QProcess::finished),
+ this, &tst_QProcess::restartProcess);
- process->start("testProcessEcho/testProcessEcho");
+ process.start("testProcessEcho/testProcessEcho");
- QCOMPARE(process->write("", 1), qlonglong(1));
- QVERIFY(process->waitForFinished(5000));
+ QCOMPARE(process.write("", 1), qlonglong(1));
+ QVERIFY(process.waitForFinished(5000));
- process->disconnect(SIGNAL(finished(int)));
+ QObject::disconnect(&process, static_cast<QProcessFinishedSignal1>(&QProcess::finished), Q_NULLPTR, Q_NULLPTR);
- QCOMPARE(process->write("", 1), qlonglong(1));
- QVERIFY(process->waitForFinished(5000));
+ QCOMPARE(process.write("", 1), qlonglong(1));
+ QVERIFY(process.waitForFinished(5000));
+ QCOMPARE(process.exitStatus(), QProcess::NormalExit);
+ QCOMPARE(process.exitCode(), 0);
}
void tst_QProcess::restartProcess()
{
+ QProcess *process = qobject_cast<QProcess *>(sender());
+ QVERIFY(process);
process->start("testProcessEcho/testProcessEcho");
}
#endif
@@ -794,6 +801,8 @@ void tst_QProcess::closeWriteChannel()
if (more.state() == QProcess::Running)
more.write("q");
QVERIFY(more.waitForFinished(5000));
+ QCOMPARE(more.exitStatus(), QProcess::NormalExit);
+ QCOMPARE(more.exitCode(), 0);
}
#endif
@@ -824,6 +833,8 @@ void tst_QProcess::closeReadChannel()
proc.write("", 1);
QVERIFY(proc.waitForFinished(5000));
+ QCOMPARE(proc.exitStatus(), QProcess::NormalExit);
+ QCOMPARE(proc.exitCode(), 0);
}
}
#endif
@@ -878,7 +889,7 @@ void tst_QProcess::emitReadyReadOnlyWhenNewDataArrives()
{
QProcess proc;
- connect(&proc, SIGNAL(readyRead()), this, SLOT(exitLoopSlot()));
+ connect(&proc, &QIODevice::readyRead, this, &tst_QProcess::exitLoopSlot);
QSignalSpy spy(&proc, &QProcess::readyRead);
QVERIFY(spy.isValid());
@@ -898,12 +909,14 @@ void tst_QProcess::emitReadyReadOnlyWhenNewDataArrives()
QVERIFY(QTestEventLoop::instance().timeout());
QVERIFY(!proc.waitForReadyRead(250));
- QObject::disconnect(&proc, SIGNAL(readyRead()), 0, 0);
+ QObject::disconnect(&proc, &QIODevice::readyRead, Q_NULLPTR, Q_NULLPTR);
proc.write("B");
QVERIFY(proc.waitForReadyRead(5000));
proc.write("", 1);
QVERIFY(proc.waitForFinished(5000));
+ QCOMPARE(proc.exitStatus(), QProcess::NormalExit);
+ QCOMPARE(proc.exitCode(), 0);
}
#endif
@@ -960,30 +973,30 @@ public:
SoftExitProcess(int n) : waitedForFinished(false), n(n), killing(false)
{
- connect(this, SIGNAL(finished(int,QProcess::ExitStatus)),
- this, SLOT(finishedSlot(int,QProcess::ExitStatus)));
+ connect(this, static_cast<QProcessFinishedSignal2>(&QProcess::finished),
+ this, &SoftExitProcess::finishedSlot);
switch (n) {
case 0:
setReadChannelMode(QProcess::MergedChannels);
- connect(this, SIGNAL(readyRead()), this, SLOT(terminateSlot()));
+ connect(this, &QIODevice::readyRead, this, &SoftExitProcess::terminateSlot);
break;
case 1:
- connect(this, SIGNAL(readyReadStandardOutput()),
- this, SLOT(terminateSlot()));
+ connect(this, &QProcess::readyReadStandardOutput,
+ this, &SoftExitProcess::terminateSlot);
break;
case 2:
- connect(this, SIGNAL(readyReadStandardError()),
- this, SLOT(terminateSlot()));
+ connect(this, &QProcess::readyReadStandardError,
+ this, &SoftExitProcess::terminateSlot);
break;
case 3:
- connect(this, SIGNAL(started()),
- this, SLOT(terminateSlot()));
+ connect(this, &QProcess::started,
+ this, &SoftExitProcess::terminateSlot);
break;
case 4:
default:
- connect(this, SIGNAL(stateChanged(QProcess::ProcessState)),
- this, SLOT(terminateSlot()));
+ connect(this, &QProcess::stateChanged,
+ this, &SoftExitProcess::terminateSlot);
break;
}
}
@@ -1084,6 +1097,8 @@ void tst_QProcess::mergedChannels()
process.closeWriteChannel();
QVERIFY(process.waitForFinished(5000));
+ QCOMPARE(process.exitStatus(), QProcess::NormalExit);
+ QCOMPARE(process.exitCode(), 0);
}
#endif
@@ -1122,6 +1137,8 @@ void tst_QProcess::forwardedChannels()
QCOMPARE(process.write("input"), 5);
process.closeWriteChannel();
QVERIFY(process.waitForFinished(5000));
+ QCOMPARE(process.exitStatus(), QProcess::NormalExit);
+ QCOMPARE(process.exitCode(), 0);
const char *err;
switch (process.exitCode()) {
case 0: err = "ok"; break;
@@ -1161,6 +1178,8 @@ void tst_QProcess::atEnd()
process.write("", 1);
QVERIFY(process.waitForFinished(5000));
+ QCOMPARE(process.exitStatus(), QProcess::NormalExit);
+ QCOMPARE(process.exitCode(), 0);
}
#endif
@@ -1179,8 +1198,8 @@ protected:
exitCode = 90210;
QProcess process;
- connect(&process, SIGNAL(finished(int)), this, SLOT(catchExitCode(int)),
- Qt::DirectConnection);
+ connect(&process, static_cast<QProcessFinishedSignal1>(&QProcess::finished),
+ this, &TestThread::catchExitCode, Qt::DirectConnection);
process.start("testProcessEcho/testProcessEcho");
@@ -1239,19 +1258,16 @@ void tst_QProcess::processesInMultipleThreads()
// Reading and writing to a process is not supported on Qt/CE
void tst_QProcess::waitForFinishedWithTimeout()
{
- process = new QProcess(this);
-
- process->start("testProcessEcho/testProcessEcho");
+ QProcess process;
- QVERIFY(process->waitForStarted(5000));
- QVERIFY(!process->waitForFinished(1));
+ process.start("testProcessEcho/testProcessEcho");
- process->write("", 1);
+ QVERIFY(process.waitForStarted(5000));
+ QVERIFY(!process.waitForFinished(1));
- QVERIFY(process->waitForFinished());
+ process.write("", 1);
- delete process;
- process = 0;
+ QVERIFY(process.waitForFinished());
}
#endif
@@ -1259,27 +1275,28 @@ void tst_QProcess::waitForFinishedWithTimeout()
// Reading and writing to a process is not supported on Qt/CE
void tst_QProcess::waitForReadyReadInAReadyReadSlot()
{
- process = new QProcess(this);
- connect(process, SIGNAL(readyRead()), this, SLOT(waitForReadyReadInAReadyReadSlotSlot()));
- connect(process, SIGNAL(finished(int)), this, SLOT(exitLoopSlot()));
+ QProcess process;
+ connect(&process, &QIODevice::readyRead, this, &tst_QProcess::waitForReadyReadInAReadyReadSlotSlot);
+ connect(&process, static_cast<QProcessFinishedSignal1>(&QProcess::finished),
+ this, &tst_QProcess::exitLoopSlot);
bytesAvailable = 0;
- process->start("testProcessEcho/testProcessEcho");
- QVERIFY(process->waitForStarted(5000));
+ process.start("testProcessEcho/testProcessEcho");
+ QVERIFY(process.waitForStarted(5000));
- QSignalSpy spy(process, &QProcess::readyRead);
+ QSignalSpy spy(&process, &QProcess::readyRead);
QVERIFY(spy.isValid());
- process->write("foo");
+ process.write("foo");
QTestEventLoop::instance().enterLoop(30);
QVERIFY(!QTestEventLoop::instance().timeout());
QCOMPARE(spy.count(), 1);
- process->disconnect();
- QVERIFY(process->waitForFinished(5000));
- QVERIFY(process->bytesAvailable() > bytesAvailable);
- delete process;
- process = 0;
+ process.disconnect();
+ QVERIFY(process.waitForFinished(5000));
+ QCOMPARE(process.exitStatus(), QProcess::NormalExit);
+ QCOMPARE(process.exitCode(), 0);
+ QVERIFY(process.bytesAvailable() > bytesAvailable);
}
#endif
@@ -1287,6 +1304,8 @@ void tst_QProcess::waitForReadyReadInAReadyReadSlot()
// Reading and writing to a process is not supported on Qt/CE
void tst_QProcess::waitForReadyReadInAReadyReadSlotSlot()
{
+ QProcess *process = qobject_cast<QProcess *>(sender());
+ QVERIFY(process);
bytesAvailable = process->bytesAvailable();
process->write("bar", 4);
QVERIFY(process->waitForReadyRead(5000));
@@ -1298,25 +1317,25 @@ void tst_QProcess::waitForReadyReadInAReadyReadSlotSlot()
// Reading and writing to a process is not supported on Qt/CE
void tst_QProcess::waitForBytesWrittenInABytesWrittenSlot()
{
- process = new QProcess(this);
- connect(process, SIGNAL(bytesWritten(qint64)), this, SLOT(waitForBytesWrittenInABytesWrittenSlotSlot()));
+ QProcess process;
+ connect(&process, &QIODevice::bytesWritten, this, &tst_QProcess::waitForBytesWrittenInABytesWrittenSlotSlot);
bytesAvailable = 0;
- process->start("testProcessEcho/testProcessEcho");
- QVERIFY(process->waitForStarted(5000));
+ process.start("testProcessEcho/testProcessEcho");
+ QVERIFY(process.waitForStarted(5000));
- QSignalSpy spy(process, &QProcess::bytesWritten);
+ QSignalSpy spy(&process, &QProcess::bytesWritten);
QVERIFY(spy.isValid());
- process->write("f");
+ process.write("f");
QTestEventLoop::instance().enterLoop(30);
QVERIFY(!QTestEventLoop::instance().timeout());
QCOMPARE(spy.count(), 1);
- process->write("", 1);
- process->disconnect();
- QVERIFY(process->waitForFinished());
- delete process;
- process = 0;
+ process.write("", 1);
+ process.disconnect();
+ QVERIFY(process.waitForFinished());
+ QCOMPARE(process.exitStatus(), QProcess::NormalExit);
+ QCOMPARE(process.exitCode(), 0);
}
#endif
@@ -1324,6 +1343,8 @@ void tst_QProcess::waitForBytesWrittenInABytesWrittenSlot()
// Reading and writing to a process is not supported on Qt/CE
void tst_QProcess::waitForBytesWrittenInABytesWrittenSlotSlot()
{
+ QProcess *process = qobject_cast<QProcess *>(sender());
+ QVERIFY(process);
process->write("b");
QVERIFY(process->waitForBytesWritten(5000));
QTestEventLoop::instance().exitLoop();
@@ -1392,11 +1413,11 @@ void tst_QProcess::spaceArgsTest()
<< QString::fromLatin1("testProcessSpacesArgs/one space")
<< QString::fromLatin1("testProcessSpacesArgs/two space s");
- process = new QProcess(this);
+ QProcess process;
for (int i = 0; i < programs.size(); ++i) {
QString program = programs.at(i);
- process->start(program, args);
+ process.start(program, args);
#if defined(Q_OS_WINCE)
const int timeOutMS = 10000;
@@ -1404,14 +1425,16 @@ void tst_QProcess::spaceArgsTest()
const int timeOutMS = 5000;
#endif
QByteArray errorMessage;
- bool started = process->waitForStarted(timeOutMS);
+ bool started = process.waitForStarted(timeOutMS);
if (!started)
- errorMessage = startFailMessage(program, *process);
+ errorMessage = startFailMessage(program, process);
QVERIFY2(started, errorMessage.constData());
- QVERIFY(process->waitForFinished(timeOutMS));
+ QVERIFY(process.waitForFinished(timeOutMS));
+ QCOMPARE(process.exitStatus(), QProcess::NormalExit);
+ QCOMPARE(process.exitCode(), 0);
#if !defined(Q_OS_WINCE)
- QStringList actual = QString::fromLatin1(process->readAll()).split("|");
+ QStringList actual = QString::fromLatin1(process.readAll()).split("|");
#endif
#if !defined(Q_OS_WINCE)
QVERIFY(!actual.isEmpty());
@@ -1428,16 +1451,16 @@ void tst_QProcess::spaceArgsTest()
program += QLatin1Char(' ') + stringArgs;
errorMessage.clear();
- process->start(program);
- started = process->waitForStarted(5000);
+ process.start(program);
+ started = process.waitForStarted(5000);
if (!started)
- errorMessage = startFailMessage(program, *process);
+ errorMessage = startFailMessage(program, process);
QVERIFY2(started, errorMessage.constData());
- QVERIFY(process->waitForFinished(5000));
+ QVERIFY(process.waitForFinished(5000));
#if !defined(Q_OS_WINCE)
- actual = QString::fromLatin1(process->readAll()).split("|");
+ actual = QString::fromLatin1(process.readAll()).split("|");
#endif
#if !defined(Q_OS_WINCE)
QVERIFY(!actual.isEmpty());
@@ -1447,9 +1470,6 @@ void tst_QProcess::spaceArgsTest()
QCOMPARE(actual, args);
#endif
}
-
- delete process;
- process = 0;
}
#if defined(Q_OS_WIN)
@@ -1471,6 +1491,8 @@ void tst_QProcess::nativeArguments()
QVERIFY(proc.waitForStarted(10000));
QVERIFY(proc.waitForFinished(10000));
#endif
+ QCOMPARE(proc.exitStatus(), QProcess::NormalExit);
+ QCOMPARE(proc.exitCode(), 0);
#if defined(Q_OS_WINCE)
// WinCE test outputs to a file, so check that
@@ -1525,9 +1547,9 @@ void tst_QProcess::failToStart()
QProcess process;
QSignalSpy stateSpy(&process, &QProcess::stateChanged);
QSignalSpy errorSpy(&process, &QProcess::errorOccurred);
- QSignalSpy errorSpy2(&process, static_cast<void (QProcess::*)(QProcess::ProcessError)>(&QProcess::error));
- QSignalSpy finishedSpy(&process, static_cast<void (QProcess::*)(int)>(&QProcess::finished));
- QSignalSpy finishedSpy2(&process, static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished));
+ QSignalSpy errorSpy2(&process, static_cast<QProcessErrorSignal>(&QProcess::error));
+ QSignalSpy finishedSpy(&process, static_cast<QProcessFinishedSignal1>(&QProcess::finished));
+ QSignalSpy finishedSpy2(&process, static_cast<QProcessFinishedSignal2>(&QProcess::finished));
QVERIFY(stateSpy.isValid());
QVERIFY(errorSpy.isValid());
@@ -1597,9 +1619,9 @@ void tst_QProcess::failToStartWithWait()
QProcess process;
QEventLoop loop;
QSignalSpy errorSpy(&process, &QProcess::errorOccurred);
- QSignalSpy errorSpy2(&process, static_cast<void (QProcess::*)(QProcess::ProcessError)>(&QProcess::error));
- QSignalSpy finishedSpy(&process, static_cast<void (QProcess::*)(int)>(&QProcess::finished));
- QSignalSpy finishedSpy2(&process, static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished));
+ QSignalSpy errorSpy2(&process, static_cast<QProcessErrorSignal>(&QProcess::error));
+ QSignalSpy finishedSpy(&process, static_cast<QProcessFinishedSignal1>(&QProcess::finished));
+ QSignalSpy finishedSpy2(&process, static_cast<QProcessFinishedSignal2>(&QProcess::finished));
QVERIFY(errorSpy.isValid());
QVERIFY(errorSpy2.isValid());
@@ -1629,9 +1651,9 @@ void tst_QProcess::failToStartWithEventLoop()
QProcess process;
QEventLoop loop;
QSignalSpy errorSpy(&process, &QProcess::errorOccurred);
- QSignalSpy errorSpy2(&process, static_cast<void (QProcess::*)(QProcess::ProcessError)>(&QProcess::error));
- QSignalSpy finishedSpy(&process, static_cast<void (QProcess::*)(int)>(&QProcess::finished));
- QSignalSpy finishedSpy2(&process, static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished));
+ QSignalSpy errorSpy2(&process, static_cast<QProcessErrorSignal>(&QProcess::error));
+ QSignalSpy finishedSpy(&process, static_cast<QProcessFinishedSignal1>(&QProcess::finished));
+ QSignalSpy finishedSpy2(&process, static_cast<QProcessFinishedSignal2>(&QProcess::finished));
QVERIFY(errorSpy.isValid());
QVERIFY(errorSpy2.isValid());
@@ -1669,7 +1691,7 @@ void tst_QProcess::failToStartEmptyArgs()
qRegisterMetaType<QProcess::ProcessError>("QProcess::ProcessError");
QProcess process;
- QSignalSpy errorSpy(&process, static_cast<void (QProcess::*)(QProcess::ProcessError)>(&QProcess::error));
+ QSignalSpy errorSpy(&process, static_cast<QProcessErrorSignal>(&QProcess::error));
QVERIFY(errorSpy.isValid());
switch (startOverload) {
@@ -1707,6 +1729,8 @@ void tst_QProcess::removeFileWhileProcessIsRunning()
process.write("", 1);
QVERIFY(process.waitForFinished(5000));
+ QCOMPARE(process.exitStatus(), QProcess::NormalExit);
+ QCOMPARE(process.exitCode(), 0);
}
#endif
#ifndef Q_OS_WINCE
@@ -1851,6 +1875,8 @@ void tst_QProcess::spaceInName()
QVERIFY(process.waitForStarted());
process.write("", 1);
QVERIFY(process.waitForFinished());
+ QCOMPARE(process.exitStatus(), QProcess::NormalExit);
+ QCOMPARE(process.exitCode(), 0);
}
#endif
@@ -1893,9 +1919,9 @@ void tst_QProcess::waitForReadyReadForNonexistantProcess()
QProcess process;
QSignalSpy errorSpy(&process, &QProcess::errorOccurred);
- QSignalSpy errorSpy2(&process, static_cast<void (QProcess::*)(QProcess::ProcessError)>(&QProcess::error));
- QSignalSpy finishedSpy1(&process, static_cast<void (QProcess::*)(int)>(&QProcess::finished));
- QSignalSpy finishedSpy2(&process, static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished));
+ QSignalSpy errorSpy2(&process, static_cast<QProcessErrorSignal>(&QProcess::error));
+ QSignalSpy finishedSpy1(&process, static_cast<QProcessFinishedSignal1>(&QProcess::finished));
+ QSignalSpy finishedSpy2(&process, static_cast<QProcessFinishedSignal2>(&QProcess::finished));
QVERIFY(errorSpy.isValid());
QVERIFY(errorSpy2.isValid());
@@ -1932,6 +1958,8 @@ void tst_QProcess::setStandardInputFile()
process.start("testProcessEcho/testProcessEcho");
QPROCESS_VERIFY(process, waitForFinished());
+ QCOMPARE(process.exitStatus(), QProcess::NormalExit);
+ QCOMPARE(process.exitCode(), 0);
QByteArray all = process.readAll();
QCOMPARE(all.size(), int(sizeof data) - 1); // testProcessEcho drops the ending \0
QVERIFY(all == data);
@@ -2004,6 +2032,8 @@ void tst_QProcess::setStandardOutputFile()
process.start("testProcessEcho2/testProcessEcho2");
process.write(testdata, sizeof testdata);
QPROCESS_VERIFY(process,waitForFinished());
+ QCOMPARE(process.exitStatus(), QProcess::NormalExit);
+ QCOMPARE(process.exitCode(), 0);
// open the file again and verify the data
QVERIFY(file.open(QIODevice::ReadOnly));
@@ -2033,6 +2063,8 @@ void tst_QProcess::setStandardOutputFileNullDevice()
process.start("testProcessEcho2/testProcessEcho2");
process.write(testdata, sizeof testdata);
QPROCESS_VERIFY(process,waitForFinished());
+ QCOMPARE(process.exitStatus(), QProcess::NormalExit);
+ QCOMPARE(process.exitCode(), 0);
QCOMPARE(process.bytesAvailable(), Q_INT64_C(0));
QVERIFY(!QFileInfo(QProcess::nullDevice()).isFile());
@@ -2049,6 +2081,8 @@ void tst_QProcess::setStandardOutputFileAndWaitForBytesWritten()
process.write(testdata, sizeof testdata);
process.waitForBytesWritten();
QPROCESS_VERIFY(process, waitForFinished());
+ QCOMPARE(process.exitStatus(), QProcess::NormalExit);
+ QCOMPARE(process.exitCode(), 0);
// open the file again and verify the data
QVERIFY(file.open(QIODevice::ReadOnly));
@@ -2089,7 +2123,11 @@ void tst_QProcess::setStandardOutputProcess()
source.waitForBytesWritten();
source.closeWriteChannel();
QPROCESS_VERIFY(source, waitForFinished());
+ QCOMPARE(source.exitStatus(), QProcess::NormalExit);
+ QCOMPARE(source.exitCode(), 0);
QPROCESS_VERIFY(sink, waitForFinished());
+ QCOMPARE(sink.exitStatus(), QProcess::NormalExit);
+ QCOMPARE(sink.exitCode(), 0);
QByteArray all = sink.readAll();
if (!merged)
@@ -2103,25 +2141,34 @@ void tst_QProcess::setStandardOutputProcess()
// Reading and writing to a process is not supported on Qt/CE
void tst_QProcess::fileWriterProcess()
{
- QString stdinStr;
- for (int i = 0; i < 5000; ++i)
- stdinStr += QString::fromLatin1("%1 -- testing testing 1 2 3\n").arg(i);
+ const QByteArray line = QByteArrayLiteral(" -- testing testing 1 2 3\n");
+ QByteArray stdinStr;
+ stdinStr.reserve(5000 * (4 + line.size()) + 1);
+ for (int i = 0; i < 5000; ++i) {
+ stdinStr += QByteArray::number(i);
+ stdinStr += line;
+ }
QTime stopWatch;
stopWatch.start();
+ const QString fileName = QLatin1String("fileWriterProcess.txt");
+
do {
- QFile::remove("fileWriterProcess.txt");
+ if (QFile::exists(fileName))
+ QVERIFY(QFile::remove(fileName));
QProcess process;
process.start("fileWriterProcess/fileWriterProcess",
QIODevice::ReadWrite | QIODevice::Text);
- process.write(stdinStr.toLatin1());
+ process.write(stdinStr);
process.closeWriteChannel();
while (process.bytesToWrite()) {
QVERIFY(stopWatch.elapsed() < 3500);
QVERIFY(process.waitForBytesWritten(2000));
}
QVERIFY(process.waitForFinished());
- QCOMPARE(QFile("fileWriterProcess.txt").size(), qint64(stdinStr.size()));
+ QCOMPARE(process.exitStatus(), QProcess::NormalExit);
+ QCOMPARE(process.exitCode(), 0);
+ QCOMPARE(QFile(fileName).size(), qint64(stdinStr.size()));
} while (stopWatch.elapsed() < 3000);
}
#endif
@@ -2181,6 +2228,8 @@ void tst_QProcess::switchReadChannels()
process.write(data);
process.closeWriteChannel();
QVERIFY(process.waitForFinished(5000));
+ QCOMPARE(process.exitStatus(), QProcess::NormalExit);
+ QCOMPARE(process.exitCode(), 0);
for (int i = 0; i < 4; ++i) {
process.setReadChannel(QProcess::StandardOutput);
@@ -2210,6 +2259,8 @@ void tst_QProcess::discardUnwantedOutput()
process.write("Hello, World");
process.closeWriteChannel();
QVERIFY(process.waitForFinished(5000));
+ QCOMPARE(process.exitStatus(), QProcess::NormalExit);
+ QCOMPARE(process.exitCode(), 0);
process.setReadChannel(QProcess::StandardOutput);
QCOMPARE(process.bytesAvailable(), Q_INT64_C(0));
@@ -2223,45 +2274,41 @@ void tst_QProcess::discardUnwantedOutput()
// Windows CE does not support working directory logic
void tst_QProcess::setWorkingDirectory()
{
- process = new QProcess;
- process->setWorkingDirectory("test");
+ QProcess process;
+ process.setWorkingDirectory("test");
// use absolute path because on Windows, the executable is relative to the parent's CWD
// while on Unix with fork it's relative to the child's (with posix_spawn, it could be either).
- process->start(QFileInfo("testSetWorkingDirectory/testSetWorkingDirectory").absoluteFilePath());
+ process.start(QFileInfo("testSetWorkingDirectory/testSetWorkingDirectory").absoluteFilePath());
- QVERIFY2(process->waitForFinished(), process->errorString().toLocal8Bit());
+ QVERIFY2(process.waitForFinished(), process.errorString().toLocal8Bit());
+ QCOMPARE(process.exitStatus(), QProcess::NormalExit);
+ QCOMPARE(process.exitCode(), 0);
- QByteArray workingDir = process->readAllStandardOutput();
+ QByteArray workingDir = process.readAllStandardOutput();
QCOMPARE(QDir("test").canonicalPath(), QDir(workingDir.constData()).canonicalPath());
-
- delete process;
- process = 0;
}
void tst_QProcess::setNonExistentWorkingDirectory()
{
- process = new QProcess;
- process->setWorkingDirectory("this/directory/should/not/exist/for/sure");
+ QProcess process;
+ process.setWorkingDirectory("this/directory/should/not/exist/for/sure");
// use absolute path because on Windows, the executable is relative to the parent's CWD
// while on Unix with fork it's relative to the child's (with posix_spawn, it could be either).
- process->start(QFileInfo("testSetWorkingDirectory/testSetWorkingDirectory").absoluteFilePath());
- QVERIFY(!process->waitForFinished());
+ process.start(QFileInfo("testSetWorkingDirectory/testSetWorkingDirectory").absoluteFilePath());
+ QVERIFY(!process.waitForFinished());
#ifdef QPROCESS_USE_SPAWN
QEXPECT_FAIL("", "QProcess cannot detect failure to start when using posix_spawn()", Continue);
#endif
- QCOMPARE(int(process->error()), int(QProcess::FailedToStart));
+ QCOMPARE(int(process.error()), int(QProcess::FailedToStart));
#ifdef Q_OS_UNIX
# ifdef QPROCESS_USE_SPAWN
QEXPECT_FAIL("", "QProcess cannot detect failure to start when using posix_spawn()", Continue);
# endif
- QVERIFY2(process->errorString().startsWith("chdir:"), process->errorString().toLocal8Bit());
+ QVERIFY2(process.errorString().startsWith("chdir:"), process.errorString().toLocal8Bit());
#endif
-
- delete process;
- process = 0;
}
#endif
@@ -2278,8 +2325,11 @@ void tst_QProcess::startFinishStartFinish()
QCOMPARE(QString::fromLatin1(process.readLine().trimmed()),
QString("0 -this is a number"));
#endif
- if (process.state() != QProcess::NotRunning)
+ if (process.state() != QProcess::NotRunning) {
QVERIFY(process.waitForFinished(10000));
+ QCOMPARE(process.exitStatus(), QProcess::NormalExit);
+ QCOMPARE(process.exitCode(), 0);
+ }
}
}
@@ -2298,7 +2348,7 @@ void tst_QProcess::invalidProgramString()
qRegisterMetaType<QProcess::ProcessError>("QProcess::ProcessError");
QSignalSpy spy(&process, &QProcess::errorOccurred);
- QSignalSpy spy2(&process, static_cast<void (QProcess::*)(QProcess::ProcessError)>(&QProcess::error));
+ QSignalSpy spy2(&process, static_cast<QProcessErrorSignal>(&QProcess::error));
QVERIFY(spy.isValid());
QVERIFY(spy2.isValid());
@@ -2316,7 +2366,7 @@ void tst_QProcess::onlyOneStartedSignal()
QProcess process;
QSignalSpy spyStarted(&process, &QProcess::started);
- QSignalSpy spyFinished(&process, static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished));
+ QSignalSpy spyFinished(&process, static_cast<QProcessFinishedSignal2>(&QProcess::finished));
QVERIFY(spyStarted.isValid());
QVERIFY(spyFinished.isValid());
@@ -2332,6 +2382,8 @@ void tst_QProcess::onlyOneStartedSignal()
process.start("testProcessNormal/testProcessNormal");
QVERIFY(process.waitForFinished(5000));
+ QCOMPARE(process.exitStatus(), QProcess::NormalExit);
+ QCOMPARE(process.exitCode(), 0);
QCOMPARE(spyStarted.count(), 1);
QCOMPARE(spyFinished.count(), 1);
}
@@ -2342,7 +2394,7 @@ class BlockOnReadStdOut : public QObject
public:
BlockOnReadStdOut(QProcess *process)
{
- connect(process, SIGNAL(readyReadStandardOutput()), SLOT(block()));
+ connect(process, &QProcess::readyReadStandardOutput, this, &BlockOnReadStdOut::block);
}
public slots:
@@ -2357,7 +2409,8 @@ void tst_QProcess::finishProcessBeforeReadingDone()
QProcess process;
BlockOnReadStdOut blocker(&process);
QEventLoop loop;
- connect(&process, SIGNAL(finished(int)), &loop, SLOT(quit()));
+ connect(&process, static_cast<QProcessFinishedSignal1>(&QProcess::finished),
+ &loop, &QEventLoop::quit);
process.start("testProcessOutput/testProcessOutput");
QVERIFY(process.waitForStarted());
loop.exec();
@@ -2365,6 +2418,8 @@ void tst_QProcess::finishProcessBeforeReadingDone()
QRegExp(QStringLiteral("[\r\n]")), QString::SkipEmptyParts);
QVERIFY(!lines.isEmpty());
QCOMPARE(lines.last(), QStringLiteral("10239 -this is a number"));
+ QCOMPARE(process.exitStatus(), QProcess::NormalExit);
+ QCOMPARE(process.exitCode(), 0);
}
//-----------------------------------------------------------------------------
@@ -2381,14 +2436,17 @@ void tst_QProcess::startStopStartStop()
QProcess process;
process.start("testProcessNormal/testProcessNormal");
QVERIFY(process.waitForFinished());
+ QCOMPARE(process.exitStatus(), QProcess::NormalExit);
QCOMPARE(process.exitCode(), 0);
process.start("testExitCodes/testExitCodes", QStringList() << "1");
QVERIFY(process.waitForFinished());
+ QCOMPARE(process.exitStatus(), QProcess::NormalExit);
QCOMPARE(process.exitCode(), 1);
process.start("testProcessNormal/testProcessNormal");
QVERIFY(process.waitForFinished());
+ QCOMPARE(process.exitStatus(), QProcess::NormalExit);
QCOMPARE(process.exitCode(), 0);
}
@@ -2460,6 +2518,7 @@ void tst_QProcess::startStopStartStopBuffers()
process.write("line3\n");
process.closeWriteChannel();
QVERIFY(process.waitForFinished());
+ QCOMPARE(process.exitStatus(), QProcess::NormalExit);
QCOMPARE(process.exitCode(), 0);
if (channelMode2 == QProcess::MergedChannels) {
diff --git a/tests/auto/corelib/io/qsavefile/tst_qsavefile.cpp b/tests/auto/corelib/io/qsavefile/tst_qsavefile.cpp
index 5796636b92..6e6dc2df95 100644
--- a/tests/auto/corelib/io/qsavefile/tst_qsavefile.cpp
+++ b/tests/auto/corelib/io/qsavefile/tst_qsavefile.cpp
@@ -99,7 +99,7 @@ static inline QByteArray msgCannotOpen(const QFileDevice &f)
void tst_QSaveFile::transactionalWrite()
{
QTemporaryDir dir;
- QVERIFY(dir.isValid());
+ QVERIFY2(dir.isValid(), qPrintable(dir.errorString()));
const QString targetFile = dir.path() + QString::fromLatin1("/outfile");
QFile::remove(targetFile);
QSaveFile file(targetFile);
@@ -134,7 +134,7 @@ void tst_QSaveFile::saveTwice()
// Check that we can reuse a QSaveFile object
// (and test the case of an existing target file)
QTemporaryDir dir;
- QVERIFY(dir.isValid());
+ QVERIFY2(dir.isValid(), qPrintable(dir.errorString()));
const QString targetFile = dir.path() + QString::fromLatin1("/outfile");
QSaveFile file(targetFile);
QVERIFY2(file.open(QIODevice::WriteOnly), msgCannotOpen(file).constData());
@@ -153,7 +153,7 @@ void tst_QSaveFile::saveTwice()
void tst_QSaveFile::textStreamManualFlush()
{
QTemporaryDir dir;
- QVERIFY(dir.isValid());
+ QVERIFY2(dir.isValid(), qPrintable(dir.errorString()));
const QString targetFile = dir.path() + QString::fromLatin1("/outfile");
QSaveFile file(targetFile);
QVERIFY2(file.open(QIODevice::WriteOnly), msgCannotOpen(file).constData());
@@ -174,7 +174,7 @@ void tst_QSaveFile::textStreamManualFlush()
void tst_QSaveFile::textStreamAutoFlush()
{
QTemporaryDir dir;
- QVERIFY(dir.isValid());
+ QVERIFY2(dir.isValid(), qPrintable(dir.errorString()));
const QString targetFile = dir.path() + QString::fromLatin1("/outfile");
QSaveFile file(targetFile);
QVERIFY2(file.open(QIODevice::WriteOnly), msgCannotOpen(file).constData());
@@ -206,7 +206,7 @@ void tst_QSaveFile::transactionalWriteNoPermissionsOnDir()
#endif
QFETCH(bool, directWriteFallback);
QTemporaryDir dir;
- QVERIFY(dir.isValid());
+ QVERIFY2(dir.isValid(), qPrintable(dir.errorString()));
QVERIFY(QFile(dir.path()).setPermissions(QFile::ReadOwner | QFile::ExeOwner));
PermissionRestorer permissionRestorer(dir.path());
@@ -264,7 +264,7 @@ void tst_QSaveFile::transactionalWriteNoPermissionsOnFile()
#endif
// Setup an existing but readonly file
QTemporaryDir dir;
- QVERIFY(dir.isValid());
+ QVERIFY2(dir.isValid(), qPrintable(dir.errorString()));
const QString targetFile = dir.path() + QString::fromLatin1("/outfile");
QFile file(targetFile);
PermissionRestorer permissionRestorer(targetFile);
@@ -285,7 +285,7 @@ void tst_QSaveFile::transactionalWriteNoPermissionsOnFile()
void tst_QSaveFile::transactionalWriteCanceled()
{
QTemporaryDir dir;
- QVERIFY(dir.isValid());
+ QVERIFY2(dir.isValid(), qPrintable(dir.errorString()));
const QString targetFile = dir.path() + QString::fromLatin1("/outfile");
QFile::remove(targetFile);
QSaveFile file(targetFile);
@@ -313,7 +313,7 @@ void tst_QSaveFile::transactionalWriteErrorRenaming()
QSKIP("Test is not applicable with root privileges");
#endif
QTemporaryDir dir;
- QVERIFY(dir.isValid());
+ QVERIFY2(dir.isValid(), qPrintable(dir.errorString()));
const QString targetFile = dir.path() + QString::fromLatin1("/outfile");
QSaveFile file(targetFile);
QVERIFY2(file.open(QIODevice::WriteOnly), msgCannotOpen(file).constData());
@@ -347,7 +347,7 @@ void tst_QSaveFile::symlink()
#ifdef Q_OS_UNIX
QByteArray someData = "some data";
QTemporaryDir dir;
- QVERIFY(dir.isValid());
+ QVERIFY2(dir.isValid(), qPrintable(dir.errorString()));
const QString targetFile = dir.path() + QLatin1String("/outfile");
const QString linkFile = dir.path() + QLatin1String("/linkfile");
@@ -400,7 +400,7 @@ void tst_QSaveFile::symlink()
// link to a link in another directory
QTemporaryDir dir2;
- QVERIFY(dir2.isValid());
+ QVERIFY2(dir2.isValid(), qPrintable(dir2.errorString()));
const QString linkFile2 = dir2.path() + QLatin1String("/linkfile");
QVERIFY(QFile::link(linkFile, linkFile2));
@@ -458,7 +458,7 @@ void tst_QSaveFile::symlink()
void tst_QSaveFile::directory()
{
QTemporaryDir dir;
- QVERIFY(dir.isValid());
+ QVERIFY2(dir.isValid(), qPrintable(dir.errorString()));
const QString subdir = dir.path() + QLatin1String("/subdir");
QVERIFY(QDir(dir.path()).mkdir(QStringLiteral("subdir")));
diff --git a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
index 83ccf20a6d..a520010b47 100644
--- a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
+++ b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
@@ -3378,7 +3378,7 @@ void tst_QSettings::dontReorderIniKeysNeedlessly()
QString outFileName2;
QTemporaryFile outFile;
- outFile.open();
+ QVERIFY2(outFile.open(), qPrintable(outFile.errorString()));
outFile.write(contentsBefore);
outFileName = outFile.fileName();
outFile.close();
diff --git a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp
index efb343cf85..24ff2f237f 100644
--- a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp
+++ b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp
@@ -56,6 +56,7 @@ class tst_qstandardpaths : public QObject
Q_OBJECT
private slots:
+ void initTestCase();
void dump();
void testDefaultLocations();
void testCustomLocations();
@@ -128,6 +129,14 @@ static const char * const enumNames[MaxStandardLocation + 1 - int(QStandardPaths
"AppConfigLocation"
};
+void tst_qstandardpaths::initTestCase()
+{
+ QVERIFY2(m_localConfigTempDir.isValid(), qPrintable(m_localConfigTempDir.errorString()));
+ QVERIFY2(m_globalConfigTempDir.isValid(), qPrintable(m_globalConfigTempDir.errorString()));
+ QVERIFY2(m_localAppTempDir.isValid(), qPrintable(m_localAppTempDir.errorString()));
+ QVERIFY2(m_globalAppTempDir.isValid(), qPrintable(m_globalAppTempDir.errorString()));
+}
+
void tst_qstandardpaths::dump()
{
#ifdef Q_XDG_PLATFORM
diff --git a/tests/auto/corelib/io/qstorageinfo/tst_qstorageinfo.cpp b/tests/auto/corelib/io/qstorageinfo/tst_qstorageinfo.cpp
index 57bb81be61..aaaa0d4949 100644
--- a/tests/auto/corelib/io/qstorageinfo/tst_qstorageinfo.cpp
+++ b/tests/auto/corelib/io/qstorageinfo/tst_qstorageinfo.cpp
@@ -153,7 +153,7 @@ void tst_QStorageInfo::storageList()
void tst_QStorageInfo::tempFile()
{
QTemporaryFile file;
- QVERIFY(file.open());
+ QVERIFY2(file.open(), qPrintable(file.errorString()));
QStorageInfo storage1(file.fileName());
#ifdef Q_OS_LINUX
@@ -174,7 +174,7 @@ void tst_QStorageInfo::tempFile()
void tst_QStorageInfo::caching()
{
QTemporaryFile file;
- QVERIFY(file.open());
+ QVERIFY2(file.open(), qPrintable(file.errorString()));
QStorageInfo storage1(file.fileName());
#ifdef Q_OS_LINUX
diff --git a/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp b/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp
index 4bcdd1b827..532a53e5d3 100644
--- a/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp
+++ b/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp
@@ -258,6 +258,7 @@ tst_QTextStream::tst_QTextStream()
void tst_QTextStream::initTestCase()
{
+ QVERIFY2(tempDir.isValid(), qPrintable(tempDir.errorString()));
QVERIFY(!m_rfc3261FilePath.isEmpty());
QVERIFY(!m_shiftJisFilePath.isEmpty());
diff --git a/tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp b/tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp
index 7d85377c7a..629bbad5aa 100644
--- a/tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp
+++ b/tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp
@@ -2808,7 +2808,7 @@ public:
QModelIndex tl;
QModelIndex br;
public slots:
- void changed(const QItemSelection &selected, const QItemSelection &deselected)
+ void changed(const QItemSelection &, const QItemSelection &deselected)
{
tl = deselected.first().topLeft();
br = deselected.first().bottomRight();
diff --git a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp
index a0cadc9a2f..b889d61786 100644
--- a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp
+++ b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp
@@ -41,12 +41,7 @@
#include <private/qeventloop_p.h>
#include <private/qthread_p.h>
-#ifdef QT_GUI_LIB
-#include <QtGui/QGuiApplication>
-typedef QGuiApplication TestApplication;
-#else
typedef QCoreApplication TestApplication;
-#endif
class EventSpy : public QObject
{
diff --git a/tests/auto/corelib/kernel/qmetaproperty/tst_qmetaproperty.cpp b/tests/auto/corelib/kernel/qmetaproperty/tst_qmetaproperty.cpp
index 4d54aa4dc8..22c78f8e48 100644
--- a/tests/auto/corelib/kernel/qmetaproperty/tst_qmetaproperty.cpp
+++ b/tests/auto/corelib/kernel/qmetaproperty/tst_qmetaproperty.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
-** Copyright (C) 2014 Olivier Goffart <ogoffart@woboq.com>
+** Copyright (C) 2015 Olivier Goffart <ogoffart@woboq.com>
** Contact: http://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
@@ -38,15 +38,29 @@
#include <qobject.h>
#include <qmetaobject.h>
+struct CustomType
+{
+ int padding;
+ QString str;
+ CustomType(const QString &str = QString()) : str(str) {}
+ operator QString() const { return str; }
+ friend bool operator!=(const CustomType &a, const CustomType &b)
+ { return a.str != b.str; }
+};
+
+Q_DECLARE_METATYPE(CustomType)
+
class tst_QMetaProperty : public QObject
{
Q_OBJECT
Q_PROPERTY(EnumType value WRITE setValue READ getValue)
Q_PROPERTY(EnumType value2 WRITE set_value READ get_value)
+ Q_PROPERTY(QString value7 MEMBER value7 RESET resetValue7)
Q_PROPERTY(int value8 READ value8)
Q_PROPERTY(int value9 READ value9 CONSTANT)
Q_PROPERTY(int value10 READ value10 FINAL)
Q_PROPERTY(QMap<int, int> map MEMBER map)
+ Q_PROPERTY(CustomType custom MEMBER custom)
private slots:
void hasStdCppSet();
@@ -55,6 +69,7 @@ private slots:
void gadget();
void readAndWriteWithLazyRegistration();
void mapProperty();
+ void conversion();
public:
enum EnumType { EnumType1 };
@@ -64,11 +79,14 @@ public:
void set_value(EnumType) {}
EnumType get_value() const { return EnumType1; }
+ void resetValue7() { value7 = QStringLiteral("reset"); }
int value8() const { return 1; }
int value9() const { return 1; }
int value10() const { return 1; }
+ QString value7;
QMap<int, int> map;
+ CustomType custom;
};
void tst_QMetaProperty::hasStdCppSet()
@@ -195,5 +213,42 @@ void tst_QMetaProperty::mapProperty()
QCOMPARE(map, (v.value<QMap<int,int> >()));
}
+void tst_QMetaProperty::conversion()
+{
+ QMetaType::registerConverter<QString, CustomType>();
+ QMetaType::registerConverter<CustomType, QString>();
+
+ QString hello = QStringLiteral("Hello");
+
+ // Write to a QString property using a CustomType in a QVariant
+ QMetaProperty value7P = metaObject()->property(metaObject()->indexOfProperty("value7"));
+ QVERIFY(value7P.isValid());
+ QVERIFY(value7P.write(this, QVariant::fromValue(CustomType(hello))));
+ QCOMPARE(value7, hello);
+
+ // Write to a CustomType property using a QString in a QVariant
+ QMetaProperty customP = metaObject()->property(metaObject()->indexOfProperty("custom"));
+ QVERIFY(customP.isValid());
+ QVERIFY(customP.write(this, hello));
+ QCOMPARE(custom.str, hello);
+
+ // Something that cannot be converted should fail
+ QVERIFY(!customP.write(this, 45));
+ QVERIFY(!customP.write(this, QVariant::fromValue(this)));
+ QVERIFY(!value7P.write(this, QVariant::fromValue(this)));
+ QVERIFY(!value7P.write(this, QVariant::fromValue<QObject*>(this)));
+
+ // none of this should have changed the values
+ QCOMPARE(value7, hello);
+ QCOMPARE(custom.str, hello);
+
+ // Empty variant should be converted to default object
+ QVERIFY(customP.write(this, QVariant()));
+ QCOMPARE(custom.str, QString());
+ // or reset resetable
+ QVERIFY(value7P.write(this, QVariant()));
+ QCOMPARE(value7, QLatin1Literal("reset"));
+}
+
QTEST_MAIN(tst_QMetaProperty)
#include "tst_qmetaproperty.moc"
diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
index 3661db071b..90f7780344 100644
--- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
+++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
@@ -1925,7 +1925,7 @@ void tst_QObject::property()
QCOMPARE(object.property("string"), QVariant("String1"));
QVERIFY(object.setProperty("string", "String2"));
QCOMPARE(object.property("string"), QVariant("String2"));
- QVERIFY(!object.setProperty("string", QVariant()));
+ QVERIFY(object.setProperty("string", QVariant()));
const int idx = mo->indexOfProperty("variant");
QVERIFY(idx != -1);
@@ -2027,7 +2027,7 @@ void tst_QObject::property()
QCOMPARE(object.property("customString"), QVariant("String1"));
QVERIFY(object.setProperty("customString", "String2"));
QCOMPARE(object.property("customString"), QVariant("String2"));
- QVERIFY(!object.setProperty("customString", QVariant()));
+ QVERIFY(object.setProperty("customString", QVariant()));
}
void tst_QObject::metamethod()
diff --git a/tests/auto/corelib/kernel/qsocketnotifier/tst_qsocketnotifier.cpp b/tests/auto/corelib/kernel/qsocketnotifier/tst_qsocketnotifier.cpp
index d0eb10d3aa..30ce65849d 100644
--- a/tests/auto/corelib/kernel/qsocketnotifier/tst_qsocketnotifier.cpp
+++ b/tests/auto/corelib/kernel/qsocketnotifier/tst_qsocketnotifier.cpp
@@ -40,6 +40,7 @@
#include <QtCore/QSocketNotifier>
#include <QtNetwork/QTcpServer>
#include <QtNetwork/QTcpSocket>
+#include <QtNetwork/QUdpSocket>
#ifndef Q_OS_WINRT
#include <private/qnativesocketengine_p.h>
#else
@@ -66,8 +67,29 @@ private slots:
#ifdef Q_OS_UNIX
void posixSockets();
#endif
+ void asyncMultipleDatagram();
+
+protected slots:
+ void async_readDatagramSlot();
+ void async_writeDatagramSlot();
+
+private:
+ QUdpSocket *m_asyncSender;
+ QUdpSocket *m_asyncReceiver;
};
+static QHostAddress makeNonAny(const QHostAddress &address,
+ QHostAddress::SpecialAddress preferForAny = QHostAddress::LocalHost)
+{
+ if (address == QHostAddress::Any)
+ return preferForAny;
+ if (address == QHostAddress::AnyIPv4)
+ return QHostAddress::LocalHost;
+ if (address == QHostAddress::AnyIPv6)
+ return QHostAddress::LocalHostIPv6;
+ return address;
+}
+
class UnexpectedDisconnectTester : public QObject
{
Q_OBJECT
@@ -299,5 +321,56 @@ void tst_QSocketNotifier::posixSockets()
}
#endif
+void tst_QSocketNotifier::async_readDatagramSlot()
+{
+ char buf[1];
+ QVERIFY(m_asyncReceiver->hasPendingDatagrams());
+ do {
+ QCOMPARE(m_asyncReceiver->pendingDatagramSize(), qint64(1));
+ QCOMPARE(m_asyncReceiver->readDatagram(buf, sizeof(buf)), qint64(1));
+ if (buf[0] == '1') {
+ // wait for the second datagram message.
+ QTest::qSleep(100);
+ }
+ } while (m_asyncReceiver->hasPendingDatagrams());
+
+ if (buf[0] == '3')
+ QTestEventLoop::instance().exitLoop();
+}
+
+void tst_QSocketNotifier::async_writeDatagramSlot()
+{
+ m_asyncSender->writeDatagram("3", makeNonAny(m_asyncReceiver->localAddress()),
+ m_asyncReceiver->localPort());
+}
+
+void tst_QSocketNotifier::asyncMultipleDatagram()
+{
+ m_asyncSender = new QUdpSocket;
+ m_asyncReceiver = new QUdpSocket;
+
+ QVERIFY(m_asyncReceiver->bind(QHostAddress(QHostAddress::AnyIPv4), 0));
+ quint16 port = m_asyncReceiver->localPort();
+ QVERIFY(port != 0);
+
+ QSignalSpy spy(m_asyncReceiver, &QIODevice::readyRead);
+ connect(m_asyncReceiver, &QIODevice::readyRead, this,
+ &tst_QSocketNotifier::async_readDatagramSlot);
+ m_asyncSender->writeDatagram("1", makeNonAny(m_asyncReceiver->localAddress()), port);
+ m_asyncSender->writeDatagram("2", makeNonAny(m_asyncReceiver->localAddress()), port);
+ // wait a little to ensure that the datagrams we've just sent
+ // will be delivered on receiver side.
+ QTest::qSleep(100);
+
+ QTimer::singleShot(500, this, &tst_QSocketNotifier::async_writeDatagramSlot);
+
+ QTestEventLoop::instance().enterLoop(1);
+ QVERIFY(!QTestEventLoop::instance().timeout());
+ QCOMPARE(spy.count(), 2);
+
+ delete m_asyncSender;
+ delete m_asyncReceiver;
+}
+
QTEST_MAIN(tst_QSocketNotifier)
#include <tst_qsocketnotifier.moc>
diff --git a/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp b/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp
index 064f780546..c17d81ea9e 100644
--- a/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp
+++ b/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp
@@ -72,6 +72,7 @@ private slots:
void singleShotStaticFunctionZeroTimeout();
void recurseOnTimeoutAndStopTimer();
void singleShotToFunctors();
+ void crossThreadSingleShotToFunctor();
void dontBlockEvents();
void postedEventsShouldNotStarveTimers();
@@ -877,5 +878,28 @@ void tst_QTimer::postedEventsShouldNotStarveTimers()
QVERIFY(timerHelper.count > 5);
}
+struct DummyFunctor {
+ void operator()() {}
+};
+
+void tst_QTimer::crossThreadSingleShotToFunctor()
+{
+ // We're testing for crashes here, so the test simply running to
+ // completion is considered a success
+ QThread t;
+ t.start();
+
+ QObject* o = new QObject();
+ o->moveToThread(&t);
+
+ for (int i = 0; i < 10000; i++) {
+ QTimer::singleShot(0, o, DummyFunctor());
+ }
+
+ t.quit();
+ t.wait();
+ delete o;
+}
+
QTEST_MAIN(tst_QTimer)
#include "tst_qtimer.moc"
diff --git a/tests/auto/corelib/mimetypes/qmimedatabase/invalid-magic1.xml b/tests/auto/corelib/mimetypes/qmimedatabase/invalid-magic1.xml
new file mode 100644
index 0000000000..04204d8763
--- /dev/null
+++ b/tests/auto/corelib/mimetypes/qmimedatabase/invalid-magic1.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
+ <mime-type type="text/invalid-magic1">
+ <comment>wrong value for byte type</comment>
+ <magic>
+ <match value="foo" type="byte" offset="0"/>
+ </magic>
+ </mime-type>
+</mime-info>
diff --git a/tests/auto/corelib/mimetypes/qmimedatabase/invalid-magic2.xml b/tests/auto/corelib/mimetypes/qmimedatabase/invalid-magic2.xml
new file mode 100644
index 0000000000..f18075482e
--- /dev/null
+++ b/tests/auto/corelib/mimetypes/qmimedatabase/invalid-magic2.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
+ <mime-type type="text/invalid-magic2">
+ <comment>mask doesn't start with 0x</comment>
+ <magic>
+ <match value="foo" type="string" mask="ffff" offset="0"/>
+ </magic>
+ </mime-type>
+</mime-info>
diff --git a/tests/auto/corelib/mimetypes/qmimedatabase/invalid-magic3.xml b/tests/auto/corelib/mimetypes/qmimedatabase/invalid-magic3.xml
new file mode 100644
index 0000000000..0e2508cc0f
--- /dev/null
+++ b/tests/auto/corelib/mimetypes/qmimedatabase/invalid-magic3.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
+ <mime-type type="text/invalid-magic3">
+ <comment>mask has wrong size</comment>
+ <magic>
+ <match value="foo" type="string" mask="0xffff" offset="0"/>
+ </magic>
+ </mime-type>
+</mime-info>
diff --git a/tests/auto/corelib/mimetypes/qmimedatabase/testdata.qrc b/tests/auto/corelib/mimetypes/qmimedatabase/testdata.qrc
index 4654a61660..29666627a1 100644
--- a/tests/auto/corelib/mimetypes/qmimedatabase/testdata.qrc
+++ b/tests/auto/corelib/mimetypes/qmimedatabase/testdata.qrc
@@ -4,5 +4,8 @@
<file alias="qml-again.xml">qml-again.xml</file>
<file alias="text-x-objcsrc.xml">text-x-objcsrc.xml</file>
<file alias="test.qml">test.qml</file>
+ <file>invalid-magic1.xml</file>
+ <file>invalid-magic2.xml</file>
+ <file>invalid-magic3.xml</file>
</qresource>
</RCC>
diff --git a/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp b/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp
index dd04849f87..0171c4ac5a 100644
--- a/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp
+++ b/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp
@@ -46,9 +46,16 @@
#include <QtTest/QtTest>
-static const char yastFileName[] ="yast2-metapackage-handler-mimetypes.xml";
-static const char qmlAgainFileName[] ="qml-again.xml";
-static const char textXObjCSrcFileName[] ="text-x-objcsrc.xml";
+static const char *const additionalMimeFiles[] = {
+ "yast2-metapackage-handler-mimetypes.xml",
+ "qml-again.xml",
+ "text-x-objcsrc.xml",
+ "invalid-magic1.xml",
+ "invalid-magic2.xml",
+ "invalid-magic3.xml",
+ 0
+};
+
#define RESOURCE_PREFIX ":/qt-project.org/qmime/"
void initializeLang()
@@ -120,6 +127,7 @@ tst_QMimeDatabase::tst_QMimeDatabase()
void tst_QMimeDatabase::initTestCase()
{
+ QVERIFY2(m_temporaryDir.isValid(), qPrintable(m_temporaryDir.errorString()));
QStandardPaths::setTestModeEnabled(true);
m_localMimeDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/mime";
if (QDir(m_localMimeDir).exists()) {
@@ -151,12 +159,12 @@ void tst_QMimeDatabase::initTestCase()
qWarning("%s", qPrintable(testSuiteWarning()));
errorMessage = QString::fromLatin1("Cannot find '%1'");
- m_yastMimeTypes = QLatin1String(RESOURCE_PREFIX) + yastFileName;
- QVERIFY2(QFile::exists(m_yastMimeTypes), qPrintable(errorMessage.arg(yastFileName)));
- m_qmlAgainFileName = QLatin1String(RESOURCE_PREFIX) + qmlAgainFileName;
- QVERIFY2(QFile::exists(m_qmlAgainFileName), qPrintable(errorMessage.arg(qmlAgainFileName)));
- m_textXObjCSrcFileName = QLatin1String(RESOURCE_PREFIX) + textXObjCSrcFileName;
- QVERIFY2(QFile::exists(m_textXObjCSrcFileName), qPrintable(errorMessage.arg(textXObjCSrcFileName)));
+ for (uint i = 0; i < sizeof additionalMimeFiles / sizeof additionalMimeFiles[0] - 1; i++) {
+ const QString resourceFilePath = QString::fromLatin1(RESOURCE_PREFIX) + QLatin1String(additionalMimeFiles[i]);
+ QVERIFY2(QFile::exists(resourceFilePath), qPrintable(errorMessage.arg(resourceFilePath)));
+ m_additionalMimeFileNames.append(QLatin1String(additionalMimeFiles[i]));
+ m_additionalMimeFilePaths.append(resourceFilePath);
+ }
initTestCaseInternal();
m_isUsingCacheProvider = !qEnvironmentVariableIsSet("QT_NO_MIME_CACHE");
@@ -865,6 +873,14 @@ static void checkHasMimeType(const QString &mimeType)
QVERIFY(found);
}
+static void ignoreInvalidMimetypeWarnings(const QString &mimeDir)
+{
+ const QByteArray basePath = QFile::encodeName(mimeDir) + "/packages/";
+ QTest::ignoreMessage(QtWarningMsg, ("QMimeDatabase: Error parsing " + basePath + "invalid-magic1.xml\nInvalid magic rule value \"foo\"").constData());
+ QTest::ignoreMessage(QtWarningMsg, ("QMimeDatabase: Error parsing " + basePath + "invalid-magic2.xml\nInvalid magic rule mask \"ffff\"").constData());
+ QTest::ignoreMessage(QtWarningMsg, ("QMimeDatabase: Error parsing " + basePath + "invalid-magic3.xml\nInvalid magic rule mask size \"0xffff\"").constData());
+}
+
QT_BEGIN_NAMESPACE
extern Q_CORE_EXPORT int qmime_secondsBetweenChecks; // see qmimeprovider.cpp
QT_END_NAMESPACE
@@ -885,23 +901,21 @@ void tst_QMimeDatabase::installNewGlobalMimeType()
const QString mimeDir = m_globalXdgDir + QLatin1String("/mime");
const QString destDir = mimeDir + QLatin1String("/packages/");
- const QString destFile = destDir + QLatin1String(yastFileName);
- QFile::remove(destFile);
- const QString destQmlFile = destDir + QLatin1String(qmlAgainFileName);
- QFile::remove(destQmlFile);
- const QString destTextXObjCSrcFile = destDir + QLatin1String(textXObjCSrcFileName);
- QFile::remove(destTextXObjCSrcFile);
- //qDebug() << destFile;
-
if (!QFileInfo(destDir).isDir())
QVERIFY(QDir(m_globalXdgDir).mkpath(destDir));
+
QString errorMessage;
- QVERIFY2(copyResourceFile(m_yastMimeTypes, destFile, &errorMessage), qPrintable(errorMessage));
- QVERIFY2(copyResourceFile(m_qmlAgainFileName, destQmlFile, &errorMessage), qPrintable(errorMessage));
- QVERIFY2(copyResourceFile(m_textXObjCSrcFileName, destTextXObjCSrcFile, &errorMessage), qPrintable(errorMessage));
+ for (int i = 0; i < m_additionalMimeFileNames.size(); ++i) {
+ const QString destFile = destDir + m_additionalMimeFileNames.at(i);
+ QFile::remove(destFile);
+ QVERIFY2(copyResourceFile(m_additionalMimeFilePaths.at(i), destFile, &errorMessage), qPrintable(errorMessage));
+ }
if (m_isUsingCacheProvider && !waitAndRunUpdateMimeDatabase(mimeDir))
QSKIP("shared-mime-info not found, skipping mime.cache test");
+ if (!m_isUsingCacheProvider)
+ ignoreInvalidMimetypeWarnings(mimeDir);
+
QCOMPARE(db.mimeTypeForFile(QLatin1String("foo.ymu"), QMimeDatabase::MatchExtension).name(),
QString::fromLatin1("text/x-SuSE-ymu"));
QVERIFY(db.mimeTypeForName(QLatin1String("text/x-suse-ymp")).isValid());
@@ -922,10 +936,9 @@ void tst_QMimeDatabase::installNewGlobalMimeType()
qDebug() << objcsrc.globPatterns();
}
- // Now test removing it again
- QVERIFY(QFile::remove(destFile));
- QVERIFY(QFile::remove(destQmlFile));
- QVERIFY(QFile::remove(destTextXObjCSrcFile));
+ // Now test removing the mimetype definitions again
+ for (int i = 0; i < m_additionalMimeFileNames.size(); ++i)
+ QFile::remove(destDir + m_additionalMimeFileNames.at(i));
if (m_isUsingCacheProvider && !waitAndRunUpdateMimeDatabase(mimeDir))
QSKIP("shared-mime-info not found, skipping mime.cache test");
QCOMPARE(db.mimeTypeForFile(QLatin1String("foo.ymu"), QMimeDatabase::MatchExtension).name(),
@@ -942,23 +955,35 @@ void tst_QMimeDatabase::installNewLocalMimeType()
qmime_secondsBetweenChecks = 0;
QMimeDatabase db;
+
+ // Check that we're starting clean
QVERIFY(!db.mimeTypeForName(QLatin1String("text/x-suse-ymp")).isValid());
+ QVERIFY(!db.mimeTypeForName(QLatin1String("text/invalid-magic1")).isValid());
const QString destDir = m_localMimeDir + QLatin1String("/packages/");
- QDir().mkpath(destDir);
- const QString destFile = destDir + QLatin1String(yastFileName);
- QFile::remove(destFile);
- const QString destQmlFile = destDir + QLatin1String(qmlAgainFileName);
- QFile::remove(destQmlFile);
+ QVERIFY(QDir().mkpath(destDir));
QString errorMessage;
- QVERIFY2(copyResourceFile(m_yastMimeTypes, destFile, &errorMessage), qPrintable(errorMessage));
- QVERIFY2(copyResourceFile(m_qmlAgainFileName, destQmlFile, &errorMessage), qPrintable(errorMessage));
- if (m_isUsingCacheProvider && !runUpdateMimeDatabase(m_localMimeDir)) {
+ for (int i = 0; i < m_additionalMimeFileNames.size(); ++i) {
+ const QString destFile = destDir + m_additionalMimeFileNames.at(i);
+ QFile::remove(destFile);
+ QVERIFY2(copyResourceFile(m_additionalMimeFilePaths.at(i), destFile, &errorMessage), qPrintable(errorMessage));
+ }
+ if (m_isUsingCacheProvider && !waitAndRunUpdateMimeDatabase(m_localMimeDir)) {
const QString skipWarning = QStringLiteral("shared-mime-info not found, skipping mime.cache test (")
+ QDir::toNativeSeparators(m_localMimeDir) + QLatin1Char(')');
QSKIP(qPrintable(skipWarning));
}
+ if (!m_isUsingCacheProvider)
+ ignoreInvalidMimetypeWarnings(m_localMimeDir);
+
+ QVERIFY(db.mimeTypeForName(QLatin1String("text/x-suse-ymp")).isValid());
+
+ // These mimetypes have invalid magic, but still do exist.
+ QVERIFY(db.mimeTypeForName(QLatin1String("text/invalid-magic1")).isValid());
+ QVERIFY(db.mimeTypeForName(QLatin1String("text/invalid-magic2")).isValid());
+ QVERIFY(db.mimeTypeForName(QLatin1String("text/invalid-magic3")).isValid());
+
QCOMPARE(db.mimeTypeForFile(QLatin1String("foo.ymu"), QMimeDatabase::MatchExtension).name(),
QString::fromLatin1("text/x-SuSE-ymu"));
QVERIFY(db.mimeTypeForName(QLatin1String("text/x-suse-ymp")).isValid());
@@ -974,8 +999,8 @@ void tst_QMimeDatabase::installNewLocalMimeType()
QString::fromLatin1("text/x-qml"));
// Now test removing the local mimetypes again (note, this leaves a mostly-empty mime.cache file)
- QVERIFY(QFile::remove(destFile));
- QVERIFY(QFile::remove(destQmlFile));
+ for (int i = 0; i < m_additionalMimeFileNames.size(); ++i)
+ QFile::remove(destDir + m_additionalMimeFileNames.at(i));
if (m_isUsingCacheProvider && !waitAndRunUpdateMimeDatabase(m_localMimeDir))
QSKIP("shared-mime-info not found, skipping mime.cache test");
QCOMPARE(db.mimeTypeForFile(QLatin1String("foo.ymu"), QMimeDatabase::MatchExtension).name(),
diff --git a/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.h b/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.h
index f12beafe86..2827bd2dc4 100644
--- a/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.h
+++ b/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.h
@@ -36,6 +36,7 @@
#include <QtCore/QObject>
#include <QtCore/QTemporaryDir>
+#include <QtCore/QStringList>
class tst_QMimeDatabase : public QObject
{
@@ -92,9 +93,8 @@ private:
QString m_globalXdgDir;
QString m_localMimeDir;
- QString m_yastMimeTypes;
- QString m_qmlAgainFileName;
- QString m_textXObjCSrcFileName;
+ QStringList m_additionalMimeFileNames;
+ QStringList m_additionalMimeFilePaths;
QTemporaryDir m_temporaryDir;
QString m_testSuite;
bool m_isUsingCacheProvider;
diff --git a/tests/auto/corelib/thread/qfuturewatcher/tst_qfuturewatcher.cpp b/tests/auto/corelib/thread/qfuturewatcher/tst_qfuturewatcher.cpp
index 60a4d749c9..5ec32b1d02 100644
--- a/tests/auto/corelib/thread/qfuturewatcher/tst_qfuturewatcher.cpp
+++ b/tests/auto/corelib/thread/qfuturewatcher/tst_qfuturewatcher.cpp
@@ -68,6 +68,7 @@ private slots:
void incrementalFilterResults();
void qfutureSynchronizer();
void warnRace();
+ void matchFlags();
};
void sleeper()
@@ -930,5 +931,17 @@ void tst_QFutureWatcher::warnRace()
future.waitForFinished();
}
+void tst_QFutureWatcher::matchFlags()
+{
+ /* Regression test: expect a default watcher to be in the same state as a
+ * default future. */
+ QFutureWatcher<int> watcher;
+ QFuture<int> future;
+ QCOMPARE(watcher.isStarted(), future.isStarted());
+ QCOMPARE(watcher.isCanceled(), future.isCanceled());
+ QCOMPARE(watcher.isFinished(), future.isFinished());
+}
+
+
QTEST_MAIN(tst_QFutureWatcher)
#include "tst_qfuturewatcher.moc"
diff --git a/tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp b/tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp
index 105b8b45d8..105b8b45d8 100755..100644
--- a/tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp
+++ b/tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp
diff --git a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
index a9f3dc19a2..571e8deb00 100644
--- a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
+++ b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
@@ -2170,6 +2170,7 @@ void tst_QDateTime::offsetFromUtc()
// Offset constructor
QDateTime dt1(QDate(2013, 1, 1), QTime(1, 0, 0), Qt::OffsetFromUTC, 60 * 60);
QCOMPARE(dt1.offsetFromUtc(), 60 * 60);
+ QVERIFY(dt1.timeZone().isValid());
dt1 = QDateTime(QDate(2013, 1, 1), QTime(1, 0, 0), Qt::OffsetFromUTC, -60 * 60);
QCOMPARE(dt1.offsetFromUtc(), -60 * 60);
diff --git a/tests/auto/corelib/tools/qlinkedlist/tst_qlinkedlist.cpp b/tests/auto/corelib/tools/qlinkedlist/tst_qlinkedlist.cpp
index 2e829bb05e..d3ace40164 100644
--- a/tests/auto/corelib/tools/qlinkedlist/tst_qlinkedlist.cpp
+++ b/tests/auto/corelib/tools/qlinkedlist/tst_qlinkedlist.cpp
@@ -204,6 +204,7 @@ private slots:
void removeOneInt() const;
void removeOneMovable() const;
void removeOneComplex() const;
+ void reverseIterators() const;
void startsWithInt() const;
void startsWithMovable() const;
void startsWithComplex() const;
@@ -754,6 +755,21 @@ void tst_QLinkedList::removeOneComplex() const
QCOMPARE(liveCount, Complex::getLiveCount());
}
+void tst_QLinkedList::reverseIterators() const
+{
+ QLinkedList<int> l;
+ l << 1 << 2 << 3 << 4;
+ QLinkedList<int> lr = l;
+ std::reverse(lr.begin(), lr.end());
+ const QLinkedList<int> &clr = lr;
+ QVERIFY(std::equal(l.begin(), l.end(), lr.rbegin()));
+ QVERIFY(std::equal(l.begin(), l.end(), lr.crbegin()));
+ QVERIFY(std::equal(l.begin(), l.end(), clr.rbegin()));
+ QVERIFY(std::equal(lr.rbegin(), lr.rend(), l.begin()));
+ QVERIFY(std::equal(lr.crbegin(), lr.crend(), l.begin()));
+ QVERIFY(std::equal(clr.rbegin(), clr.rend(), l.begin()));
+}
+
template<typename T>
void tst_QLinkedList::startsWith() const
{
diff --git a/tests/auto/corelib/tools/qset/tst_qset.cpp b/tests/auto/corelib/tools/qset/tst_qset.cpp
index ed9c269b00..f8f368f51c 100644
--- a/tests/auto/corelib/tools/qset/tst_qset.cpp
+++ b/tests/auto/corelib/tools/qset/tst_qset.cpp
@@ -65,6 +65,7 @@ private slots:
void begin();
void end();
void insert();
+ void reverseIterators();
void setOperations();
void stlIterator();
void stlMutableIterator();
@@ -555,6 +556,21 @@ void tst_QSet::insert()
}
}
+void tst_QSet::reverseIterators()
+{
+ QSet<int> s;
+ s << 1 << 17 << 61 << 127 << 911;
+ std::vector<int> v(s.begin(), s.end());
+ std::reverse(v.begin(), v.end());
+ const QSet<int> &cs = s;
+ QVERIFY(std::equal(v.begin(), v.end(), s.rbegin()));
+ QVERIFY(std::equal(v.begin(), v.end(), s.crbegin()));
+ QVERIFY(std::equal(v.begin(), v.end(), cs.rbegin()));
+ QVERIFY(std::equal(s.rbegin(), s.rend(), v.begin()));
+ QVERIFY(std::equal(s.crbegin(), s.crend(), v.begin()));
+ QVERIFY(std::equal(cs.rbegin(), cs.rend(), v.begin()));
+}
+
void tst_QSet::setOperations()
{
QSet<QString> set1, set2;
diff --git a/tests/auto/corelib/tools/qsharedpointer/externaltests.cpp b/tests/auto/corelib/tools/qsharedpointer/externaltests.cpp
index c3a615fdff..2128eeb164 100644
--- a/tests/auto/corelib/tools/qsharedpointer/externaltests.cpp
+++ b/tests/auto/corelib/tools/qsharedpointer/externaltests.cpp
@@ -641,6 +641,7 @@ namespace QTest {
make.setProcessChannelMode(channelMode);
static const char makes[] =
+ "jom.exe\0" //preferred for visual c++ or mingw
"nmake.exe\0" //for visual c++
"mingw32-make.exe\0" //for mingw
"gmake\0"
diff --git a/tests/auto/corelib/tools/qstring/tst_qstring.cpp b/tests/auto/corelib/tools/qstring/tst_qstring.cpp
index bc55d53a60..124829a11c 100644
--- a/tests/auto/corelib/tools/qstring/tst_qstring.cpp
+++ b/tests/auto/corelib/tools/qstring/tst_qstring.cpp
@@ -4989,6 +4989,22 @@ void tst_QString::operator_smaller()
QVERIFY(QString("b") >= "a");
QVERIFY(QString("b") > "a");
+ QVERIFY(QString("a") < QByteArray("b"));
+ QVERIFY(QString("a") <= QByteArray("b"));
+ QVERIFY(QString("a") <= QByteArray("a"));
+ QVERIFY(QString("a") == QByteArray("a"));
+ QVERIFY(QString("a") >= QByteArray("a"));
+ QVERIFY(QString("b") >= QByteArray("a"));
+ QVERIFY(QString("b") > QByteArray("a"));
+
+ QVERIFY(QByteArray("a") < QString("b"));
+ QVERIFY(QByteArray("a") <= QString("b"));
+ QVERIFY(QByteArray("a") <= QString("a"));
+ QVERIFY(QByteArray("a") == QString("a"));
+ QVERIFY(QByteArray("a") >= QString("a"));
+ QVERIFY(QByteArray("b") >= QString("a"));
+ QVERIFY(QByteArray("b") > QString("a"));
+
QVERIFY(QLatin1String("a") < QString("b"));
QVERIFY(QLatin1String("a") <= QString("b"));
QVERIFY(QLatin1String("a") <= QString("a"));
diff --git a/tests/auto/corelib/tools/qversionnumber/qversionnumber.pro b/tests/auto/corelib/tools/qversionnumber/qversionnumber.pro
index 39e40600e3..e3a231060c 100644
--- a/tests/auto/corelib/tools/qversionnumber/qversionnumber.pro
+++ b/tests/auto/corelib/tools/qversionnumber/qversionnumber.pro
@@ -1,4 +1,5 @@
CONFIG += testcase
+contains(QT_CONFIG, c++11):CONFIG += c++11 c++14
TARGET = tst_qversionnumber
-QT = core-private testlib
+QT = core testlib
SOURCES = tst_qversionnumber.cpp
diff --git a/tests/auto/dbus/qdbusmarshall/tst_qdbusmarshall.cpp b/tests/auto/dbus/qdbusmarshall/tst_qdbusmarshall.cpp
index b681f9829a..57fd5084be 100644
--- a/tests/auto/dbus/qdbusmarshall/tst_qdbusmarshall.cpp
+++ b/tests/auto/dbus/qdbusmarshall/tst_qdbusmarshall.cpp
@@ -150,7 +150,11 @@ int tst_QDBusMarshall::fileDescriptorForTest()
{
if (!tempFile.isOpen()) {
tempFile.setFileTemplate(QDir::tempPath() + "/qdbusmarshalltestXXXXXX.tmp");
- tempFile.open();
+ if (!tempFile.open()) {
+ qWarning("%s: Cannot create temporary file: %s", Q_FUNC_INFO,
+ qPrintable(tempFile.errorString()));
+ return 0;
+ }
}
return tempFile.handle();
}
diff --git a/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp b/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp
index 3f846d25d5..fbe9669cbb 100644
--- a/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp
+++ b/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp
@@ -194,7 +194,7 @@ void tst_QImageReader::initTestCase()
prefix = QFINDTESTDATA("images/");
if (prefix.isEmpty())
QFAIL("Can't find images directory!");
- QVERIFY(m_temporaryDir.isValid());
+ QVERIFY2(m_temporaryDir.isValid(), qPrintable(m_temporaryDir.errorString()));
}
void tst_QImageReader::cleanupTestCase()
diff --git a/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp b/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp
index fe6d7493e4..51dfe66090 100644
--- a/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp
+++ b/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp
@@ -416,7 +416,7 @@ void tst_QImageWriter::testCanWrite()
{
// check if canWrite won't leave an empty file
QTemporaryDir dir;
- QVERIFY(dir.isValid());
+ QVERIFY2(dir.isValid(), qPrintable(dir.errorString()));
QString fileName(dir.path() + QLatin1String("/001.garble"));
QVERIFY(!QFileInfo(fileName).exists());
QImageWriter writer(fileName);
@@ -524,7 +524,7 @@ void tst_QImageWriter::saveToTemporaryFile()
{
// 1) Via QImageWriter's API, with a standard temp file name
QTemporaryFile file;
- QVERIFY(file.open());
+ QVERIFY2(file.open(), qPrintable(file.errorString()));
QImageWriter writer(&file, "PNG");
if (writer.canWrite())
QVERIFY(writer.write(image));
@@ -538,7 +538,7 @@ void tst_QImageWriter::saveToTemporaryFile()
{
// 2) Via QImage's API, with a standard temp file name
QTemporaryFile file;
- QVERIFY(file.open());
+ QVERIFY2(file.open(), qPrintable(file.errorString()));
QVERIFY(image.save(&file, "PNG"));
file.reset();
QImage tmp;
@@ -548,7 +548,7 @@ void tst_QImageWriter::saveToTemporaryFile()
{
// 3) Via QImageWriter's API, with a named temp file
QTemporaryFile file("tempXXXXXX");
- QVERIFY(file.open());
+ QVERIFY2(file.open(), qPrintable(file.errorString()));
QImageWriter writer(&file, "PNG");
QVERIFY(writer.write(image));
#if defined(Q_OS_WINCE)
@@ -559,7 +559,7 @@ void tst_QImageWriter::saveToTemporaryFile()
{
// 4) Via QImage's API, with a named temp file
QTemporaryFile file("tempXXXXXX");
- QVERIFY(file.open());
+ QVERIFY2(file.open(), qPrintable(file.errorString()));
QVERIFY(image.save(&file, "PNG"));
file.reset();
QImage tmp;
diff --git a/tests/auto/gui/kernel/kernel.pro b/tests/auto/gui/kernel/kernel.pro
index 7d47a4167d..b03a117f83 100644
--- a/tests/auto/gui/kernel/kernel.pro
+++ b/tests/auto/gui/kernel/kernel.pro
@@ -24,6 +24,8 @@ SUBDIRS=\
qopenglwindow \
qrasterwindow
+win32:!wince*:!winrt: SUBDIRS += noqteventloop
+
!qtHaveModule(widgets): SUBDIRS -= \
qmouseevent_modal \
qtouchevent
diff --git a/tests/auto/gui/kernel/noqteventloop/noqteventloop.pro b/tests/auto/gui/kernel/noqteventloop/noqteventloop.pro
new file mode 100644
index 0000000000..de5715e147
--- /dev/null
+++ b/tests/auto/gui/kernel/noqteventloop/noqteventloop.pro
@@ -0,0 +1,8 @@
+CONFIG += testcase
+TARGET = tst_noqteventloop
+
+QT += core-private gui-private testlib
+
+SOURCES += tst_noqteventloop.cpp
+
+contains(QT_CONFIG,dynamicgl):win32:!wince*:!winrt: LIBS += -luser32
diff --git a/tests/auto/gui/kernel/noqteventloop/tst_noqteventloop.cpp b/tests/auto/gui/kernel/noqteventloop/tst_noqteventloop.cpp
new file mode 100644
index 0000000000..d21569dcc0
--- /dev/null
+++ b/tests/auto/gui/kernel/noqteventloop/tst_noqteventloop.cpp
@@ -0,0 +1,271 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+
+#include <QEvent>
+#include <QtCore/qthread.h>
+#include <QtGui/qguiapplication.h>
+
+#include <QtCore/qt_windows.h>
+
+class tst_NoQtEventLoop : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void initTestCase();
+ void cleanup();
+ void consumeMouseEvents();
+
+};
+
+void tst_NoQtEventLoop::initTestCase()
+{
+}
+
+void tst_NoQtEventLoop::cleanup()
+{
+}
+
+class Window : public QWindow
+{
+public:
+ Window(QWindow *parentWindow = 0) : QWindow(parentWindow)
+ {
+ }
+
+ void reset()
+ {
+ m_received.clear();
+ }
+
+ bool event(QEvent *event)
+ {
+ m_received[event->type()]++;
+ return QWindow::event(event);
+ }
+
+ int received(QEvent::Type type)
+ {
+ return m_received.value(type, 0);
+ }
+
+
+ QHash<QEvent::Type, int> m_received;
+};
+
+bool g_exit = false;
+
+extern "C" LRESULT QT_WIN_CALLBACK wndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
+ if (message == WM_SHOWWINDOW && wParam == 0)
+ g_exit = true;
+ return DefWindowProc(hwnd, message, wParam, lParam);
+}
+
+class TestThread : public QThread
+{
+ Q_OBJECT
+public:
+ TestThread(HWND parentWnd, Window *childWindow) : QThread(), m_hwnd(parentWnd), m_childWindow(childWindow) {
+ m_screenW = ::GetSystemMetrics(SM_CXSCREEN);
+ m_screenH = ::GetSystemMetrics(SM_CYSCREEN);
+ }
+
+ enum {
+ MouseClick,
+ MouseMove
+ };
+
+ void mouseInput(int command, const QPoint &p = QPoint())
+ {
+ INPUT mouseEvent;
+ mouseEvent.type = INPUT_MOUSE;
+ MOUSEINPUT &mi = mouseEvent.mi;
+ mi.mouseData = 0;
+ mi.time = 0;
+ mi.dwExtraInfo = 0;
+ mi.dx = 0;
+ mi.dy = 0;
+ switch (command) {
+ case MouseClick:
+ mi.dwFlags = MOUSEEVENTF_LEFTDOWN;
+ ::SendInput(1, &mouseEvent, sizeof(INPUT));
+ ::Sleep(50);
+ mi.dwFlags = MOUSEEVENTF_LEFTUP;
+ ::SendInput(1, &mouseEvent, sizeof(INPUT));
+ break;
+ case MouseMove:
+ mi.dwFlags = MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE;
+ mi.dx = p.x() * 65536 / m_screenW;
+ mi.dy = p.y() * 65536 / m_screenH;
+ ::SendInput(1, &mouseEvent, sizeof(INPUT));
+ break;
+ }
+ }
+
+ void mouseClick()
+ {
+ mouseInput(MouseClick);
+ }
+
+ void mouseMove(const QPoint &pt)
+ {
+ mouseInput(MouseMove, pt);
+ }
+
+
+ void run() {
+ struct ScopedCleanup
+ {
+ /* This is in order to ensure that the window is hidden when returning from run(),
+ regardless of the return point (e.g. with QTRY_COMPARE) */
+ ScopedCleanup(HWND hwnd) : m_hwnd(hwnd) { }
+ ~ScopedCleanup() {
+ ::ShowWindow(m_hwnd, SW_HIDE);
+ }
+ HWND m_hwnd;
+ } cleanup(m_hwnd);
+
+ m_testPassed = false;
+ POINT pt;
+ pt.x = 0;
+ pt.y = 0;
+ if (!::ClientToScreen(m_hwnd, &pt))
+ return;
+ m_windowPos = QPoint(pt.x, pt.y);
+
+
+ // First activate the parent window (which will also activate the child window)
+ m_windowPos += QPoint(5,5);
+ mouseMove(m_windowPos);
+ ::Sleep(150);
+ mouseClick();
+
+
+
+ // At this point the windows are activated, no further events will be send to the QWindow
+ // if we click on the native parent HWND
+ m_childWindow->reset();
+ ::Sleep(150);
+ mouseClick();
+ ::Sleep(150);
+
+ QTRY_COMPARE(m_childWindow->received(QEvent::MouseButtonPress) + m_childWindow->received(QEvent::MouseButtonRelease), 0);
+
+ // Now click in the QWindow. The QWindow should receive those events.
+ m_windowPos.ry() += 50;
+ mouseMove(m_windowPos);
+ ::Sleep(150);
+ mouseClick();
+ QTRY_COMPARE(m_childWindow->received(QEvent::MouseButtonPress), 1);
+ QTRY_COMPARE(m_childWindow->received(QEvent::MouseButtonRelease), 1);
+
+ m_testPassed = true;
+
+ // ScopedCleanup will hide the window here
+ // Once the native window is hidden, it will exit the event loop.
+ }
+
+ bool passed() const { return m_testPassed; }
+
+private:
+ int m_screenW;
+ int m_screenH;
+ bool m_testPassed;
+ HWND m_hwnd;
+ Window *m_childWindow;
+ QPoint m_windowPos;
+
+};
+
+
+void tst_NoQtEventLoop::consumeMouseEvents()
+{
+ int argc = 1;
+ char *argv[] = {const_cast<char*>("test")};
+ QGuiApplication app(argc, argv);
+ QString clsName(QStringLiteral("tst_NoQtEventLoop_WINDOW"));
+ const HINSTANCE appInstance = (HINSTANCE)GetModuleHandle(0);
+ WNDCLASSEX wc;
+ wc.cbSize = sizeof(WNDCLASSEX);
+ wc.style = CS_DBLCLKS | CS_OWNDC; // CS_SAVEBITS
+ wc.lpfnWndProc = wndProc;
+ wc.cbClsExtra = 0;
+ wc.cbWndExtra = 0;
+ wc.hInstance = appInstance;
+ wc.hIcon = 0;
+ wc.hIconSm = 0;
+ wc.hCursor = 0;
+ wc.hbrBackground = ::GetSysColorBrush(COLOR_BTNFACE /*COLOR_WINDOW*/);
+ wc.lpszMenuName = 0;
+ wc.lpszClassName = (wchar_t*)clsName.utf16();
+
+ ATOM atom = ::RegisterClassEx(&wc);
+ QVERIFY2(atom, "RegisterClassEx failed");
+
+ DWORD dwExStyle = WS_EX_APPWINDOW;
+ DWORD dwStyle = WS_CAPTION | WS_HSCROLL | WS_TABSTOP | WS_VISIBLE;
+
+ HWND mainWnd = ::CreateWindowEx(dwExStyle, (wchar_t*)clsName.utf16(), TEXT("tst_NoQtEventLoop"), dwStyle, 100, 100, 300, 300, 0, NULL, appInstance, NULL);
+ QVERIFY2(mainWnd, "CreateWindowEx failed");
+
+ ::ShowWindow(mainWnd, SW_SHOW);
+
+ Window *childWindow = new Window;
+ childWindow->setParent(QWindow::fromWinId((WId)mainWnd));
+ childWindow->setGeometry(0, 50, 200, 200);
+ childWindow->show();
+
+ TestThread *testThread = new TestThread(mainWnd, childWindow);
+ connect(testThread, SIGNAL(finished()), testThread, SLOT(deleteLater()));
+ testThread->start();
+
+ // Our own message loop...
+ MSG msg;
+ while (::GetMessage(&msg, NULL, 0, 0) > 0) {
+ ::TranslateMessage(&msg);
+ ::DispatchMessage(&msg);
+ if (g_exit)
+ break;
+ }
+
+ QCOMPARE(testThread->passed(), true);
+
+}
+
+#include <tst_noqteventloop.moc>
+
+QTEST_APPLESS_MAIN(tst_NoQtEventLoop)
+
diff --git a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp
index 2c363e3d69..ea8f594f9c 100644
--- a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp
+++ b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp
@@ -60,6 +60,7 @@ class tst_QGuiApplication: public tst_QCoreApplication
Q_OBJECT
private slots:
+ void initTestCase();
void cleanup();
void displayName();
void desktopFileName();
@@ -85,6 +86,21 @@ private slots:
void settableStyleHints(); // Needs to run last as it changes style hints.
};
+void tst_QGuiApplication::initTestCase()
+{
+#ifdef QT_QPA_DEFAULT_PLATFORM_NAME
+ if ((QString::compare(QStringLiteral(QT_QPA_DEFAULT_PLATFORM_NAME),
+ QStringLiteral("eglfs"), Qt::CaseInsensitive) == 0) ||
+ (QString::compare(QString::fromLatin1(qgetenv("QT_QPA_PLATFORM")),
+ QStringLiteral("eglfs"), Qt::CaseInsensitive) == 0)) {
+ // Set env variables to disable input and cursor because eglfs is single fullscreen window
+ // and trying to initialize input and cursor will crash test.
+ qputenv("QT_QPA_EGLFS_DISABLE_INPUT", "1");
+ qputenv("QT_QPA_EGLFS_HIDECURSOR", "1");
+ }
+#endif
+}
+
void tst_QGuiApplication::cleanup()
{
QVERIFY(QGuiApplication::allWindows().isEmpty());
diff --git a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
index 210939c7f0..1e7e858bed 100644
--- a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
+++ b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
@@ -5025,6 +5025,7 @@ void tst_QPainter::drawPolyline_data()
QTest::newRow("basic") << (QVector<QPointF>() << QPointF(10, 10) << QPointF(20, 10) << QPointF(20, 20) << QPointF(10, 20));
QTest::newRow("clipped") << (QVector<QPointF>() << QPoint(-10, 100) << QPoint(-1, 100) << QPoint(-1, -2) << QPoint(100, -2) << QPoint(100, 40)); // QTBUG-31579
QTest::newRow("shortsegment") << (QVector<QPointF>() << QPoint(20, 100) << QPoint(20, 99) << QPoint(21, 99) << QPoint(21, 104)); // QTBUG-42398
+ QTest::newRow("edge") << (QVector<QPointF>() << QPointF(4.5, 121.6) << QPointF(9.4, 150.9) << QPointF(14.2, 184.8) << QPointF(19.1, 130.4));
}
void tst_QPainter::drawPolyline()
@@ -5034,7 +5035,7 @@ void tst_QPainter::drawPolyline()
for (int r = 0; r < 2; r++) {
images[r] = QImage(150, 150, QImage::Format_ARGB32);
- images[r].fill(Qt::transparent);
+ images[r].fill(Qt::white);
QPainter p(images + r);
QPen pen(Qt::red, 0, Qt::SolidLine, Qt::FlatCap);
p.setPen(pen);
diff --git a/tests/auto/gui/painting/qpdfwriter/tst_qpdfwriter.cpp b/tests/auto/gui/painting/qpdfwriter/tst_qpdfwriter.cpp
index 4bc31baba8..5eaee1192a 100644
--- a/tests/auto/gui/painting/qpdfwriter/tst_qpdfwriter.cpp
+++ b/tests/auto/gui/painting/qpdfwriter/tst_qpdfwriter.cpp
@@ -50,8 +50,7 @@ private slots:
void tst_QPdfWriter::basics()
{
QTemporaryFile file;
- if (!file.open())
- QSKIP("Couldn't open temp file!");
+ QVERIFY2(file.open(), qPrintable(file.errorString()));
QPdfWriter writer(file.fileName());
QCOMPARE(writer.title(), QString());
@@ -150,8 +149,7 @@ void tst_QPdfWriter::testPageMetrics()
QSizeF sizeMMf = QSizeF(widthMMf, heightMMf);
QTemporaryFile file;
- if (!file.open())
- QSKIP("Couldn't open temp file!");
+ QVERIFY2(file.open(), qPrintable(file.errorString()));
QPdfWriter writer(file.fileName());
QCOMPARE(writer.pageLayout().orientation(), QPageLayout::Portrait);
diff --git a/tests/auto/gui/text/qfontmetrics/tst_qfontmetrics.cpp b/tests/auto/gui/text/qfontmetrics/tst_qfontmetrics.cpp
index d8e9836112..ec62bafd6c 100644
--- a/tests/auto/gui/text/qfontmetrics/tst_qfontmetrics.cpp
+++ b/tests/auto/gui/text/qfontmetrics/tst_qfontmetrics.cpp
@@ -65,6 +65,7 @@ private slots:
void inFontUcs4();
void lineWidth();
void mnemonicTextWidth();
+ void leadingBelowLine();
};
tst_QFontMetrics::tst_QFontMetrics()
@@ -343,5 +344,16 @@ void tst_QFontMetrics::mnemonicTextWidth()
QCOMPARE(fm.size(Qt::TextShowMnemonic, f1), fm.size(Qt::TextShowMnemonic, f2));
QCOMPARE(fm.size(Qt::TextHideMnemonic, f1), fm.size(Qt::TextHideMnemonic, f2));
}
+
+void tst_QFontMetrics::leadingBelowLine()
+{
+ QScriptLine line;
+ line.leading = 10;
+ line.leadingIncluded = true;
+ line.ascent = 5;
+ QCOMPARE(line.height(), line.ascent + line.descent + line.leading);
+ QCOMPARE(line.base(), line.ascent);
+}
+
QTEST_MAIN(tst_QFontMetrics)
#include "tst_qfontmetrics.moc"
diff --git a/tests/auto/gui/util/qdesktopservices/tst_qdesktopservices.cpp b/tests/auto/gui/util/qdesktopservices/tst_qdesktopservices.cpp
index c8964eb02c..db4b15530c 100644
--- a/tests/auto/gui/util/qdesktopservices/tst_qdesktopservices.cpp
+++ b/tests/auto/gui/util/qdesktopservices/tst_qdesktopservices.cpp
@@ -35,6 +35,7 @@
#include <QtTest/QtTest>
#include <qdebug.h>
#include <qdesktopservices.h>
+#include <qregularexpression.h>
class tst_qdesktopservices : public QObject
{
@@ -74,7 +75,9 @@ void tst_qdesktopservices::openUrl()
QCOMPARE(QDesktopServices::openUrl(QUrl()), false);
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
// this test is only valid on windows on other systems it might mean open a new document in the application handling .file
- QTest::ignoreMessage(QtWarningMsg, "ShellExecute 'file://invalid.file' failed (error 3).");
+ const QRegularExpression messagePattern("ShellExecute 'file://invalid\\.file' failed \\(error \\d+\\)\\.");
+ QVERIFY(messagePattern.isValid());
+ QTest::ignoreMessage(QtWarningMsg, messagePattern);
QCOMPARE(QDesktopServices::openUrl(QUrl("file://invalid.file")), false);
#endif
}
diff --git a/tests/auto/network/access/qabstractnetworkcache/tst_qabstractnetworkcache.cpp b/tests/auto/network/access/qabstractnetworkcache/tst_qabstractnetworkcache.cpp
index 4cbdef2bbe..fd48ec3253 100644
--- a/tests/auto/network/access/qabstractnetworkcache/tst_qabstractnetworkcache.cpp
+++ b/tests/auto/network/access/qabstractnetworkcache/tst_qabstractnetworkcache.cpp
@@ -294,6 +294,7 @@ void tst_QAbstractNetworkCache::runTest()
QNetworkAccessManager manager;
NetworkDiskCache *diskCache = new NetworkDiskCache(&manager);
+ QVERIFY2(diskCache->tempDir.isValid(), qPrintable(diskCache->tempDir.errorString()));
manager.setCache(diskCache);
QCOMPARE(diskCache->gotData, false);
@@ -344,6 +345,7 @@ void tst_QAbstractNetworkCache::checkSynchronous()
QNetworkAccessManager manager;
NetworkDiskCache *diskCache = new NetworkDiskCache(&manager);
+ QVERIFY2(diskCache->tempDir.isValid(), qPrintable(diskCache->tempDir.errorString()));
manager.setCache(diskCache);
QCOMPARE(diskCache->gotData, false);
@@ -392,6 +394,7 @@ void tst_QAbstractNetworkCache::deleteCache()
{
QNetworkAccessManager manager;
NetworkDiskCache *diskCache = new NetworkDiskCache(&manager);
+ QVERIFY2(diskCache->tempDir.isValid(), qPrintable(diskCache->tempDir.errorString()));
manager.setCache(diskCache);
QString url = "httpcachetest_cachecontrol.cgi?max-age=1000";
diff --git a/tests/auto/network/access/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp b/tests/auto/network/access/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp
index 5d072af6d5..0d188a8fec 100644
--- a/tests/auto/network/access/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp
+++ b/tests/auto/network/access/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp
@@ -36,6 +36,7 @@
#include "private/qhttpnetworkconnection_p.h"
#include "private/qnoncontiguousbytedevice_p.h"
#include <QAuthenticator>
+#include <QTcpServer>
#include "../../../network-settings.h"
@@ -106,6 +107,8 @@ private Q_SLOTS:
void getAndThenDeleteObject();
void getAndThenDeleteObject_data();
+
+ void overlappingCloseAndWrite();
};
tst_QHttpNetworkConnection::tst_QHttpNetworkConnection()
@@ -1112,6 +1115,57 @@ void tst_QHttpNetworkConnection::getAndThenDeleteObject()
}
}
+class TestTcpServer : public QTcpServer
+{
+ Q_OBJECT
+public:
+ TestTcpServer() : errorCodeReports(0)
+ {
+ connect(this, &QTcpServer::newConnection, this, &TestTcpServer::onNewConnection);
+ QVERIFY(listen(QHostAddress::LocalHost));
+ }
+
+ int errorCodeReports;
+
+public slots:
+ void onNewConnection()
+ {
+ QTcpSocket *socket = nextPendingConnection();
+ if (!socket)
+ return;
+ // close socket instantly!
+ connect(socket, &QTcpSocket::readyRead, socket, &QTcpSocket::close);
+ }
+
+ void onReply(QNetworkReply::NetworkError code)
+ {
+ QCOMPARE(code, QNetworkReply::RemoteHostClosedError);
+ ++errorCodeReports;
+ }
+};
+
+void tst_QHttpNetworkConnection::overlappingCloseAndWrite()
+{
+ // server accepts connections, but closes the socket instantly
+ TestTcpServer server;
+ QNetworkAccessManager accessManager;
+
+ // ten requests are scheduled. All should result in an RemoteHostClosed...
+ QUrl url;
+ url.setScheme(QStringLiteral("http"));
+ url.setHost(server.serverAddress().toString());
+ url.setPort(server.serverPort());
+ for (int i = 0; i < 10; ++i) {
+ QNetworkRequest request(url);
+ QNetworkReply *reply = accessManager.get(request);
+ // Not using Qt5 connection syntax here because of overly baroque syntax to discern between
+ // different error() methods.
+ QObject::connect(reply, SIGNAL(error(QNetworkReply::NetworkError)),
+ &server, SLOT(onReply(QNetworkReply::NetworkError)));
+ }
+
+ QTRY_COMPARE(server.errorCodeReports, 10);
+}
QTEST_MAIN(tst_QHttpNetworkConnection)
diff --git a/tests/auto/network/access/qnetworkaccessmanager/tst_qnetworkaccessmanager.cpp b/tests/auto/network/access/qnetworkaccessmanager/tst_qnetworkaccessmanager.cpp
index b4e4b9ce0a..8ecb57dd33 100644
--- a/tests/auto/network/access/qnetworkaccessmanager/tst_qnetworkaccessmanager.cpp
+++ b/tests/auto/network/access/qnetworkaccessmanager/tst_qnetworkaccessmanager.cpp
@@ -74,6 +74,10 @@ void tst_QNetworkAccessManager::networkAccessible()
// if there is no session, we cannot know in which state we are in
QNetworkAccessManager::NetworkAccessibility initialAccessibility =
manager.networkAccessible();
+
+ if (initialAccessibility == QNetworkAccessManager::UnknownAccessibility)
+ QSKIP("Unknown accessibility", SkipAll);
+
QCOMPARE(manager.networkAccessible(), initialAccessibility);
manager.setNetworkAccessible(QNetworkAccessManager::NotAccessible);
@@ -94,29 +98,28 @@ void tst_QNetworkAccessManager::networkAccessible()
QCOMPARE(manager.networkAccessible(), initialAccessibility);
QNetworkConfigurationManager configManager;
- bool sessionRequired = (configManager.capabilities()
- & QNetworkConfigurationManager::NetworkSessionRequired);
QNetworkConfiguration defaultConfig = configManager.defaultConfiguration();
if (defaultConfig.isValid()) {
manager.setConfiguration(defaultConfig);
- // the accessibility has not changed if no session is required
- if (sessionRequired) {
+ QCOMPARE(spy.count(), 0);
+
+ if (defaultConfig.state().testFlag(QNetworkConfiguration::Active))
+ QCOMPARE(manager.networkAccessible(), QNetworkAccessManager::Accessible);
+ else
+ QCOMPARE(manager.networkAccessible(), QNetworkAccessManager::NotAccessible);
+
+ manager.setNetworkAccessible(QNetworkAccessManager::NotAccessible);
+
+ if (defaultConfig.state().testFlag(QNetworkConfiguration::Active)) {
QCOMPARE(spy.count(), 1);
- QCOMPARE(spy.takeFirst().at(0).value<QNetworkAccessManager::NetworkAccessibility>(),
- QNetworkAccessManager::Accessible);
+ QCOMPARE(QNetworkAccessManager::NetworkAccessibility(spy.takeFirst().at(0).toInt()),
+ QNetworkAccessManager::NotAccessible);
} else {
QCOMPARE(spy.count(), 0);
}
- QCOMPARE(manager.networkAccessible(), QNetworkAccessManager::Accessible);
-
- manager.setNetworkAccessible(QNetworkAccessManager::NotAccessible);
-
- QCOMPARE(spy.count(), 1);
- QCOMPARE(QNetworkAccessManager::NetworkAccessibility(spy.takeFirst().at(0).toInt()),
- QNetworkAccessManager::NotAccessible);
- QCOMPARE(manager.networkAccessible(), QNetworkAccessManager::NotAccessible);
}
+ QCOMPARE(manager.networkAccessible(), QNetworkAccessManager::NotAccessible);
#endif
}
diff --git a/tests/auto/network/access/qnetworkdiskcache/tst_qnetworkdiskcache.cpp b/tests/auto/network/access/qnetworkdiskcache/tst_qnetworkdiskcache.cpp
index 708e7ebca8..1685838e9e 100644
--- a/tests/auto/network/access/qnetworkdiskcache/tst_qnetworkdiskcache.cpp
+++ b/tests/auto/network/access/qnetworkdiskcache/tst_qnetworkdiskcache.cpp
@@ -563,7 +563,7 @@ void tst_QNetworkDiskCache::oldCacheVersionFile()
{
QTemporaryFile file(cache.cacheDirectory() + "/XXXXXX.d");
file.setAutoRemove(false);
- QVERIFY(file.open());
+ QVERIFY2(file.open(), qPrintable(file.errorString()));
QDataStream out(&file);
out << qint32(0xe8);
out << qint32(2);
diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
index 6c919eb3f9..55e17b142a 100644
--- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
@@ -1679,7 +1679,7 @@ void tst_QNetworkReply::getFromFile()
// create the file:
QTemporaryFile file(QDir::currentPath() + "/temp-XXXXXX");
file.setAutoRemove(true);
- QVERIFY(file.open());
+ QVERIFY2(file.open(), qPrintable(file.errorString()));
QNetworkRequest request(QUrl::fromLocalFile(file.fileName()));
QNetworkReplyPtr reply;
@@ -3065,7 +3065,7 @@ void tst_QNetworkReply::ioGetFromFile()
{
QTemporaryFile file(QDir::currentPath() + "/temp-XXXXXX");
file.setAutoRemove(true);
- QVERIFY(file.open());
+ QVERIFY2(file.open(), qPrintable(file.errorString()));
QFETCH(QByteArray, data);
QCOMPARE(file.write(data), data.size());
@@ -5353,7 +5353,7 @@ void tst_QNetworkReply::chaining()
{
QTemporaryFile sourceFile(QDir::currentPath() + "/temp-XXXXXX");
sourceFile.setAutoRemove(true);
- QVERIFY(sourceFile.open());
+ QVERIFY2(sourceFile.open(), qPrintable(sourceFile.errorString()));
QFETCH(QByteArray, data);
QCOMPARE(sourceFile.write(data), data.size());
@@ -7194,6 +7194,7 @@ void tst_QNetworkReply::qtbug28035browserDoesNotLoadQtProjectOrgCorrectly() {
QByteArray postData = "ACT=100";
QTemporaryDir tempDir(QDir::tempPath() + "/tmp_cache_28035");
+ QVERIFY2(tempDir.isValid(), qPrintable(tempDir.errorString()));
tempDir.setAutoRemove(true);
QNetworkDiskCache *diskCache = new QNetworkDiskCache();
diff --git a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp
index 09d9448e10..0ee3255502 100644
--- a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp
+++ b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp
@@ -115,10 +115,13 @@ private slots:
void linkLocalIPv4();
void readyRead();
void readyReadForEmptyDatagram();
+ void asyncReadDatagram();
+ void writeInHostLookupState();
protected slots:
void empty_readyReadSlot();
void empty_connectedSlot();
+ void async_readDatagramSlot();
private:
#ifndef QT_NO_BEARERMANAGEMENT
@@ -126,6 +129,8 @@ private:
QNetworkConfiguration networkConfiguration;
QSharedPointer<QNetworkSession> networkSession;
#endif
+ QUdpSocket *m_asyncSender;
+ QUdpSocket *m_asyncReceiver;
};
static QHostAddress makeNonAny(const QHostAddress &address, QHostAddress::SpecialAddress preferForAny = QHostAddress::LocalHost)
@@ -1670,5 +1675,67 @@ void tst_QUdpSocket::readyReadForEmptyDatagram()
QCOMPARE(receiver.readDatagram(buf, sizeof buf), qint64(0));
}
+void tst_QUdpSocket::async_readDatagramSlot()
+{
+ char buf[1];
+ QVERIFY(m_asyncReceiver->hasPendingDatagrams());
+ QCOMPARE(m_asyncReceiver->pendingDatagramSize(), qint64(1));
+ QCOMPARE(m_asyncReceiver->bytesAvailable(), qint64(1));
+ QCOMPARE(m_asyncReceiver->readDatagram(buf, sizeof(buf)), qint64(1));
+
+ if (buf[0] == '2') {
+ QTestEventLoop::instance().exitLoop();
+ return;
+ }
+
+ m_asyncSender->writeDatagram("2", makeNonAny(m_asyncReceiver->localAddress()), m_asyncReceiver->localPort());
+ // wait a little to ensure that the datagram we've just sent
+ // will be delivered on receiver side.
+ QTest::qSleep(100);
+}
+
+void tst_QUdpSocket::asyncReadDatagram()
+{
+ QFETCH_GLOBAL(bool, setProxy);
+ if (setProxy)
+ return;
+
+ m_asyncSender = new QUdpSocket;
+ m_asyncReceiver = new QUdpSocket;
+#ifdef FORCE_SESSION
+ m_asyncSender->setProperty("_q_networksession", QVariant::fromValue(networkSession));
+ m_asyncReceiver->setProperty("_q_networksession", QVariant::fromValue(networkSession));
+#endif
+
+ QVERIFY(m_asyncReceiver->bind(QHostAddress(QHostAddress::AnyIPv4), 0));
+ quint16 port = m_asyncReceiver->localPort();
+ QVERIFY(port != 0);
+
+ QSignalSpy spy(m_asyncReceiver, SIGNAL(readyRead()));
+ connect(m_asyncReceiver, SIGNAL(readyRead()), SLOT(async_readDatagramSlot()));
+
+ m_asyncSender->writeDatagram("1", makeNonAny(m_asyncReceiver->localAddress()), port);
+
+ QTestEventLoop::instance().enterLoop(1);
+
+ QVERIFY(!QTestEventLoop::instance().timeout());
+ QCOMPARE(spy.count(), 2);
+
+ delete m_asyncSender;
+ delete m_asyncReceiver;
+}
+
+void tst_QUdpSocket::writeInHostLookupState()
+{
+ QFETCH_GLOBAL(bool, setProxy);
+ if (setProxy)
+ return;
+
+ QUdpSocket socket;
+ socket.connectToHost("nosuchserver.qt-project.org", 80);
+ QCOMPARE(socket.state(), QUdpSocket::HostLookupState);
+ QVERIFY(!socket.putChar('0'));
+}
+
QTEST_MAIN(tst_QUdpSocket)
#include "tst_qudpsocket.moc"
diff --git a/tests/auto/other/languagechange/tst_languagechange.cpp b/tests/auto/other/languagechange/tst_languagechange.cpp
index 7658aaa8e0..493e279e18 100644
--- a/tests/auto/other/languagechange/tst_languagechange.cpp
+++ b/tests/auto/other/languagechange/tst_languagechange.cpp
@@ -276,7 +276,7 @@ void tst_languageChange::retranslatability()
tempDirPattern += QStringLiteral("languagechangetestdirXXXXXX");
QTemporaryDir temporaryDir(tempDirPattern);
temporaryDir.setAutoRemove(true);
- QVERIFY(temporaryDir.isValid());
+ QVERIFY2(temporaryDir.isValid(), qPrintable(temporaryDir.errorString()));
const QString finalDir = temporaryDir.path() + QStringLiteral("/finaldir");
const QString fooName = temporaryDir.path() + QStringLiteral("/foo");
QDir dir;
diff --git a/tests/auto/other/qaccessibilitylinux/qaccessibilitylinux.pro b/tests/auto/other/qaccessibilitylinux/qaccessibilitylinux.pro
index 2ea54ab603..10d950541a 100644
--- a/tests/auto/other/qaccessibilitylinux/qaccessibilitylinux.pro
+++ b/tests/auto/other/qaccessibilitylinux/qaccessibilitylinux.pro
@@ -1,8 +1,5 @@
CONFIG += testcase
-# This is temporary to start running the test as part of normal CI.
-CONFIG += insignificant_test # QTBUG-27732
-
include($$QT_SOURCE_TREE/src/platformsupport/accessibility/accessibility.pri)
include($$QT_SOURCE_TREE/src/platformsupport/linuxaccessibility/linuxaccessibility.pri)
diff --git a/tests/auto/other/qaccessibilitylinux/tst_qaccessibilitylinux.cpp b/tests/auto/other/qaccessibilitylinux/tst_qaccessibilitylinux.cpp
index 5f0eed5afe..4885a5f037 100644
--- a/tests/auto/other/qaccessibilitylinux/tst_qaccessibilitylinux.cpp
+++ b/tests/auto/other/qaccessibilitylinux/tst_qaccessibilitylinux.cpp
@@ -84,7 +84,15 @@ class tst_QAccessibilityLinux : public QObject
Q_OBJECT
public:
- tst_QAccessibilityLinux() : m_window(0), root(0), rootApplication(0), mainWindow(0) {}
+ tst_QAccessibilityLinux() : m_window(0), root(0), rootApplication(0), mainWindow(0)
+ {
+ qputenv("QT_LINUX_ACCESSIBILITY_ALWAYS_ON", QByteArrayLiteral("1"));
+ dbus = new DBusConnection();
+ }
+ ~tst_QAccessibilityLinux()
+ {
+ delete dbus;
+ }
private slots:
void initTestCase();
@@ -112,7 +120,7 @@ private:
QDBusInterface *rootApplication;
QDBusInterface *mainWindow;
- DBusConnection dbus;
+ DBusConnection *dbus;
};
// helper to find children of a dbus object
@@ -149,7 +157,7 @@ QString tst_QAccessibilityLinux::getParent(QDBusInterface *interface)
// helper to get dbus object
QDBusInterface *tst_QAccessibilityLinux::getInterface(const QString &path, const QString &interfaceName)
{
- return new QDBusInterface(address, path, interfaceName, dbus.connection(), this);
+ return new QDBusInterface(address, path, interfaceName, dbus->connection(), this);
}
void tst_QAccessibilityLinux::initTestCase()
@@ -158,14 +166,22 @@ void tst_QAccessibilityLinux::initTestCase()
qApp->setStyle("fusion");
qApp->setApplicationName("tst_QAccessibilityLinux app");
- // Pretend we are a screen reader
+
+ // trigger launching of at-spi if it isn't running already
QDBusConnection c = QDBusConnection::sessionBus();
OrgA11yStatusInterface *a11yStatus = new OrgA11yStatusInterface(QStringLiteral("org.a11y.Bus"), QStringLiteral("/org/a11y/bus"), c, this);
- a11yStatus->setScreenReaderEnabled(true);
+ // don't care about the result, calling any function on "org.a11y.Bus" will launch the service
+ a11yStatus->isEnabled();
+ for (int i = 0; i < 5; ++i) {
+ if (!dbus->isEnabled())
+ QTest::qWait(100);
+ }
- QTRY_VERIFY(dbus.isEnabled());
- QTRY_VERIFY(dbus.connection().isConnected());
- address = dbus.connection().baseService().toLatin1().data();
+ if (!dbus->isEnabled())
+ QSKIP("Could not connect to AT-SPI, make sure lib atspi2 is installed.");
+ QTRY_VERIFY(dbus->isEnabled());
+ QTRY_VERIFY(dbus->connection().isConnected());
+ address = dbus->connection().baseService().toLatin1().data();
QVERIFY(!address.isEmpty());
m_window = new AccessibleTestWindow();
@@ -185,7 +201,7 @@ void tst_QAccessibilityLinux::cleanupTestCase()
void tst_QAccessibilityLinux::registerDbus()
{
- QVERIFY(dbus.connection().isConnected());
+ QVERIFY(dbus->connection().isConnected());
root = getInterface("/org/a11y/atspi/accessible/root",
"org.a11y.atspi.Accessible");
diff --git a/tests/auto/other/qprocess_and_guieventloop/tst_qprocess_and_guieventloop.cpp b/tests/auto/other/qprocess_and_guieventloop/tst_qprocess_and_guieventloop.cpp
index 53459b13f6..b79b3aba28 100644
--- a/tests/auto/other/qprocess_and_guieventloop/tst_qprocess_and_guieventloop.cpp
+++ b/tests/auto/other/qprocess_and_guieventloop/tst_qprocess_and_guieventloop.cpp
@@ -45,9 +45,11 @@ private slots:
void tst_QProcess_and_GuiEventLoop::waitForAndEventLoop()
{
-#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK)
+#if defined(QT_NO_PROCESS)
+ QSKIP("QProcess not supported");
+#elif defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK)
QSKIP("Not supported on Android");
-#endif
+#else
// based on testcase provided in QTBUG-39488
QByteArray msg = "Hello World";
@@ -78,6 +80,7 @@ void tst_QProcess_and_GuiEventLoop::waitForAndEventLoop()
QCOMPARE(process.exitCode(), 0);
QCOMPARE(spy.count(), 1);
QCOMPARE(process.readAll().trimmed(), msg);
+#endif
}
QTEST_MAIN(tst_QProcess_and_GuiEventLoop)
diff --git a/tests/auto/testlib/selftests/expected_crashes_3.txt b/tests/auto/testlib/selftests/expected_crashes_3.txt
index 57c3ddc2ba..0e3f60dd1b 100644
--- a/tests/auto/testlib/selftests/expected_crashes_3.txt
+++ b/tests/auto/testlib/selftests/expected_crashes_3.txt
@@ -2,6 +2,7 @@
Config: Using QtTest library @INSERT_QT_VERSION_HERE@, Qt @INSERT_QT_VERSION_HERE@
PASS : tst_Crashes::initTestCase()
QFATAL : tst_Crashes::crash() Received signal 11
+ Function time: ms Total time: ms
FAIL! : tst_Crashes::crash() Received a fatal error.
Loc: [Unknown file(0)]
Totals: 1 passed, 1 failed, 0 skipped, 0 blacklisted
diff --git a/tests/auto/testlib/selftests/tst_selftests.cpp b/tests/auto/testlib/selftests/tst_selftests.cpp
index 42d929c4a1..63c48fc809 100644
--- a/tests/auto/testlib/selftests/tst_selftests.cpp
+++ b/tests/auto/testlib/selftests/tst_selftests.cpp
@@ -316,6 +316,7 @@ tst_Selftests::tst_Selftests()
void tst_Selftests::initTestCase()
{
+ QVERIFY2(tempDir.isValid(), qPrintable(tempDir.errorString()));
//Detect the location of the sub programs
QString subProgram = QLatin1String("float/float");
#if defined(Q_OS_WIN)
@@ -625,13 +626,28 @@ void tst_Selftests::doRunSubTest(QString const& subdir, QStringList const& logge
for (int n = 0; n < loggers.count(); ++n) {
QString logger = loggers[n];
-#if defined(Q_OS_WIN)
- if (n == 0 && subdir == QLatin1String("crashes")) { // Remove stack trace which is output to stdout.
- const int exceptionLogStart = actualOutputs.first().indexOf("A crash occurred in ");
+ if (n == 0 && subdir == QLatin1String("crashes")) {
+ QByteArray &actual = actualOutputs[0];
+#ifndef Q_OS_WIN
+ // Remove digits of times to match the expected file.
+ const QLatin1String timePattern("Function time:");
+ int timePos = actual.indexOf(timePattern);
+ if (timePos >= 0) {
+ timePos += timePattern.size();
+ const int nextLinePos = actual.indexOf('\n', timePos);
+ for (int c = (nextLinePos != -1 ? nextLinePos : actual.size()) - 1; c >= timePos; --c) {
+ if (actual.at(c) >= '0' && actual.at(c) <= '9')
+ actual.remove(c, 1);
+ }
+ }
+#else // !Q_OS_WIN
+ // Remove stack trace which is output to stdout.
+ const int exceptionLogStart = actual.indexOf("A crash occurred in ");
if (exceptionLogStart >= 0)
- actualOutputs[0].truncate(exceptionLogStart);
- }
+ actual.truncate(exceptionLogStart);
#endif // Q_OS_WIN
+ }
+
QList<QByteArray> res = splitLines(actualOutputs[n]);
const QString expectedFileName = expectedFileNameFromTest(subdir, logger);
QList<QByteArray> exp = expectedResult(expectedFileName);
diff --git a/tests/auto/tools/uic/tst_uic.cpp b/tests/auto/tools/uic/tst_uic.cpp
index eac80bed7a..42c8e3e7b9 100644
--- a/tests/auto/tools/uic/tst_uic.cpp
+++ b/tests/auto/tools/uic/tst_uic.cpp
@@ -86,6 +86,7 @@ static QByteArray msgProcessStartFailed(const QString &command, const QString &w
void tst_uic::initTestCase()
{
+ QVERIFY2(m_generated.isValid(), qPrintable(m_generated.errorString()));
QVERIFY(m_versionRegexp.isValid());
m_baseline = QFINDTESTDATA("baseline");
QVERIFY2(!m_baseline.isEmpty(), "Could not find 'baseline'.");
diff --git a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp
index fbd368d077..16ff118a3f 100644
--- a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp
+++ b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp
@@ -483,11 +483,11 @@ void tst_QFiledialog::completer()
if (startPath.isEmpty()) {
tempDir.reset(new QTemporaryDir);
- QVERIFY(tempDir->isValid());
+ QVERIFY2(tempDir->isValid(), qPrintable(tempDir->errorString()));
startPath = tempDir->path();
for (int i = 0; i < 10; ++i) {
TemporaryFilePtr file(new QTemporaryFile(startPath + QStringLiteral("/rXXXXXX")));
- QVERIFY(file->open());
+ QVERIFY2(file->open(), qPrintable(file->errorString()));
files.append(file);
}
}
@@ -889,7 +889,7 @@ void tst_QFiledialog::selectFile()
QScopedPointer<QTemporaryFile> tempFile;
if (file == QLatin1String("temp")) {
tempFile.reset(new QTemporaryFile(QDir::tempPath() + QStringLiteral("/aXXXXXX")));
- QVERIFY(tempFile->open());
+ QVERIFY2(tempFile->open(), qPrintable(tempFile->errorString()));
file = tempFile->fileName();
}
@@ -927,7 +927,7 @@ void tst_QFiledialog::selectFileWrongCaseSaveAs()
void tst_QFiledialog::selectFiles()
{
QTemporaryDir tempDir;
- QVERIFY(tempDir.isValid());
+ QVERIFY2(tempDir.isValid(), qPrintable(tempDir.errorString()));
const QString tempPath = tempDir.path();
{
QNonNativeFileDialog fd;
diff --git a/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp b/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp
index 1e9cbe6578..cca150eb54 100644
--- a/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp
+++ b/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp
@@ -81,6 +81,12 @@ public:
}
};
+static QByteArray msgDoesNotExist(const QString &name)
+{
+ return (QLatin1Char('"') + QDir::toNativeSeparators(name)
+ + QLatin1String("\" does not exist.")).toLocal8Bit();
+}
+
class tst_QFileDialog2 : public QObject
{
Q_OBJECT
@@ -171,7 +177,7 @@ void tst_QFileDialog2::cleanupSettingsFile()
void tst_QFileDialog2::initTestCase()
{
- QVERIFY(tempDir.isValid());
+ QVERIFY2(tempDir.isValid(), qPrintable(tempDir.errorString()));
QStandardPaths::setTestModeEnabled(true);
cleanupSettingsFile();
}
@@ -243,13 +249,13 @@ void tst_QFileDialog2::deleteDirAndFiles()
QTemporaryFile *t;
t = new QTemporaryFile(tempPath + "/foo/aXXXXXX");
t->setAutoRemove(false);
- t->open();
+ QVERIFY2(t->open(), qPrintable(t->errorString()));
t->close();
delete t;
t = new QTemporaryFile(tempPath + "/foo/B/yXXXXXX");
t->setAutoRemove(false);
- t->open();
+ QVERIFY2(t->open(), qPrintable(t->errorString()));
t->close();
delete t;
FriendlyQFileDialog fd;
@@ -307,7 +313,7 @@ void tst_QFileDialog2::unc()
#else
QString dir(QDir::currentPath());
#endif
- QVERIFY(QFile::exists(dir));
+ QVERIFY2(QFile::exists(dir), msgDoesNotExist(dir).constData());
QNonNativeFileDialog fd(0, QString(), dir);
QFileSystemModel *model = fd.findChild<QFileSystemModel*>("qt_filesystem_model");
QVERIFY(model);
@@ -849,7 +855,7 @@ void tst_QFileDialog2::task228844_ensurePreviousSorting()
current.mkdir("f");
current.mkdir("g");
QTemporaryFile *tempFile = new QTemporaryFile(current.absolutePath() + "/rXXXXXX");
- tempFile->open();
+ QVERIFY2(tempFile->open(), qPrintable(tempFile->errorString()));
current.cdUp();
QNonNativeFileDialog fd;
@@ -1108,6 +1114,7 @@ void tst_QFileDialog2::task254490_selectFileMultipleTimes()
QString tempPath = tempDir.path();
QTemporaryFile *t;
t = new QTemporaryFile;
+ QVERIFY2(t->open(), qPrintable(t->errorString()));
t->open();
QNonNativeFileDialog fd(0, "TestFileDialog");
@@ -1209,7 +1216,7 @@ void tst_QFileDialog2::QTBUG4419_lineEditSelectAll()
{
QString tempPath = tempDir.path();
QTemporaryFile temporaryFile(tempPath + "/tst_qfiledialog2_lineEditSelectAll.XXXXXX");
- QVERIFY(temporaryFile.open());
+ QVERIFY2(temporaryFile.open(), qPrintable(temporaryFile.errorString()));
QNonNativeFileDialog fd(0, "TestFileDialog", temporaryFile.fileName());
fd.setDirectory(tempPath);
diff --git a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
index bbe027fbc6..a70be695ef 100644
--- a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
+++ b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
@@ -173,7 +173,7 @@ void tst_QFileSystemModel::cleanup()
void tst_QFileSystemModel::initTestCase()
{
- QVERIFY(m_tempDir.isValid());
+ QVERIFY2(m_tempDir.isValid(), qPrintable(m_tempDir.errorString()));
flatDirTestPath = m_tempDir.path();
}
@@ -318,7 +318,7 @@ void tst_QFileSystemModel::readOnly()
{
QCOMPARE(model->isReadOnly(), true);
QTemporaryFile file(flatDirTestPath + QStringLiteral("/XXXXXX.dat"));
- file.open();
+ QVERIFY2(file.open(), qPrintable(file.errorString()));
QModelIndex root = model->setRootPath(flatDirTestPath);
QTRY_VERIFY(model->rowCount(root) > 0);
@@ -819,7 +819,7 @@ void tst_QFileSystemModel::setData()
void tst_QFileSystemModel::sortPersistentIndex()
{
QTemporaryFile file(flatDirTestPath + QStringLiteral("/XXXXXX.dat"));
- file.open();
+ QVERIFY2(file.open(), qPrintable(file.errorString()));
QModelIndex root = model->setRootPath(flatDirTestPath);
QTRY_VERIFY(model->rowCount(root) > 0);
diff --git a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp
index f066f526eb..b7804da4ad 100644
--- a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp
+++ b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp
@@ -149,6 +149,7 @@ private slots:
void spacing();
void testScrollToWithHidden();
void testViewOptions();
+ void taskQTBUG_39902_mutualScrollBars_data();
void taskQTBUG_39902_mutualScrollBars();
void horizontalScrollingByVerticalWheelEvents();
};
@@ -2361,8 +2362,21 @@ private:
QStyle* m_oldStyle;
};
+void tst_QListView::taskQTBUG_39902_mutualScrollBars_data()
+{
+ QTest::addColumn<QAbstractItemView::ScrollMode>("horizontalScrollMode");
+ QTest::addColumn<QAbstractItemView::ScrollMode>("verticalScrollMode");
+ QTest::newRow("per item / per item") << QAbstractItemView::ScrollPerItem << QAbstractItemView::ScrollPerItem;
+ QTest::newRow("per pixel / per item") << QAbstractItemView::ScrollPerPixel << QAbstractItemView::ScrollPerItem;
+ QTest::newRow("per item / per pixel") << QAbstractItemView::ScrollPerItem << QAbstractItemView::ScrollPerPixel;
+ QTest::newRow("per pixel / per pixel") << QAbstractItemView::ScrollPerPixel << QAbstractItemView::ScrollPerPixel;
+}
+
void tst_QListView::taskQTBUG_39902_mutualScrollBars()
{
+ QFETCH(QAbstractItemView::ScrollMode, horizontalScrollMode);
+ QFETCH(QAbstractItemView::ScrollMode, verticalScrollMode);
+
QWidget window;
window.resize(400, 300);
QListView *view = new QListView(&window);
@@ -2374,6 +2388,9 @@ void tst_QListView::taskQTBUG_39902_mutualScrollBars()
model.setData(model.index(i, 0), itemSize, Qt::SizeHintRole);
view->setModel(&model);
+ view->setVerticalScrollMode(verticalScrollMode);
+ view->setHorizontalScrollMode(horizontalScrollMode);
+
window.show();
QVERIFY(QTest::qWaitForWindowExposed(&window));
// make sure QListView is done with layouting the items (1/10 sec, like QListView)
@@ -2414,7 +2431,7 @@ void tst_QListView::taskQTBUG_39902_mutualScrollBars()
QTRY_VERIFY(view->horizontalScrollBar()->isVisible());
QTRY_VERIFY(view->verticalScrollBar()->isVisible());
- // now remove just one single pixel in with -> both scroll bars will show up since they depend on each other
+ // now remove just one single pixel in width -> both scroll bars will show up since they depend on each other
view->resize(itemSize.width() + view->frameWidth() * 2 - 1, model.rowCount() * itemSize.height() + view->frameWidth() * 2);
QTRY_VERIFY(view->horizontalScrollBar()->isVisible());
QTRY_VERIFY(view->verticalScrollBar()->isVisible());
@@ -2423,6 +2440,11 @@ void tst_QListView::taskQTBUG_39902_mutualScrollBars()
view->resize(itemSize.width() + view->frameWidth() * 2, model.rowCount() * itemSize.height() + view->frameWidth() * 2);
QTRY_VERIFY(!view->horizontalScrollBar()->isVisible());
QTRY_VERIFY(!view->verticalScrollBar()->isVisible());
+
+ // now remove just one single pixel in height -> both scroll bars will show up since they depend on each other
+ view->resize(itemSize.width() + view->frameWidth() * 2, model.rowCount() * itemSize.height() + view->frameWidth() * 2 - 1);
+ QTRY_VERIFY(view->horizontalScrollBar()->isVisible());
+ QTRY_VERIFY(view->verticalScrollBar()->isVisible());
}
void tst_QListView::horizontalScrollingByVerticalWheelEvents()
diff --git a/tests/auto/widgets/itemviews/qtablewidget/tst_qtablewidget.cpp b/tests/auto/widgets/itemviews/qtablewidget/tst_qtablewidget.cpp
index 6d2b2ea964..ea31fd19dd 100644
--- a/tests/auto/widgets/itemviews/qtablewidget/tst_qtablewidget.cpp
+++ b/tests/auto/widgets/itemviews/qtablewidget/tst_qtablewidget.cpp
@@ -94,6 +94,7 @@ private slots:
void task262056_sortDuplicate();
void itemWithHeaderItems();
void mimeData();
+ void selectedRowAfterSorting();
private:
QTableWidget *testWidget;
@@ -1565,5 +1566,23 @@ void tst_QTableWidget::mimeData()
delete data2;
}
+void tst_QTableWidget::selectedRowAfterSorting()
+{
+ TestTableWidget table(3,3);
+ table.setSelectionBehavior(QAbstractItemView::SelectRows);
+ for (int r = 0; r < 3; r++)
+ for (int c = 0; c < 3; c++)
+ table.setItem(r,c,new QTableWidgetItem(QStringLiteral("0")));
+ QHeaderView *localHorizontalHeader = table.horizontalHeader();
+ localHorizontalHeader->setSortIndicator(1,Qt::DescendingOrder);
+ table.setProperty("sortingEnabled",true);
+ table.selectRow(1);
+ table.item(1,1)->setText("9");
+ QCOMPARE(table.selectedItems().count(),3);
+ foreach (QTableWidgetItem *item, table.selectedItems()) {
+ QCOMPARE(item->row(),0);
+ }
+}
+
QTEST_MAIN(tst_QTableWidget)
#include "tst_qtablewidget.moc"
diff --git a/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp b/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp
index 4bdb299213..5188dfbcfa 100644
--- a/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp
+++ b/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp
@@ -338,30 +338,30 @@ void tst_QWidget_window::tst_windowFilePath()
void tst_QWidget_window::tst_showWithoutActivating()
{
-#ifndef Q_DEAD_CODE_FROM_QT4_X11
- QSKIP("This test is X11-only.");
-#else
- QWidget w;
- w.show();
- QVERIFY(QTest::qWaitForWindowExposed(&w));
- QApplication::processEvents();
+ QString platformName = QGuiApplication::platformName().toLower();
+ if (platformName == "cocoa")
+ QSKIP("Cocoa: This fails. Figure out why.");
+ else if (platformName != QStringLiteral("xcb")
+ && platformName != QStringLiteral("windows")
+ && platformName != QStringLiteral("ios"))
+ QSKIP("Qt::WA_ShowWithoutActivating is currently supported only on xcb, windows, and ios platforms.");
+
+ QWidget w1;
+ w1.setAttribute(Qt::WA_ShowWithoutActivating);
+ w1.show();
+ QVERIFY(!QTest::qWaitForWindowActive(&w1));
+
+ QWidget w2;
+ w2.show();
+ QVERIFY(QTest::qWaitForWindowActive(&w2));
+
+ QWidget w3;
+ w3.setAttribute(Qt::WA_ShowWithoutActivating);
+ w3.show();
+ QVERIFY(!QTest::qWaitForWindowActive(&w3));
- QApplication::clipboard();
- QLineEdit *lineEdit = new QLineEdit;
- lineEdit->setAttribute(Qt::WA_ShowWithoutActivating, true);
- lineEdit->show();
- lineEdit->setAttribute(Qt::WA_ShowWithoutActivating, false);
- lineEdit->raise();
- lineEdit->activateWindow();
-
- Window window;
- int revertto;
- QTRY_COMPARE(lineEdit->winId(),
- (XGetInputFocus(QX11Info::display(), &window, &revertto), window) );
- // Note the use of the , before window because we want the XGetInputFocus to be re-executed
- // in each iteration of the inside loop of the QTRY_COMPARE macro
-
-#endif // Q_DEAD_CODE_FROM_QT4_X11
+ w3.activateWindow();
+ QVERIFY(QTest::qWaitForWindowActive(&w3));
}
void tst_QWidget_window::tst_paintEventOnSecondShow()
diff --git a/tests/auto/widgets/util/qundogroup/tst_qundogroup.cpp b/tests/auto/widgets/util/qundogroup/tst_qundogroup.cpp
index f19ef391ff..781adeedad 100644
--- a/tests/auto/widgets/util/qundogroup/tst_qundogroup.cpp
+++ b/tests/auto/widgets/util/qundogroup/tst_qundogroup.cpp
@@ -193,9 +193,7 @@ private slots:
void deleteStack();
void checkSignals();
void addStackAndDie();
-#ifndef QT_NO_PROCESS
void commandTextFormat();
-#endif
};
tst_QUndoGroup::tst_QUndoGroup()
@@ -599,9 +597,11 @@ void tst_QUndoGroup::addStackAndDie()
delete stack;
}
-#ifndef QT_NO_PROCESS
void tst_QUndoGroup::commandTextFormat()
{
+#ifdef QT_NO_PROCESS
+ QSKIP("No QProcess available");
+#else
QString binDir = QLibraryInfo::location(QLibraryInfo::BinariesPath);
if (QProcess::execute(binDir + "/lrelease -version") != 0)
@@ -643,8 +643,8 @@ void tst_QUndoGroup::commandTextFormat()
QCOMPARE(redo_action->text(), QString("redo-prefix append redo-suffix"));
qApp->removeTranslator(&translator);
-}
#endif
+}
#else
class tst_QUndoGroup : public QObject
diff --git a/tests/auto/widgets/util/qundostack/tst_qundostack.cpp b/tests/auto/widgets/util/qundostack/tst_qundostack.cpp
index 29bc14f372..2c8a9a3ee5 100644
--- a/tests/auto/widgets/util/qundostack/tst_qundostack.cpp
+++ b/tests/auto/widgets/util/qundostack/tst_qundostack.cpp
@@ -239,9 +239,7 @@ private slots:
void macroBeginEnd();
void compression();
void undoLimit();
-#ifndef QT_NO_PROCESS
void commandTextFormat();
-#endif
void separateUndoText();
};
@@ -2958,9 +2956,11 @@ void tst_QUndoStack::undoLimit()
true); // redoChanged
}
-#ifndef QT_NO_PROCESS
void tst_QUndoStack::commandTextFormat()
{
+#ifdef QT_NO_PROCESS
+ QSKIP("No QProcess available");
+#else
QString binDir = QLibraryInfo::location(QLibraryInfo::BinariesPath);
if (QProcess::execute(binDir + "/lrelease -version") != 0)
@@ -2999,8 +2999,8 @@ void tst_QUndoStack::commandTextFormat()
QCOMPARE(redo_action->text(), QString("redo-prefix append redo-suffix"));
qApp->removeTranslator(&translator);
-}
#endif
+}
void tst_QUndoStack::separateUndoText()
{
diff --git a/tools/configure/Makefile.mingw b/tools/configure/Makefile.mingw
index 539664e7d6..f4513c64d6 100644
--- a/tools/configure/Makefile.mingw
+++ b/tools/configure/Makefile.mingw
@@ -89,7 +89,7 @@ $(OBJECTS): $(PCH)
# sh-compatible shell. This is not a problem, because configure.bat
# will not do that.
ifeq ($(SHELL), sh.exe)
- ifeq ($(wildcard $(CURDIR)/sh.exe), )
+ ifeq ($(wildcard "$(CURDIR)/sh.exe"), )
SH = 0
else
SH = 1
diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp
index ad2444ff81..6934e72476 100644
--- a/tools/configure/configureapp.cpp
+++ b/tools/configure/configureapp.cpp
@@ -83,7 +83,7 @@ static inline void promptKeyPress()
exit(0); // Exit cleanly for Ctrl+C
}
-Configure::Configure(int& argc, char** argv)
+Configure::Configure(int& argc, char** argv) : verbose(0)
{
// Default values for indentation
optionIndent = 4;
@@ -383,6 +383,7 @@ void Configure::parseCmdLine()
configCmdLine.clear();
reloadCmdLine();
}
+
else if (configCmdLine.at(i) == "-loadconfig") {
++i;
if (i != argCount) {
@@ -420,6 +421,10 @@ void Configure::parseCmdLine()
|| configCmdLine.at(i) == "-?")
dictionary[ "HELP" ] = "yes";
+ else if (configCmdLine.at(i) == "-v" || configCmdLine.at(i) == "-verbose") {
+ ++verbose;
+ }
+
else if (configCmdLine.at(i) == "-qconfig") {
++i;
if (i == argCount)
@@ -908,13 +913,15 @@ void Configure::parseCmdLine()
} else if (configCmdLine.at(i) == "-no-qdbus") {
dictionary[ "DBUS" ] = "no";
} else if (configCmdLine.at(i) == "-qdbus") {
- dictionary[ "DBUS" ] = "yes";
+ dictionary[ "DBUS" ] = "auto";
} else if (configCmdLine.at(i) == "-no-dbus") {
dictionary[ "DBUS" ] = "no";
} else if (configCmdLine.at(i) == "-dbus") {
- dictionary[ "DBUS" ] = "yes";
+ dictionary[ "DBUS" ] = "auto";
} else if (configCmdLine.at(i) == "-dbus-linked") {
dictionary[ "DBUS" ] = "linked";
+ } else if (configCmdLine.at(i) == "-dbus-runtime") {
+ dictionary[ "DBUS" ] = "runtime";
} else if (configCmdLine.at(i) == "-audio-backend") {
dictionary[ "AUDIO_BACKEND" ] = "yes";
} else if (configCmdLine.at(i) == "-no-audio-backend") {
@@ -2030,8 +2037,8 @@ bool Configure::displayHelp()
desc("LIBPROXY", "no", "-no-libproxy", "Do not compile in libproxy support.");
desc("LIBPROXY", "yes", "-libproxy", "Compile in libproxy support (for cross compilation targets).\n");
desc("DBUS", "no", "-no-dbus", "Do not compile in D-Bus support.");
- desc("DBUS", "yes", "-dbus", "Compile in D-Bus support and load libdbus-1\ndynamically.");
desc("DBUS", "linked", "-dbus-linked", "Compile in D-Bus support and link to libdbus-1.\n");
+ desc("DBUS", "runtime", "-dbus-runtime", "Compile in D-Bus support and load libdbus-1\ndynamically.");
desc("AUDIO_BACKEND", "no","-no-audio-backend", "Do not compile in the platform audio backend into\nQt Multimedia.");
desc("AUDIO_BACKEND", "yes","-audio-backend", "Compile in the platform audio backend into Qt Multimedia.\n");
desc("WMF_BACKEND", "no","-no-wmf-backend", "Do not compile in the windows media foundation backend\ninto Qt Multimedia.");
@@ -2063,6 +2070,7 @@ bool Configure::displayHelp()
desc( "-loadconfig <config>", "Run configure with the parameters from file configure_<config>.cache.");
desc( "-saveconfig <config>", "Run configure and save the parameters in file configure_<config>.cache.");
desc( "-redo", "Run configure with the same parameters as last time.\n");
+ desc( "-v, -verbose", "Run configure tests with verbose output.\n");
// Qt\Windows CE only options go below here -----------------------------------------------------------------------------
desc("Qt for Windows CE only:\n\n");
@@ -2523,7 +2531,7 @@ void Configure::autoDetection()
if (dictionary["LIBPROXY"] == "auto")
dictionary["LIBPROXY"] = checkAvailability("LIBPROXY") ? "yes" : "no";
if (dictionary["DBUS"] == "auto")
- dictionary["DBUS"] = checkAvailability("DBUS") ? "yes" : "no";
+ dictionary["DBUS"] = checkAvailability("DBUS") ? "linked" : "runtime";
if (dictionary["QML_DEBUG"] == "auto")
dictionary["QML_DEBUG"] = dictionary["QML"] == "yes" ? "yes" : "no";
if (dictionary["AUDIO_BACKEND"] == "auto")
@@ -2604,6 +2612,8 @@ void Configure::autoDetection()
dictionary["QT_POINTER_SIZE"] = "8";
else
dictionary["QT_POINTER_SIZE"] = "4";
+
+ cout << "Done running configuration tests." << endl;
}
bool Configure::verifyConfiguration()
@@ -2991,7 +3001,7 @@ void Configure::generateOutputVars()
if (dictionary[ "LIBPROXY" ] == "yes")
qtConfig += "libproxy";
- if (dictionary[ "DBUS" ] == "yes")
+ if (dictionary[ "DBUS" ] == "runtime")
qtConfig += "dbus";
else if (dictionary[ "DBUS" ] == "linked")
qtConfig += "dbus dbus-linked";
@@ -3101,7 +3111,7 @@ void Configure::generateOutputVars()
qmakeVars += QString("OPENSSL_LIBS += -L%1/lib").arg(opensslPath);
}
}
- if (dictionary[ "DBUS" ] != "no") {
+ if (dictionary[ "DBUS" ] == "linked") {
if (!dbusPath.isEmpty()) {
qmakeVars += QString("QT_CFLAGS_DBUS = -I%1/include").arg(dbusPath);
qmakeVars += QString("QT_LIBS_DBUS = -L%1/lib").arg(dbusPath);
@@ -3402,7 +3412,7 @@ bool Configure::tryCompileProject(const QString &projectPath, const QString &ext
}
// run qmake
- QString command = QString("%1 %2 %3 2>&1")
+ QString command = QString("%1 %2 %3")
.arg(QDir::toNativeSeparators(QDir(newpwd).relativeFilePath(buildPath + "/bin/qmake.exe")),
QDir::toNativeSeparators(sourcePath + "/config.tests/" + projectPath),
extraOptions);
@@ -3414,6 +3424,11 @@ bool Configure::tryCompileProject(const QString &projectPath, const QString &ext
addSysroot(&command);
}
+ if (verbose)
+ cout << qPrintable(command) << endl;
+ else
+ command += " 2>&1";
+
int code = 0;
QString output = Environment::execute(command, &code);
//cout << output << endl;
@@ -3423,7 +3438,10 @@ bool Configure::tryCompileProject(const QString &projectPath, const QString &ext
command = dictionary[ "MAKE" ];
if (command.contains("nmake") || command.contains("jom"))
command += " /NOLOGO";
- command += " -s 2>&1";
+ if (verbose)
+ cout << qPrintable(command) << endl;
+ else
+ command += " -s 2>&1";
output = Environment::execute(command, &code);
//cout << output << endl;
diff --git a/tools/configure/configureapp.h b/tools/configure/configureapp.h
index c3685d9ff2..5361cc2b1d 100644
--- a/tools/configure/configureapp.h
+++ b/tools/configure/configureapp.h
@@ -94,6 +94,8 @@ private:
bool checkAngleAvailability(QString *errorMessage = 0) const;
QString checkAvx512Availability();
+ int verbose;
+
// Our variable dictionaries
QMap<QString,QString> dictionary;
QStringList allBuildParts;
diff --git a/util/unicode/writingSystems.sh b/util/unicode/writingSystems.sh
index 8902d97d71..5783fe7797 100755
--- a/util/unicode/writingSystems.sh
+++ b/util/unicode/writingSystems.sh
@@ -1,5 +1,5 @@
-
#!/bin/sh
+
#############################################################################
##
## Copyright (C) 2015 The Qt Company Ltd.