summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore7
-rwxr-xr-xconfigure40
-rw-r--r--dist/changes-5.0.018
-rw-r--r--doc/src/snippets/code/doc_src_examples_textfinder.pro2
-rw-r--r--examples/widgets/widgets/softkeys/main.cpp50
-rw-r--r--examples/widgets/widgets/softkeys/softkeys.cpp188
-rw-r--r--examples/widgets/widgets/softkeys/softkeys.desktop11
-rw-r--r--examples/widgets/widgets/softkeys/softkeys.h88
-rw-r--r--examples/widgets/widgets/softkeys/softkeys.pro13
-rw-r--r--examples/widgets/widgets/wiggly/dialog.cpp11
-rw-r--r--mkspecs/features/create_cmake.prf2
-rw-r--r--mkspecs/features/default_pre.prf14
-rw-r--r--mkspecs/features/qml1_module.prf2
-rw-r--r--mkspecs/features/qml1_plugin.prf2
-rw-r--r--mkspecs/features/qml_module.prf9
-rw-r--r--mkspecs/features/qml_plugin.prf37
-rw-r--r--mkspecs/features/qt.prf52
-rw-r--r--mkspecs/features/qt_build_config.prf10
-rw-r--r--mkspecs/features/qt_build_paths.prf14
-rw-r--r--mkspecs/features/qt_functions.prf35
-rw-r--r--mkspecs/features/qt_module.prf29
-rw-r--r--mkspecs/features/qt_module_fwdpri.prf27
-rw-r--r--mkspecs/features/qt_module_headers.prf12
-rw-r--r--mkspecs/features/qt_plugin.prf32
-rw-r--r--mkspecs/features/qt_tool.prf20
-rw-r--r--qmake/library/qmakeevaluator.cpp14
-rw-r--r--qmake/property.cpp2
-rw-r--r--qtbase.pro10
-rw-r--r--src/angle/src/config.pri2
-rw-r--r--src/angle/src/libGLESv2/libGLESv2.pro4
-rw-r--r--src/corelib/Qt5CTestMacros.cmake80
-rw-r--r--src/corelib/codecs/codecs.qdoc6
-rw-r--r--src/corelib/doc/snippets/code/src_corelib_tools_qregularexpression.cpp124
-rw-r--r--src/corelib/doc/snippets/qprocess/qprocess-simpleexecution.cpp2
-rw-r--r--src/corelib/doc/src/animation.qdoc8
-rw-r--r--src/corelib/doc/src/containers.qdoc30
-rw-r--r--src/corelib/doc/src/datastreamformat.qdoc4
-rw-r--r--src/corelib/doc/src/eventsandfilters.qdoc7
-rw-r--r--src/corelib/doc/src/implicit-sharing.qdoc6
-rw-r--r--src/corelib/doc/src/io.qdoc8
-rw-r--r--src/corelib/doc/src/json.qdoc3
-rw-r--r--src/corelib/doc/src/plugins-howto.qdoc8
-rw-r--r--src/corelib/doc/src/qtcore-index.qdoc119
-rw-r--r--src/corelib/doc/src/qtcore.qdoc7
-rw-r--r--src/corelib/doc/src/statemachine.qdoc7
-rw-r--r--src/corelib/doc/src/threads.qdoc28
-rw-r--r--src/corelib/global/qfeatures.h5
-rw-r--r--src/corelib/global/qfeatures.txt7
-rw-r--r--src/corelib/global/qlibraryinfo.cpp8
-rw-r--r--src/corelib/global/qlibraryinfo.h4
-rw-r--r--src/corelib/global/qnamespace.h5
-rw-r--r--src/corelib/global/qnamespace.qdoc19
-rw-r--r--src/corelib/global/qt_windows.h13
-rw-r--r--src/corelib/io/io.pri4
-rw-r--r--src/corelib/io/qfilesystemengine.cpp7
-rw-r--r--src/corelib/io/qfilesystemwatcher.cpp7
-rw-r--r--src/corelib/io/qfilesystemwatcher_inotify.cpp8
-rw-r--r--src/corelib/io/qprocess.cpp4
-rw-r--r--src/corelib/io/qstandardpaths.cpp2
-rw-r--r--src/corelib/io/qstandardpaths_json.cpp258
-rw-r--r--src/corelib/io/qwindowspipereader.cpp8
-rw-r--r--src/corelib/itemmodels/qabstractitemmodel_p.h2
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp28
-rw-r--r--src/corelib/kernel/qcoreapplication.h6
-rw-r--r--src/corelib/kernel/qcoreevent.cpp1
-rw-r--r--src/corelib/kernel/qcoreevent.h2
-rw-r--r--src/corelib/kernel/qeventdispatcher_blackberry.cpp55
-rw-r--r--src/corelib/kernel/qeventdispatcher_blackberry_p.h6
-rw-r--r--src/corelib/kernel/qeventdispatcher_unix.cpp57
-rw-r--r--src/corelib/kernel/qeventdispatcher_unix_p.h2
-rw-r--r--src/corelib/kernel/qmath.h48
-rw-r--r--src/corelib/kernel/qmimedata.cpp3
-rw-r--r--src/corelib/thread/qfutureinterface.cpp10
-rw-r--r--src/corelib/thread/qfutureinterface.h15
-rw-r--r--src/corelib/thread/qfutureinterface_p.h26
-rw-r--r--src/corelib/tools/qdatetime.cpp114
-rw-r--r--src/corelib/tools/qdatetime.h4
-rw-r--r--src/corelib/tools/qmap.cpp18
-rw-r--r--src/corelib/tools/qmap.h12
-rw-r--r--src/corelib/tools/qregexp.cpp3
-rw-r--r--src/corelib/tools/qvector.h6
-rw-r--r--src/dbus/qdbusdemarshaller.cpp1
-rw-r--r--src/gui/accessible/qaccessible.cpp3
-rw-r--r--src/gui/accessible/qaccessible.h4
-rw-r--r--src/gui/image/qimage.cpp10
-rw-r--r--src/gui/image/qpnghandler.cpp7
-rw-r--r--src/gui/itemmodels/qstandarditemmodel.cpp18
-rw-r--r--src/gui/kernel/qguiapplication.cpp20
-rw-r--r--src/gui/kernel/qguiapplication_p.h1
-rw-r--r--src/gui/kernel/qplatformintegration.cpp4
-rw-r--r--src/gui/kernel/qplatformintegration.h11
-rw-r--r--src/gui/kernel/qplatformmenu.h1
-rw-r--r--src/gui/kernel/qwindow.cpp54
-rw-r--r--src/gui/kernel/qwindow.h19
-rw-r--r--src/gui/kernel/qwindow_p.h1
-rw-r--r--src/gui/opengl/qopenglframebufferobject.cpp1
-rw-r--r--src/gui/painting/qpainter.cpp5
-rw-r--r--src/gui/painting/qpathclipper.cpp1
-rw-r--r--src/gui/text/qfontengine.cpp7
-rw-r--r--src/gui/text/qsyntaxhighlighter.cpp29
-rw-r--r--src/gui/text/qtextlayout.cpp4
-rw-r--r--src/network/access/qhttpnetworkconnectionchannel.cpp1
-rw-r--r--src/network/access/qhttpnetworkrequest.cpp9
-rw-r--r--src/network/access/qnetworkrequest.cpp12
-rw-r--r--src/network/kernel/qnetworkproxy.cpp10
-rw-r--r--src/network/kernel/qnetworkproxy_blackberry.cpp23
-rw-r--r--src/network/socket/socket.pri4
-rw-r--r--src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp4
-rw-r--r--src/opengl/qglframebufferobject.cpp1
-rw-r--r--src/platformsupport/dnd/qsimpledrag.cpp15
-rw-r--r--src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm4
-rw-r--r--src/platformsupport/linuxaccessibility/atspiadaptor.cpp8
-rw-r--r--src/plugins/accessible/qaccessiblebase.pri2
-rw-r--r--src/plugins/accessible/widgets/itemviews.cpp30
-rw-r--r--src/plugins/accessible/widgets/qaccessiblewidgets.cpp5
-rw-r--r--src/plugins/accessible/widgets/qaccessiblewidgets.h1
-rw-r--r--src/plugins/accessible/widgets/simplewidgets.cpp17
-rw-r--r--src/plugins/accessible/widgets/widgets.pro4
-rw-r--r--src/plugins/bearer/blackberry/blackberry.pro6
-rw-r--r--src/plugins/bearer/blackberry/qbbengine.cpp5
-rw-r--r--src/plugins/bearer/connman/connman.pro6
-rw-r--r--src/plugins/bearer/corewlan/corewlan.pro6
-rw-r--r--src/plugins/bearer/generic/generic.pro6
-rw-r--r--src/plugins/bearer/nativewifi/nativewifi.pro6
-rw-r--r--src/plugins/bearer/networkmanager/networkmanager.pro6
-rw-r--r--src/plugins/bearer/nla/nla.pro6
-rw-r--r--src/plugins/generic/evdevkeyboard/evdevkeyboard.pro6
-rw-r--r--src/plugins/generic/evdevmouse/evdevmouse.pro6
-rw-r--r--src/plugins/generic/evdevtablet/evdevtablet.pro6
-rw-r--r--src/plugins/generic/evdevtouch/evdevtouch.pro6
-rw-r--r--src/plugins/generic/meego/meego.pro7
-rw-r--r--src/plugins/generic/tslib/tslib.pro6
-rw-r--r--src/plugins/imageformats/gif/gif.pro6
-rw-r--r--src/plugins/imageformats/ico/ico.pro6
-rw-r--r--src/plugins/imageformats/jpeg/jpeg.pro6
-rw-r--r--src/plugins/platforminputcontexts/ibus/ibus.pro7
-rw-r--r--src/plugins/platforminputcontexts/maliit/maliit.pro7
-rw-r--r--src/plugins/platforms/cocoa/cocoa.pro5
-rw-r--r--src/plugins/platforms/cocoa/qcocoaintegration.h2
-rw-r--r--src/plugins/platforms/cocoa/qcocoaintegration.mm20
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenu.h1
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenu.mm6
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenuitem.mm2
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.h1
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm15
-rw-r--r--src/plugins/platforms/cocoa/qnsview.h3
-rw-r--r--src/plugins/platforms/cocoa/qnsview.mm105
-rw-r--r--src/plugins/platforms/cocoa/qprintengine_mac.mm4
-rw-r--r--src/plugins/platforms/directfb/directfb.pro5
-rw-r--r--src/plugins/platforms/eglfs/eglfs.pro7
-rw-r--r--src/plugins/platforms/eglfs/qeglfswindow.cpp3
-rw-r--r--src/plugins/platforms/kms/kms.pro6
-rw-r--r--src/plugins/platforms/linuxfb/linuxfb.pro7
-rw-r--r--src/plugins/platforms/minimal/minimal.pro6
-rw-r--r--src/plugins/platforms/minimal/qminimalintegration.cpp1
-rw-r--r--src/plugins/platforms/minimalegl/minimalegl.pro7
-rw-r--r--src/plugins/platforms/openwfd/openwf.pro5
-rw-r--r--src/plugins/platforms/qnx/qnx.pro6
-rw-r--r--src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp5
-rw-r--r--src/plugins/platforms/qnx/qqnxwindow.cpp14
-rw-r--r--src/plugins/platforms/windows/accessible/iaccessible2.cpp27
-rw-r--r--src/plugins/platforms/windows/qwindowsdialoghelpers.cpp504
-rw-r--r--src/plugins/platforms/windows/qwindowsdrag.cpp72
-rw-r--r--src/plugins/platforms/windows/qwindowsdrag.h6
-rw-r--r--src/plugins/platforms/windows/qwindowsintegration.cpp8
-rw-r--r--src/plugins/platforms/windows/qwindowsintegration.h4
-rw-r--r--src/plugins/platforms/windows/qwindowstheme.cpp2
-rw-r--r--src/plugins/platforms/windows/windows.pro6
-rw-r--r--src/plugins/platforms/xcb/qxcbcursor.cpp17
-rw-r--r--src/plugins/platforms/xcb/qxcbcursor.h2
-rw-r--r--src/plugins/platforms/xcb/qxcbintegration.cpp5
-rw-r--r--src/plugins/platforms/xcb/qxcbnativeinterface.cpp19
-rw-r--r--src/plugins/platforms/xcb/qxcbnativeinterface.h4
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.cpp18
-rw-r--r--src/plugins/platforms/xcb/xcb.pro5
-rw-r--r--src/plugins/printsupport/cocoa/cocoa.pro6
-rw-r--r--src/plugins/printsupport/cups/cups.pro6
-rw-r--r--src/plugins/printsupport/windows/windows.pro7
-rw-r--r--src/plugins/qpluginbase.pri1
-rw-r--r--src/plugins/sqldrivers/qsqldriverbase.pri6
-rw-r--r--src/printsupport/kernel/qprintengine_pdf.cpp9
-rw-r--r--src/printsupport/kernel/qprintengine_pdf_p.h2
-rw-r--r--src/printsupport/kernel/qprintengine_win.cpp16
-rw-r--r--src/sql/kernel/qsql.qdoc1
-rw-r--r--src/sql/models/qsqlrelationaldelegate.h11
-rw-r--r--src/testlib/qtestcase.cpp16
-rw-r--r--src/testlib/qtestlog.cpp10
-rw-r--r--src/testlib/qtestsystem.h6
-rw-r--r--src/tools/bootstrap/bootstrap.pri1
-rw-r--r--src/tools/bootstrap/bootstrap.pro1
-rw-r--r--src/tools/rcc/rcc.cpp2
-rw-r--r--src/widgets/dialogs/qdialog.cpp5
-rw-r--r--src/widgets/dialogs/qerrormessage.cpp16
-rw-r--r--src/widgets/dialogs/qfiledialog.cpp50
-rw-r--r--src/widgets/dialogs/qfiledialog_p.h1
-rw-r--r--src/widgets/dialogs/qprogressdialog.cpp22
-rw-r--r--src/widgets/dialogs/qwizard.cpp56
-rw-r--r--src/widgets/itemviews/qabstractitemview.cpp29
-rw-r--r--src/widgets/itemviews/qabstractitemview_p.h4
-rw-r--r--src/widgets/itemviews/qcolumnview.cpp2
-rw-r--r--src/widgets/itemviews/qfileiconprovider.cpp6
-rw-r--r--src/widgets/itemviews/qheaderview.cpp2
-rw-r--r--src/widgets/itemviews/qitemeditorfactory.cpp2
-rw-r--r--src/widgets/itemviews/qstyleditemdelegate.cpp4
-rw-r--r--src/widgets/itemviews/qtableview.cpp8
-rw-r--r--src/widgets/itemviews/qtreeview.cpp2
-rw-r--r--src/widgets/itemviews/qtreewidget.cpp2
-rw-r--r--src/widgets/itemviews/qtreewidgetitemiterator.cpp2
-rw-r--r--src/widgets/kernel/kernel.pri3
-rw-r--r--src/widgets/kernel/qaction.cpp51
-rw-r--r--src/widgets/kernel/qaction.h14
-rw-r--r--src/widgets/kernel/qaction_p.h4
-rw-r--r--src/widgets/kernel/qapplication.cpp3
-rw-r--r--src/widgets/kernel/qsoftkeymanager.cpp270
-rw-r--r--src/widgets/kernel/qwidget.cpp37
-rw-r--r--src/widgets/kernel/qwidgetwindow.cpp12
-rw-r--r--src/widgets/statemachine/qguistatemachine.cpp4
-rw-r--r--src/widgets/styles/qcommonstyle.cpp11
-rw-r--r--src/widgets/styles/qmacstyle_mac.mm9
-rw-r--r--src/widgets/styles/qstyleanimation.cpp45
-rw-r--r--src/widgets/styles/qstyleanimation_p.h24
-rw-r--r--src/widgets/styles/qstylehelper.cpp17
-rw-r--r--src/widgets/styles/qstylehelper_p.h2
-rw-r--r--src/widgets/styles/qwindowsvistastyle.cpp53
-rw-r--r--src/widgets/util/qsystemtrayicon_win.cpp14
-rw-r--r--src/widgets/widgets/qcombobox.cpp50
-rw-r--r--src/widgets/widgets/qcombobox.h4
-rw-r--r--src/widgets/widgets/qcombobox_p.h4
-rw-r--r--src/widgets/widgets/qdialogbuttonbox.cpp134
-rw-r--r--src/widgets/widgets/qlineedit.h1
-rw-r--r--src/widgets/widgets/qmenu.cpp23
-rw-r--r--src/widgets/widgets/qmenubar.cpp14
-rw-r--r--src/widgets/widgets/qmenubar_p.h3
-rw-r--r--sync.profile67
-rw-r--r--tests/auto/cmake/CMakeLists.txt24
-rw-r--r--tests/auto/cmake/test_concurrent_module/CMakeLists.txt22
-rw-r--r--tests/auto/cmake/test_concurrent_module/main.cpp (renamed from tests/auto/cmake/test_modules/main.cpp)41
-rw-r--r--tests/auto/cmake/test_modules/CMakeLists.txt44
-rw-r--r--tests/auto/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp43
-rw-r--r--tests/auto/corelib/io/qfile/tst_qfile.cpp37
-rw-r--r--tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp5
-rw-r--r--tests/auto/corelib/io/qprocess/test/test.pro1
-rw-r--r--tests/auto/corelib/io/qprocess/testForwarding/main.cpp3
-rw-r--r--tests/auto/corelib/io/qprocess/tst_qprocess.cpp307
-rw-r--r--tests/auto/corelib/io/qsettings/tst_qsettings.cpp8
-rw-r--r--tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp20
-rw-r--r--tests/auto/corelib/kernel/qsystemsemaphore/qsystemsemaphore.pro3
-rw-r--r--tests/auto/corelib/kernel/qsystemsemaphore/systemsemaphorehelper/main.cpp114
-rw-r--r--tests/auto/corelib/kernel/qsystemsemaphore/systemsemaphorehelper/systemsemaphorehelper.pro9
-rw-r--r--tests/auto/corelib/kernel/qsystemsemaphore/test/test.pro10
-rw-r--r--tests/auto/corelib/kernel/qsystemsemaphore/test/tst_qsystemsemaphore.cpp275
-rw-r--r--tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp32
-rw-r--r--tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.h1
-rw-r--r--tests/auto/corelib/thread/qfuture/tst_qfuture.cpp30
-rw-r--r--tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp9
-rw-r--r--tests/auto/corelib/tools/qdate/tst_qdate.cpp34
-rw-r--r--tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp397
-rw-r--r--tests/auto/corelib/tools/qmap/tst_qmap.cpp119
-rw-r--r--tests/auto/gui/image/qpixmap/tst_qpixmap.cpp7
-rw-r--r--tests/auto/gui/itemmodels/qstandarditem/tst_qstandarditem.cpp44
-rw-r--r--tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp69
-rw-r--r--tests/auto/gui/kernel/qwindow/tst_qwindow.cpp53
-rw-r--r--tests/auto/gui/painting/qpainter/tst_qpainter.cpp8
-rw-r--r--tests/auto/gui/text/qfontmetrics/qfontmetrics.pro2
-rw-r--r--tests/auto/gui/text/qfontmetrics/tst_qfontmetrics.cpp34
-rw-r--r--tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp3
-rw-r--r--tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp14
-rw-r--r--tests/auto/network/ssl/qsslcertificate/more-certificates/cert-large-expiration-date.txt.1.0.142
-rw-r--r--tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp25
-rw-r--r--tests/auto/other/lancelot/scripts/arcs.qps4
-rw-r--r--tests/auto/other/lancelot/scripts/beziers.qps3
-rw-r--r--tests/auto/other/lancelot/scripts/join_cap_styles_duplicate_control_points.qps18
-rw-r--r--tests/auto/other/lancelot/scripts/lines.qps129
-rw-r--r--tests/auto/other/lancelot/scripts/lines3.qps171
-rw-r--r--tests/auto/other/lancelot/scripts/paths.qps19
-rw-r--r--tests/auto/other/lancelot/scripts/pens_cosmetic.qps6
-rw-r--r--tests/auto/other/qaccessibility/tst_qaccessibility.cpp194
-rw-r--r--tests/auto/other/qaccessibilitylinux/qaccessibilitylinux.pro2
-rw-r--r--tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp59
-rw-r--r--tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp47
-rw-r--r--tests/auto/widgets/itemviews/qcolumnview/qcolumnview.pro2
-rw-r--r--tests/auto/widgets/itemviews/qdatawidgetmapper/tst_qdatawidgetmapper.cpp5
-rw-r--r--tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp9
-rw-r--r--tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp6
-rw-r--r--tests/auto/widgets/itemviews/qtablewidget/tst_qtablewidget.cpp14
-rw-r--r--tests/auto/widgets/kernel/qactiongroup/tst_qactiongroup.cpp14
-rw-r--r--tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp2
-rw-r--r--tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp108
-rw-r--r--tests/auto/widgets/widgets/qdialogbuttonbox/tst_qdialogbuttonbox.cpp48
-rw-r--r--tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp34
-rw-r--r--tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp17
-rw-r--r--tests/benchmarks/corelib/corelib.pro1
-rw-r--r--tests/benchmarks/corelib/mimetypes/mimetypes.pro3
-rw-r--r--tests/benchmarks/corelib/mimetypes/qmimedatabase/main.cpp87
-rw-r--r--tests/benchmarks/corelib/mimetypes/qmimedatabase/qmimedatabase.pro6
-rw-r--r--tests/benchmarks/corelib/tools/qmap/main.cpp44
-rw-r--r--tests/manual/cocoa/menus/main.cpp74
-rw-r--r--tests/manual/dialogs/dialogs.pro8
-rw-r--r--tests/manual/dialogs/filedialogpanel.cpp373
-rw-r--r--tests/manual/dialogs/filedialogpanel.h (renamed from src/widgets/kernel/qsoftkeymanager_p.h)105
-rw-r--r--tests/manual/dialogs/main.cpp (renamed from src/widgets/kernel/qsoftkeymanager_common_p.h)72
-rw-r--r--tests/manual/manual.pro3
-rw-r--r--tools/configure/configureapp.cpp88
-rw-r--r--tools/configure/configureapp.h2
-rw-r--r--tools/configure/main.cpp4
-rw-r--r--util/accessibilityinspector/accessibilityinspector.pri2
306 files changed, 4912 insertions, 3330 deletions
diff --git a/.gitignore b/.gitignore
index f4d8fff946..e7ebe50cc2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -261,13 +261,6 @@ d_exc_*.stk
# Generated by abldfast.bat from devtools.
.abldsteps.*
-# Carbide project files
-# ---------------------
-.project
-.cproject
-.make.cache
-*.d
-
qtc-debugging-helper
qtc-qmldump
qtc-qmldbg
diff --git a/configure b/configure
index 7866d5ac9b..e8cc56113f 100755
--- a/configure
+++ b/configure
@@ -785,6 +785,7 @@ CFG_JAVASCRIPTCORE_JIT=auto
CFG_PKGCONFIG=auto
CFG_STACK_PROTECTOR_STRONG=auto
CFG_SLOG2=auto
+CFG_SYSTEM_PROXIES=no
# Target architecture
CFG_ARCH=
@@ -1003,6 +1004,14 @@ while [ "$#" -gt 0 ]; do
VAR=`echo $1 | sed "s,^-\([^-]*\)-.*,\1,"`
VAL=`echo $1 | sed "s,^-[^-]*-\(.*\),\1,"`
;;
+ -system-proxies)
+ VAR=system-proxies
+ VAL=yes
+ ;;
+ -no-system-proxies)
+ VAR=system-proxies
+ VAL=no
+ ;;
#Qt Builtin/System style options
-no-*|-system-*|-qt-*)
VAR=`echo $1 | sed "s,^-[^-]*-\(.*\),\1,"`
@@ -1890,7 +1899,7 @@ while [ "$#" -gt 0 ]; do
fi
;;
javascript-jit)
- if [ "$VAL" = "yes" ] || [ "$VAL" = "auto" ] || [ "$VAL" = "no" ]; then
+ if [ "$VAL" = "yes" ] || [ "$VAL" = "auto" ] || [ "$VAL" = "no" ]; then
CFG_JAVASCRIPTCORE_JIT="$VAL"
else
UNKNOWN_OPT=yes
@@ -2090,6 +2099,13 @@ while [ "$#" -gt 0 ]; do
UNKNOWN_OPT=yes
fi
;;
+ system-proxies)
+ if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
+ CFG_SYSTEM_PROXIES="$VAL"
+ else
+ UNKNOWN_OPT=yes
+ fi
+ ;;
*)
UNKNOWN_OPT=yes
;;
@@ -2227,7 +2243,6 @@ if [ "$OPT_SHADOW" = "yes" ]; then
mkdir -p "$outpath/mkspecs"
rm -rf "$outpath"/mkspecs/*
ln -s "$relpath"/mkspecs/* "$outpath/mkspecs"
- rm -f "$outpath/mkspecs/default"
ShadowMkspecs()
{
@@ -3291,6 +3306,9 @@ Additional options:
OpenGL ES 2, or regular desktop OpenGL.
Use es2 for <api> to override auto-detection.
+ * -no-system-proxies .. Do not use system network proxies by default.
+ -system-proxies ..... Use system network proxies by default.
+
$GBN -no-glib ........... Do not compile Glib support.
$GBY -glib .............. Compile Glib support.
EOF
@@ -3508,6 +3526,9 @@ esac
#-------------------------------------------------------------------------------
[ -d "$outpath/src/corelib/global" ] || mkdir -p "$outpath/src/corelib/global"
+shortxspec=`echo $XQMAKESPEC | sed "s,^${relpath}/mkspecs/,,"`
+shortspec=`echo $QMAKESPEC | sed "s,^${relpath}/mkspecs/,,"`
+
cat > "$outpath/src/corelib/global/qconfig.cpp.new" <<EOF
/* License Info */
static const char qt_configure_licensee_str [256 + 12] = "qt_lcnsuser=$Licensee";
@@ -3534,6 +3555,8 @@ static const char qt_configure_prefix_path_strs[][256 + 12] = {
"qt_hpfxpath=$QT_HOST_PREFIX",
"qt_hbinpath=$QT_HOST_BINS",
"qt_hdatpath=$QT_HOST_DATA",
+ "qt_targspec=$shortxspec",
+ "qt_hostspec=$shortspec",
#endif
};
static const char qt_configure_settings_path_str[256 + 12] = "qt_stngpath=$QT_INSTALL_SETTINGS";
@@ -3597,10 +3620,6 @@ setBootstrapVariable()
if true; then ###[ '!' -f "$outpath/bin/qmake" ];
echo "Creating qmake. Please wait..."
- #mkspecs/default is used as a (gasp!) default mkspec so QMAKESPEC needn't be set once configured
- rm -rf mkspecs/default mkspecs/default-host
- ln -s `echo $XQMAKESPEC | sed "s,^${relpath}/mkspecs/,,"` mkspecs/default
- ln -s `echo $QMAKESPEC | sed "s,^${relpath}/mkspecs/,,"` mkspecs/default-host
mkdir -p "$outpath/qmake" || exit
# fix makefiles
for mkfile in GNUmakefile Makefile; do
@@ -5211,7 +5230,7 @@ if [ "$CFG_ALSA" = "auto" ]; then
fi
fi
-if [ "$CFG_JAVASCRIPTCORE_JIT" = "yes" ] || [ "$CFG_JAVASCRIPTCORE_JIT" = "auto" ]; then
+if [ "$CFG_JAVASCRIPTCORE_JIT" = "yes" ] || [ "$CFG_JAVASCRIPTCORE_JIT" = "auto" ]; then
if [ "$CFG_ARCH" = "arm" ]; then
compileTest unix/javascriptcore-jit "javascriptcore-jit"
if [ $? != "0" ]; then
@@ -5454,6 +5473,7 @@ fi
[ "$CFG_MAC_HARFBUZZ" = "yes" ] && QT_CONFIG="$QT_CONFIG harfbuzz"
[ "$CFG_XCB" = "yes" ] && QT_CONFIG="$QT_CONFIG xcb"
[ "$CFG_XINPUT2" = "yes" ] && QT_CONFIG="$QT_CONFIG xinput2"
+[ "$CFG_SYSTEM_PROXIES" = "yes" ] && QT_CONFIG="$QT_CONFIG system-proxies"
[ '!' -z "$DEFINES" ] && QMakeVar add DEFINES "$DEFINES"
[ '!' -z "$L_FLAGS" ] && QMakeVar add LIBS "$L_FLAGS"
@@ -6054,7 +6074,7 @@ fi
#-------------------------------------------------------------------------------
QTMODULE="$outpath/mkspecs/qmodule.pri"
-echo "CONFIG += $QMAKE_CONFIG create_prl link_prl prepare_docs" >> "$QTMODULE.tmp"
+echo "CONFIG += $QMAKE_CONFIG create_prl link_prl prepare_docs fix_output_dirs no_private_qt_headers_warning QTDIR_build" >> "$QTMODULE.tmp"
echo "QT_BUILD_PARTS += $CFG_BUILD_PARTS" >> "$QTMODULE.tmp"
if [ -n "$QT_CFLAGS_PSQL" ]; then
@@ -6119,9 +6139,6 @@ cat >>"$CACHEFILE.tmp" <<EOF
#paths
QT_SOURCE_TREE = \$\$quote($relpath)
QT_BUILD_TREE = \$\$quote($outpath)
-
-CONFIG += fix_output_dirs no_private_qt_headers_warning QTDIR_build
-
EOF
# replace .qmake.cache if it differs from the newly created temp file
@@ -6235,6 +6252,7 @@ echo "libudev support ........ $CFG_LIBUDEV"
if [ "$XPLATFORM_QNX" = "yes" ]; then
echo "SLOG2 support .......... $CFG_SLOG2"
fi
+echo "Use system proxies ..... $CFG_SYSTEM_PROXIES"
if [ "$CFG_OPENGL" = "desktop" ]; then
echo "OpenGL support ......... yes (Desktop OpenGL)"
diff --git a/dist/changes-5.0.0 b/dist/changes-5.0.0
index a9fe12bd2f..b54ab54b0f 100644
--- a/dist/changes-5.0.0
+++ b/dist/changes-5.0.0
@@ -481,6 +481,15 @@ QtCore
- StartWord/EndWord enum values has been logically replaced with StartOfItem/EndOfItem ones
to mention they are not about the word boundaries only.
+* Softkeys API was removed. The following functions and enums were removed:
+ - QAction::setSoftKeyRole()
+ - QAction::softKeyRole()
+ - QAction::SoftKeyRole
+ - Qt::WA_MergeSoftkeys
+ - Qt::WA_MergeSoftkeysRecursively
+ - Qt::WindowSoftkeysVisibleHint
+ - Qt::WindowSoftkeysRespondHint
+
QtGui
-----
* Accessibility has been refactored. The hierachy of accessible objects is implemented via
@@ -550,7 +559,7 @@ QtWidgets
the proper Qt API: due to the version bump, QStyle will try to use the additional
QStyleOption members, which are left default-initialized.
-* QHeaderView - The following functions have been obsoleted.
+* QHeaderView has been refactored and the following functions have been obsoleted:
* void setMovable(bool movable) - use void setSectionsMovable(bool movable) instead.
@@ -566,6 +575,8 @@ QtWidgets
* ResizeMode resizeMode(int logicalindex) const -
use sectionResizeMode(int logicalindex) instead.
+ * setSortIndicator will no longer emit sortIndicatorChanged when the sort indicator is unchanged.
+
* QDateEdit and QTimeEdit have re-gained a USER property. These were originally removed
before Qt 4.7.0, and are re-added for 5.0. This means that the userProperty for
those classes are now QDate and QTime respectively, not QDateTime as they have been
@@ -586,6 +597,11 @@ QtWidgets
returned from permissions() or data(FilePermissions), even if in read-only mode
(QFileSystemModel::isReadOnly()).
+* [QTBUG-158 QTBUG-428 QTBUG-26501] QComboBox::currentText improvements
+ Restored currentText as USER property.
+ New setter setCurrentText(), marked as WRITE method, usable by QItemDelegate and QDataWidgetMapper.
+ New signal currentTextChanged() marked as NOTIFY method.
+
QtNetwork
---------
* QHostAddress::isLoopback() API added. Returns true if the address is
diff --git a/doc/src/snippets/code/doc_src_examples_textfinder.pro b/doc/src/snippets/code/doc_src_examples_textfinder.pro
index ae070f4ac2..4446e8eb7b 100644
--- a/doc/src/snippets/code/doc_src_examples_textfinder.pro
+++ b/doc/src/snippets/code/doc_src_examples_textfinder.pro
@@ -1,5 +1,5 @@
#! [0]
-CONFIG += uitools
+QT += uitools
HEADERS = textfinder.h
RESOURCES = textfinder.qrc
SOURCES = textfinder.cpp main.cpp
diff --git a/examples/widgets/widgets/softkeys/main.cpp b/examples/widgets/widgets/softkeys/main.cpp
deleted file mode 100644
index 566a70ae6f..0000000000
--- a/examples/widgets/widgets/softkeys/main.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-#include "softkeys.h"
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- MainWindow mw;
- mw.showMaximized();
- return app.exec();
-}
diff --git a/examples/widgets/widgets/softkeys/softkeys.cpp b/examples/widgets/widgets/softkeys/softkeys.cpp
deleted file mode 100644
index d75fd232b4..0000000000
--- a/examples/widgets/widgets/softkeys/softkeys.cpp
+++ /dev/null
@@ -1,188 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "softkeys.h"
-
-MainWindow::MainWindow(QWidget *parent)
- : QMainWindow(parent)
-{
- central = new QWidget(this);
- central->setContextMenuPolicy(Qt::NoContextMenu); // explicitly forbid usage of context menu so actions item is not shown menu
- setCentralWidget(central);
-
- // Create text editor and set softkeys to it
- textEditor= new QTextEdit(tr("Navigate in UI to see context sensitive softkeys in action"), this);
- QAction* clear = new QAction(tr("Clear"), this);
- clear->setSoftKeyRole(QAction::NegativeSoftKey);
-
- textEditor->addAction(clear);
-
- ok = new QAction(tr("Ok"), this);
- ok->setSoftKeyRole(QAction::PositiveSoftKey);
- connect(ok, SIGNAL(triggered()), this, SLOT(okPressed()));
-
- cancel = new QAction(tr("Cancel"), this);
- cancel->setSoftKeyRole(QAction::NegativeSoftKey);
- connect(cancel, SIGNAL(triggered()), this, SLOT(cancelPressed()));
-
- infoLabel = new QLabel(tr(""), this);
- infoLabel->setContextMenuPolicy(Qt::NoContextMenu);
-
- toggleButton = new QPushButton(tr("Custom"), this);
- toggleButton->setContextMenuPolicy(Qt::NoContextMenu);
- toggleButton->setCheckable(true);
-
- modeButton = new QPushButton(tr("Loop SK window type"), this);
- modeButton->setContextMenuPolicy(Qt::NoContextMenu);
-
- modeLabel = new QLabel(tr("Normal maximized"), this);
- modeLabel->setContextMenuPolicy(Qt::NoContextMenu);
-
- pushButton = new QPushButton(tr("File Dialog"), this);
- pushButton->setContextMenuPolicy(Qt::NoContextMenu);
-
- QComboBox* comboBox = new QComboBox(this);
- comboBox->setContextMenuPolicy(Qt::NoContextMenu);
- comboBox->insertItems(0, QStringList()
- << QApplication::translate("MainWindow", "Selection1", 0, QApplication::UnicodeUTF8)
- << QApplication::translate("MainWindow", "Selection2", 0, QApplication::UnicodeUTF8)
- << QApplication::translate("MainWindow", "Selection3", 0, QApplication::UnicodeUTF8)
- );
-
- layout = new QGridLayout;
- layout->addWidget(textEditor, 0, 0, 1, 2);
- layout->addWidget(infoLabel, 1, 0, 1, 2);
- layout->addWidget(toggleButton, 2, 0);
- layout->addWidget(pushButton, 2, 1);
- layout->addWidget(comboBox, 3, 0, 1, 2);
- layout->addWidget(modeButton, 4, 0, 1, 2);
- layout->addWidget(modeLabel, 5, 0, 1, 2);
- central->setLayout(layout);
-
- fileMenu = menuBar()->addMenu(tr("&File"));
- exit = new QAction(tr("&Exit"), this);
- fileMenu->addAction(exit);
-
- connect(clear, SIGNAL(triggered()), this, SLOT(clearTextEditor()));
- connect(pushButton, SIGNAL(clicked()), this, SLOT(openDialog()));
- connect(exit, SIGNAL(triggered()), this, SLOT(exitApplication()));
- connect(toggleButton, SIGNAL(clicked()), this, SLOT(setCustomSoftKeys()));
- connect(modeButton, SIGNAL(clicked()), this, SLOT(setMode()));
- pushButton->setFocus();
-}
-
-MainWindow::~MainWindow()
-{
-}
-
-void MainWindow::clearTextEditor()
-{
- textEditor->setText(tr(""));
-}
-
-void MainWindow::openDialog()
-{
- QFileDialog::getOpenFileName(this);
-}
-
-void MainWindow::addSoftKeys()
-{
- addAction(ok);
- addAction(cancel);
-}
-
-void MainWindow::setCustomSoftKeys()
-{
- if (toggleButton->isChecked()) {
- infoLabel->setText(tr("Custom softkeys set"));
- addSoftKeys();
- }
- else {
- infoLabel->setText(tr("Custom softkeys removed"));
- removeAction(ok);
- removeAction(cancel);
- }
-}
-
-void MainWindow::setMode()
-{
- if(isMaximized()) {
- showFullScreen();
- modeLabel->setText(tr("Normal Fullscreen"));
- } else {
- Qt::WindowFlags flags = windowFlags();
- if(flags & Qt::WindowSoftkeysRespondHint) {
- flags |= Qt::WindowSoftkeysVisibleHint;
- flags &= ~Qt::WindowSoftkeysRespondHint;
- setWindowFlags(flags); // Hides visible window
- showFullScreen();
- modeLabel->setText(tr("Fullscreen with softkeys"));
- } else if(flags & Qt::WindowSoftkeysVisibleHint) {
- flags &= ~Qt::WindowSoftkeysVisibleHint;
- flags &= ~Qt::WindowSoftkeysRespondHint;
- setWindowFlags(flags); // Hides visible window
- showMaximized();
- modeLabel->setText(tr("Normal Maximized"));
- } else {
- flags &= ~Qt::WindowSoftkeysVisibleHint;
- flags |= Qt::WindowSoftkeysRespondHint;
- setWindowFlags(flags); // Hides visible window
- showFullScreen();
- modeLabel->setText(tr("Fullscreen with SK respond"));
- }
- }
-}
-
-void MainWindow::exitApplication()
-{
- qApp->exit();
-}
-
-void MainWindow::okPressed()
-{
- infoLabel->setText(tr("OK pressed"));
-}
-
-void MainWindow::cancelPressed()
-{
- infoLabel->setText(tr("Cancel pressed"));
-}
-
-
diff --git a/examples/widgets/widgets/softkeys/softkeys.desktop b/examples/widgets/widgets/softkeys/softkeys.desktop
deleted file mode 100644
index 7f4993a588..0000000000
--- a/examples/widgets/widgets/softkeys/softkeys.desktop
+++ /dev/null
@@ -1,11 +0,0 @@
-[Desktop Entry]
-Encoding=UTF-8
-Version=1.0
-Type=Application
-Terminal=false
-Name=Soft Keys
-Exec=/opt/usr/bin/softkeys
-Icon=softkeys
-X-Window-Icon=
-X-HildonDesk-ShowInToolbar=true
-X-Osso-Type=application/x-executable
diff --git a/examples/widgets/widgets/softkeys/softkeys.h b/examples/widgets/widgets/softkeys/softkeys.h
deleted file mode 100644
index 35440b9719..0000000000
--- a/examples/widgets/widgets/softkeys/softkeys.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef SOFTKEYS_H
-#define SOFTKEYS_H
-
-#include <QtWidgets>
-
-class MainWindow : public QMainWindow
-{
- Q_OBJECT
-public:
-
-private slots:
- void clearTextEditor();
- void openDialog();
- void addSoftKeys();
- void exitApplication();
- void okPressed();
- void cancelPressed();
- void setCustomSoftKeys();
- void setMode();
-public:
- MainWindow(QWidget *parent = 0);
- ~MainWindow();
-private:
- QGridLayout *layout;
- QWidget *central;
- QTextEdit *textEditor;
- QLabel *infoLabel;
- QPushButton *toggleButton;
- QPushButton *pushButton;
- QPushButton *modeButton;
- QLabel *modeLabel;
- QMenu *fileMenu;
- QAction *addSoftKeysAct;
- QAction *exit;
- QAction *ok;
- QAction *cancel;
-};
-
-//! [0]
-class SoftKey : public QWidget
-{
- Q_OBJECT
-public:
- SoftKey(QWidget *parent = 0);
-};
-//! [0]
-
-#endif
diff --git a/examples/widgets/widgets/softkeys/softkeys.pro b/examples/widgets/widgets/softkeys/softkeys.pro
deleted file mode 100644
index 5473069bb1..0000000000
--- a/examples/widgets/widgets/softkeys/softkeys.pro
+++ /dev/null
@@ -1,13 +0,0 @@
-HEADERS = softkeys.h
-SOURCES += \
- main.cpp \
- softkeys.cpp
-
-# install
-target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/widgets/softkeys
-sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS softkeys.pro
-sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/widgets/softkeys
-INSTALLS += target sources
-
-QT += widgets
-
diff --git a/examples/widgets/widgets/wiggly/dialog.cpp b/examples/widgets/widgets/wiggly/dialog.cpp
index fb18997a9a..4389159d1f 100644
--- a/examples/widgets/widgets/wiggly/dialog.cpp
+++ b/examples/widgets/widgets/wiggly/dialog.cpp
@@ -56,17 +56,6 @@ Dialog::Dialog(QWidget *parent, bool smallScreen)
layout->addWidget(lineEdit);
setLayout(layout);
-#ifdef QT_SOFTKEYS_ENABLED
- QAction *exitAction = new QAction(tr("Exit"), this);
- exitAction->setSoftKeyRole(QAction::NegativeSoftKey);
- connect (exitAction, SIGNAL(triggered()),this, SLOT(close()));
- addAction (exitAction);
-
- Qt::WindowFlags flags = windowFlags();
- flags |= Qt::WindowSoftkeysVisibleHint;
- setWindowFlags(flags);
-#endif
-
connect(lineEdit, SIGNAL(textChanged(QString)),
wigglyWidget, SLOT(setText(QString)));
if (!smallScreen){
diff --git a/mkspecs/features/create_cmake.prf b/mkspecs/features/create_cmake.prf
index 29d256db7f..c879103c24 100644
--- a/mkspecs/features/create_cmake.prf
+++ b/mkspecs/features/create_cmake.prf
@@ -60,7 +60,7 @@ static|staticlib:CMAKE_STATIC_TYPE = true
contains(QT_CONFIG, reduce_relocations):CMAKE_ADD_FPIE_FLAGS = "true"
-CMAKE_MKSPEC = $$relative_path($$QMAKESPEC, $$[QT_HOST_DATA/get]/mkspecs)
+CMAKE_MKSPEC = $$[QMAKE_XSPEC]
macx {
!isEmpty(CMAKE_STATIC_TYPE) {
diff --git a/mkspecs/features/default_pre.prf b/mkspecs/features/default_pre.prf
index 8b9cae5a6d..8f8916ae19 100644
--- a/mkspecs/features/default_pre.prf
+++ b/mkspecs/features/default_pre.prf
@@ -1,20 +1,6 @@
load(exclusive_builds)
CONFIG = lex yacc warn_on debug exceptions depend_includepath $$CONFIG
-!build_pass:exists($$_PRO_FILE_PWD_/sync.profile) {
- !exists($$[QT_HOST_DATA]/.qmake.cache) {
- !isEmpty(_QMAKE_SUPER_CACHE_) {
- # When doing a -prefix build of top-level qt5/qt.pro, we need to announce
- # this repo's module pris' location to the other repos.
- isEmpty(MODULE_QMAKE_OUTDIR): MODULE_QMAKE_OUTDIR = $$OUT_PWD
- modpath = $$MODULE_QMAKE_OUTDIR/mkspecs/modules
- !contains(QMAKEMODULES, $$modpath): \
- cache(QMAKEMODULES, add super, modpath)
- unset(modpath)
- }
- }
-}
-
# Populate the installdir which will be passed to qdoc in the default_post.prf
# This allows a project to remove the installdir if need be, to trigger building online docs,
# which Qt Creator does.
diff --git a/mkspecs/features/qml1_module.prf b/mkspecs/features/qml1_module.prf
new file mode 100644
index 0000000000..8bacddc549
--- /dev/null
+++ b/mkspecs/features/qml1_module.prf
@@ -0,0 +1,2 @@
+CONFIG += qml1_target
+load(qml_module)
diff --git a/mkspecs/features/qml1_plugin.prf b/mkspecs/features/qml1_plugin.prf
new file mode 100644
index 0000000000..2914c78ea3
--- /dev/null
+++ b/mkspecs/features/qml1_plugin.prf
@@ -0,0 +1,2 @@
+CONFIG += qml1_target
+load(qml_plugin)
diff --git a/mkspecs/features/qml_module.prf b/mkspecs/features/qml_module.prf
index 10ee3bf3a7..03ef88221e 100644
--- a/mkspecs/features/qml_module.prf
+++ b/mkspecs/features/qml_module.prf
@@ -9,6 +9,11 @@ for(qmlf, QML_FILES): fq_qml_files += $$absolute_path($$qmlf, $$_PRO_FILE_PWD_)
# Only for Qt Creator's project view
OTHER_FILES += $$fq_qml_files
+qml1_target: \
+ instbase = $$[QT_INSTALL_IMPORTS]/QtDeclarative
+else: \
+ instbase = $$[QT_INSTALL_IMPORTS]
+
exists($$[QT_HOST_PREFIX]/.qmake.cache) {
# These bizarre rules copy the files to the qtbase build directory
@@ -17,7 +22,7 @@ exists($$[QT_HOST_PREFIX]/.qmake.cache) {
}
qmlfiles2build.input = fq_qml_files
- qmlfiles2build.output = $$[QT_INSTALL_IMPORTS]/$$TARGETPATH/${QMAKE_FUNC_FILE_IN_qmlModStripSrcDir}
+ qmlfiles2build.output = $$instbase/$$TARGETPATH/${QMAKE_FUNC_FILE_IN_qmlModStripSrcDir}
!contains(TEMPLATE, vc.*): qmlfiles2build.variable_out = PRE_TARGETDEPS
qmlfiles2build.commands = $$QMAKE_COPY ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT}
qmlfiles2build.name = COPY ${QMAKE_FILE_IN}
@@ -29,5 +34,5 @@ exists($$[QT_HOST_PREFIX]/.qmake.cache) {
# Install rules
qmldir.base = $$_PRO_FILE_PWD_
qmldir.files = $$fq_qml_files
-qmldir.path = $$[QT_INSTALL_IMPORTS]/$$TARGETPATH
+qmldir.path = $$instbase/$$TARGETPATH
INSTALLS += qmldir
diff --git a/mkspecs/features/qml_plugin.prf b/mkspecs/features/qml_plugin.prf
index ae5fbf28a2..b938bf493e 100644
--- a/mkspecs/features/qml_plugin.prf
+++ b/mkspecs/features/qml_plugin.prf
@@ -24,7 +24,12 @@ exists($$QMLTYPEFILE): QML_FILES += $$QMLTYPEFILE
# Install rules
-target.path = $$[QT_INSTALL_IMPORTS]/$$TARGETPATH
+qml1_target: \
+ instbase = $$[QT_INSTALL_IMPORTS]/QtDeclarative
+else: \
+ instbase = $$[QT_INSTALL_IMPORTS]
+
+target.path = $$instbase/$$TARGETPATH
INSTALLS += target
# Some final setup
@@ -42,13 +47,31 @@ load(qt_targets)
# directory. Then review and commit the changes made to plugins.qmltypes.
#
!cross_compile {
- isEmpty(IMPORT_VERSION): IMPORT_VERSION = $$eval(QT.$${CXX_MODULE}.MAJOR_VERSION).$$eval(QT.$${CXX_MODULE}.MINOR_VERSION)
+ build_pass|!debug_and_release {
+ isEmpty(IMPORT_VERSION): IMPORT_VERSION = $$eval(QT.$${CXX_MODULE}.MAJOR_VERSION).$$eval(QT.$${CXX_MODULE}.MINOR_VERSION)
- load(resolve_target)
- qtPrepareTool(QMLPLUGINDUMP, qmlplugindump)
- qmltypes.target = qmltypes
- qmltypes.commands = $$QMLPLUGINDUMP $$replace(TARGETPATH, /, .) $$IMPORT_VERSION $$QMAKE_RESOLVED_TARGET > $$QMLTYPEFILE
- qmltypes.depends = $$QMAKE_RESOLVED_TARGET
+ load(resolve_target)
+ qml1_target: \
+ qmlplugindump = qml1plugindump
+ else: \
+ qmlplugindump = qmlplugindump
+ qtPrepareTool(QMLPLUGINDUMP, $$qmlplugindump)
+ importpath.value =
+ for(qmod, QMAKEMODULES) {
+ qmod = $$section(qmod, /, 0, -3)/imports
+ qml1_target: qmod = $$qmod/QtDeclarative
+ exists($$qmod): importpath.value += $$shell_path($$qmod)
+ }
+ importpath.name = QML_IMPORT_PATH
+ importpath.value = $$unique(importpath.value)
+ qtAddToolEnv(QMLPLUGINDUMP, importpath)
+ TARGETPATHBASE = $$replace(TARGETPATH, \\.\\d+\$, )
+ qmltypes.target = qmltypes
+ qmltypes.commands = $$QMLPLUGINDUMP $$replace(TARGETPATHBASE, /, .) $$IMPORT_VERSION > $$QMLTYPEFILE
+ qmltypes.depends = $$QMAKE_RESOLVED_TARGET
+ } else {
+ qmltypes.CONFIG += recursive
+ }
QMAKE_EXTRA_TARGETS += qmltypes
}
diff --git a/mkspecs/features/qt.prf b/mkspecs/features/qt.prf
index 8f797a5960..c4b991becd 100644
--- a/mkspecs/features/qt.prf
+++ b/mkspecs/features/qt.prf
@@ -38,60 +38,15 @@ plugin { #Qt plugins
QT_PLUGIN_VERIFY = QTPLUGIN DEPLOYMENT_PLUGIN
for(QT_CURRENT_VERIFY, $$list($$QT_PLUGIN_VERIFY)) {
for(QTPLUG, $$list($$lower($$unique($$QT_CURRENT_VERIFY)))) {
- qplugin_style =
- !qt_debug:!qt_release {
- CONFIG(debug, debug|release):qplugin_style = debug
- else:qplugin_style = release
- } else:CONFIG(qt_debug, qt_debug|qt_release) {
- qplugin_style = debug
- } else {
- qplugin_style = release
- }
-
# Check if the plugin is known to Qt. We can use this to determine
# the plugin path. Unknown plugins must rely on the default link path.
- ACCESSIBLEPLUGINS = qtaccessiblewidgets qtaccessiblecompatwidgets
- BEARERPLUGINS = qgenericbearer qnativewifibearer
- CODECPLUGINS = qcncodecs qjpcodecs qkrcodecs qtwcodecs
- DECORATIONPLUGINS = qdecorationdefault qdecorationstyled qdecorationwindows
- GFXDRIVERPLUGINS = qscreenvfb qgfxtransformed qgfxshadowfb qgfxpvregl qscreenlinuxfb qeglnullws qdirectfbscreen qahiscreen
- GRAPHICSSYSTEMPLUGINS = qmeegographicssystem qglgraphicssystem qvggraphicssystem qshivavggraphicssystem
- IMAGEPLUGINS = qgif qico qjpeg qsvg
- INPUTPLUGINS = qimsw-multi
- KBDDRIVERPLUGINS = qlinuxinputkbddriver
- MOUSEDRIVERPLUGINS = qtslibmousehandler qpcmousedriver qlinuxtpmousedriver
- SQLPLUGINS = qsqldb2 qsqloci qsqltds qsqlodbc qsqlpsql qsqlibase qsqlmysql qsqlite2 qsqlite
- PHONONPLUGINS = phonon_waveout phonon_ds9 phonon_gstreamer phonon_qt7 phonon_mmf
-
- ALLQTPLUGINS = $$ACCESSIBLEPLUGINS $$BEARERPLUGINS $$CODECPLUGINS $$DECORATIONPLUGINS $$GFXDRIVERPLUGINS $$GRAPHICSSYSTEMPLUGINS $$IMAGEPLUGINS $$INPUTPLUGINS $$KBDDRIVERPLUGINS $$MOUSEDRIVERPLUGINS $$SQLPLUGINS $$PHONONPLUGINS
-
- QT_PLUGINPATH =
- contains(ALLQTPLUGINS, $$QTPLUG) {
- # Determine the plugin path
- contains(ACCESSIBLEPLUGINS, $$QTPLUG): QT_PLUGINPATH = accessible
- contains(BEARERPLUGINS, $$QTPLUG): QT_PLUGINPATH = bearer
- contains(CODECPLUGINS, $$QTPLUG): QT_PLUGINPATH = codecs
- contains(DECORATIONPLUGINS, $$QTPLUG): QT_PLUGINPATH = decorations
- contains(GFXDRIVERPLUGINS, $$QTPLUG): QT_PLUGINPATH = gfxdrivers
- contains(GRAPHICSSYSTEMPLUGINS, $$QTPLUG): QT_PLUGINPATH = graphicssystems
- contains(IMAGEPLUGINS, $$QTPLUG): QT_PLUGINPATH = imageformats
- contains(INPUTPLUGINS, $$QTPLUG): QT_PLUGINPATH = inputmethods
- contains(KBDDRIVERPLUGINS, $$QTPLUG): QT_PLUGINPATH = kbddrivers
- contains(MOUSEDRIVERPLUGINS, $$QTPLUG): QT_PLUGINPATH = mousedrivers
- contains(SQLPLUGINS, $$QTPLUG): QT_PLUGINPATH = sqldrivers
- contains(PHONONPLUGINS, $$QTPLUG): QT_PLUGINPATH = phonon_backend
- }
+ QT_PLUGINPATH = $$eval(QT_PLUGIN.$${QTPLUG}.TYPE)
# Generate the plugin linker line
target_qt:isEqual(TARGET, QTPLUG) {
warning($$TARGET cannot have a QTPLUGIN of $$QTPLUG)
} else {
- QT_LINKAGE = -l$${QTPLUG}
- win32 {
- CONFIG(debug, debug|release):QT_LINKAGE = -l$${QTPLUG}d
- } else:mac {
- isEqual(qplugin_style, debug):QT_LINKAGE = -l$${QTPLUG}_debug
- }
+ QT_LINKAGE = -l$${QTPLUG}$$qtPlatformTargetSuffix()
}
# Only link against plugin in static builds
@@ -149,6 +104,3 @@ wince*:static:gui {
}
!isEmpty(QT_NAMESPACE):DEFINES *= QT_NAMESPACE=$$QT_NAMESPACE
-mac {
- !isEmpty(QT_NAMESPACE_MAC_CRC):DEFINES *= QT_NAMESPACE_MAC_CRC=$$QT_NAMESPACE_MAC_CRC
-}
diff --git a/mkspecs/features/qt_build_config.prf b/mkspecs/features/qt_build_config.prf
index a2ad4429c1..01605da5e8 100644
--- a/mkspecs/features/qt_build_config.prf
+++ b/mkspecs/features/qt_build_config.prf
@@ -9,6 +9,16 @@
debug(1, "Not loading qmodule.pri twice")
}
+!build_pass:!isEmpty(_QMAKE_SUPER_CACHE_):!exists($$[QT_HOST_DATA]/.qmake.cache) {
+ # When doing a -prefix build of top-level qt5/qt.pro, we need to announce
+ # this repo's module pris' location to the other repos.
+ isEmpty(MODULE_QMAKE_OUTDIR): MODULE_QMAKE_OUTDIR = $$shadowed($$dirname(_QMAKE_CONF_))
+ modpath = $$MODULE_QMAKE_OUTDIR/mkspecs/modules
+ !contains(QMAKEMODULES, $$modpath): \
+ cache(QMAKEMODULES, add super, modpath)
+ unset(modpath)
+}
+
mac {
!isEmpty(QMAKE_RPATHDIR){
CONFIG += absolute_library_soname
diff --git a/mkspecs/features/qt_build_paths.prf b/mkspecs/features/qt_build_paths.prf
new file mode 100644
index 0000000000..5f6f08c3db
--- /dev/null
+++ b/mkspecs/features/qt_build_paths.prf
@@ -0,0 +1,14 @@
+# Find the module's source root dir.
+isEmpty(_QMAKE_CONF_): error("Project has no top-level .qmake.conf file.")
+MODULE_PROFILE_DIR = $$dirname(_QMAKE_CONF_)
+isEmpty(MODULE_BASE_DIR): MODULE_BASE_DIR = $$MODULE_PROFILE_DIR
+isEmpty(MODULE_BASE_OUTDIR): MODULE_BASE_OUTDIR = $$shadowed($$MODULE_BASE_DIR)
+isEmpty(MODULE_QMAKE_OUTDIR): MODULE_QMAKE_OUTDIR = $$MODULE_BASE_OUTDIR
+
+QTDIR = $$[QT_HOST_PREFIX]
+exists($$QTDIR/.qmake.cache) {
+ # Permit modules to enforce being built outside QTDIR ...
+ !force_independent: MODULE_BASE_OUTDIR = $$QTDIR
+ # ... though this sort of breaks the idea.
+ MODULE_QMAKE_OUTDIR = $$QTDIR
+}
diff --git a/mkspecs/features/qt_functions.prf b/mkspecs/features/qt_functions.prf
index 2d8f81bae1..ce32028138 100644
--- a/mkspecs/features/qt_functions.prf
+++ b/mkspecs/features/qt_functions.prf
@@ -192,13 +192,16 @@ defineTest(qtAddToolEnv) {
equals(QMAKE_DIR_SEP, /) {
contains($${env}.CONFIG, prepend): infix = \${$$name:+:\$$$name}
else: infix =
- $$1 = "$$name=$$join(value, :)$$infix $$eval($$1)"
+ val = "$$name=$$join(value, :)$$infix"
} else {
# Escape closing parens when expanding the variable, otherwise cmd confuses itself.
contains($${env}.CONFIG, prepend): infix = ;%$$name:)=^)%
else: infix =
- $$1 = "(set $$name=$$join(value, ;)$$infix) & $$eval($$1)"
+ val = "(set $$name=$$join(value, ;)$$infix) &"
}
+ contains(MAKEFILE_GENERATOR, MS.*): val ~= s,%,%%,g
+ else: val ~= s,\\\$,\$\$,g
+ $$1 = "$$val $$eval($$1)"
}
}
export($$1)
@@ -207,29 +210,33 @@ defineTest(qtAddToolEnv) {
defineTest(qtAddTargetEnv) {
deps = $$resolve_depends(QT, "QT.")
!isEmpty(deps) {
- plugin_paths =
for(dep, deps) {
deppath += $$shell_path($$eval(QT.$${dep}.libs))
for(rpath, QT.$${dep}.rpath_link): \
deppath += $$shell_path($$rpath)
- plugin_paths += $$eval(QT.$${dep}.plugin_path) $$eval(QT.$${dep}.plugins)
}
- equals(QMAKE_HOST.os, Windows): \
+ equals(QMAKE_HOST.os, Windows) {
deppath.name = PATH
- else:contains(QMAKE_HOST.os, Linux|FreeBSD): \
+ } else:contains(QMAKE_HOST.os, Linux|FreeBSD) {
deppath.name = LD_LIBRARY_PATH
- else:equals(QMAKE_HOST.os, Darwin): \
- deppath.name = DYLD_LIBRARY_PATH
- else: \
+ } else:equals(QMAKE_HOST.os, Darwin) {
+ contains(QT_CONFIG, qt_framework): \
+ deppath.name = DYLD_FRAMEWORK_PATH
+ else: \
+ deppath.name = DYLD_LIBRARY_PATH
+ } else {
error("Operating system not supported.")
+ }
deppath.value = $$unique(deppath)
deppath.CONFIG = prepend
- pluginpath.name = QT_PLUGIN_PATH
+
pluginpath.value =
- plugin_paths = $$unique(plugin_paths)
- for(ppath, plugin_paths): \
- exists($$ppath): \
- pluginpath.value += $$shell_path($$ppath)
+ for(qmod, QMAKEMODULES) {
+ qmod = $$section(qmod, /, 0, -3)/plugins
+ exists($$qmod): pluginpath.value += $$shell_path($$qmod)
+ }
+ pluginpath.name = QT_PLUGIN_PATH
+
QT_TOOL_ENV += deppath pluginpath
}
qtAddToolEnv($$1, $$QT_TOOL_ENV)
diff --git a/mkspecs/features/qt_module.prf b/mkspecs/features/qt_module.prf
index 23541930e3..50c7c74c82 100644
--- a/mkspecs/features/qt_module.prf
+++ b/mkspecs/features/qt_module.prf
@@ -32,19 +32,7 @@ else: \
MODULE_DEFINE = QT_$${ucmodule}_LIB
MODULE_DEFINES = $$MODULE_DEFINE $$MODULE_DEFINES
-# Find the module's source root dir.
-MODULE_PROFILE_DIR = $$_PRO_FILE_PWD_
-for(ever) {
- exists($$MODULE_PROFILE_DIR/sync.profile):break()
- nmpri = $$dirname(MODULE_PROFILE_DIR)
- equals(nmpri, $$MODULE_PROFILE_DIR):error("No sync.profile found. This does not look like a Qt module source tree.")
- MODULE_PROFILE_DIR = $$nmpri
- unset(nmpri)
-}
-
-isEmpty(MODULE_BASE_DIR): MODULE_BASE_DIR = $$MODULE_PROFILE_DIR
-isEmpty(MODULE_BASE_OUTDIR): MODULE_BASE_OUTDIR = $$shadowed($$MODULE_BASE_DIR)
-isEmpty(MODULE_QMAKE_OUTDIR): MODULE_QMAKE_OUTDIR = $$MODULE_BASE_OUTDIR
+load(qt_build_paths)
# This check will be removed soon. Weird indentation to avoid reindenting the code later.
!isEmpty(MODULE_PRI) {
@@ -53,7 +41,7 @@ isEmpty(MODULE_QMAKE_OUTDIR): MODULE_QMAKE_OUTDIR = $$MODULE_BASE_OUTDIR
exists($$MODULE_PRI)|error("Specified module pri file $$MODULE_PRI does not exist.")
} else {
-MODULE_PRI = $$MODULE_QMAKE_OUTDIR/mkspecs/modules-inst/qt_$${MODULE}.pri
+MODULE_PRI = $$MODULE_QMAKE_OUTDIR/mkspecs/modules-inst/qt_lib_$${MODULE}.pri
!build_pass {
@@ -104,10 +92,7 @@ MODULE_PRI = $$MODULE_QMAKE_OUTDIR/mkspecs/modules-inst/qt_$${MODULE}.pri
load(qt_module_fwdpri)
-MODULE_INCLUDES = $$eval(QT.$${MODULE}.includes)
-MODULE_PRIVATE_INCLUDES = $$eval(QT.$${MODULE}.private_includes)
-INCLUDEPATH *= $$MODULE_INCLUDES
-INCLUDEPATH *= $$MODULE_PRIVATE_INCLUDES
+INCLUDEPATH *= $$eval(QT.$${MODULE}.includes) $$eval(QT.$${MODULE}.private_includes)
load(qt_module_headers)
@@ -123,14 +108,8 @@ CONFIG -= fix_output_dirs
!isEmpty(QMAKE_DOCS) {
doc_subdir = doc
- QTDIR = $$[QT_HOST_PREFIX]
- !force_independent:exists($$QTDIR/.qmake.cache): \
- mod_component_base = $$QTDIR
- else: \
- mod_component_base = $$MODULE_BASE_OUTDIR
-
unset(QMAKE_DOCS_INDEX)
- QMAKE_DOCS_OUTPUTDIR = $$mod_component_base/$$doc_subdir/qt$${MODULE}
+ QMAKE_DOCS_OUTPUTDIR = $$MODULE_BASE_OUTDIR/$$doc_subdir/qt$${MODULE}
for(qmod, QMAKEMODULES): \
QMAKE_DOCS_INDEX += $$section(qmod, /, 0, -3)/$$doc_subdir
diff --git a/mkspecs/features/qt_module_fwdpri.prf b/mkspecs/features/qt_module_fwdpri.prf
index 5dc63ebdfd..4c3a4b433f 100644
--- a/mkspecs/features/qt_module_fwdpri.prf
+++ b/mkspecs/features/qt_module_fwdpri.prf
@@ -1,19 +1,10 @@
!build_pass {
- QTDIR = $$[QT_HOST_PREFIX]
- exists($$QTDIR/.qmake.cache) {
- mod_component_base = $$QTDIR
- mod_qmake_base = $$QTDIR
- } else {
- mod_component_base = $$MODULE_BASE_OUTDIR
- mod_qmake_base = $$MODULE_QMAKE_OUTDIR
- }
- # Permit modules to enforce being built outside QTDIR.
- force_independent: mod_component_base = $$MODULE_BASE_OUTDIR
+ load(qt_build_paths)
isEmpty(MODULE_INSTALL_LIBS): MODULE_INSTALL_LIBS = $$[QT_INSTALL_LIBS/raw]
- MODULE_FWD_PRI = $$mod_qmake_base/mkspecs/modules/qt_$${MODULE}.pri
+ MODULE_FWD_PRI = $$MODULE_QMAKE_OUTDIR/mkspecs/modules/qt_lib_$${MODULE}.pri
# -rpath-link is used by the linker to find depedencies of dynamic
# libraries which were NOT specified on the command line.
@@ -32,11 +23,9 @@
privqt = $$replace(QT_PRIVATE, -private$, )
privdep = $$resolve_depends(privqt, "QT.")
rpaths =
- pluginpath =
alldep = $$pubdep $$privdep
for(dep, alldep) { # Inherit link-rpaths from all our dependencies
rpaths += $$eval(QT.$${dep}.rpath_link) $$eval(QT.$${dep}.rpath_link_private)
- pluginpath += $$eval(QT.$${dep}.plugin_path) $$eval(QT.$${dep}.plugins)
}
privdep -= $$pubdep
for(dep, privdep): \ # Add our private dependencies' lib paths as new link-rpaths
@@ -58,20 +47,18 @@
} else {
module_rpathlink_priv =
}
- pluginpath = $$unique(pluginpath)
# Create a forwarding module .pri file
MODULE_FWD_PRI_CONT = \
"QT_MODULE_BASE = $$MODULE_BASE_DIR" \
- "QT_MODULE_BIN_BASE = $$mod_component_base/bin" \
- "QT_MODULE_INCLUDE_BASE = $$mod_component_base/include" \
- "QT_MODULE_IMPORT_BASE = $$mod_component_base/imports" \
- "QT_MODULE_LIB_BASE = $$mod_component_base/lib" \
- "QT_MODULE_PLUGIN_BASE = $$mod_component_base/plugins" \
+ "QT_MODULE_BIN_BASE = $$MODULE_BASE_OUTDIR/bin" \
+ "QT_MODULE_INCLUDE_BASE = $$MODULE_BASE_OUTDIR/include" \
+ "QT_MODULE_IMPORT_BASE = $$MODULE_BASE_OUTDIR/imports" \
+ "QT_MODULE_LIB_BASE = $$MODULE_BASE_OUTDIR/lib" \
+ "QT_MODULE_PLUGIN_BASE = $$MODULE_BASE_OUTDIR/plugins" \
$$module_rpathlink \
$$module_rpathlink_priv \
"QT.$${MODULE}.rpath = $$MODULE_INSTALL_LIBS" \
- "QT.$${MODULE}.plugin_path = $$val_escape(pluginpath)" \
"include($$MODULE_PRI)"
write_file($$MODULE_FWD_PRI, MODULE_FWD_PRI_CONT)|error("Aborting.")
touch($$MODULE_FWD_PRI, $$MODULE_PRI)
diff --git a/mkspecs/features/qt_module_headers.prf b/mkspecs/features/qt_module_headers.prf
index 0340f234c5..b1918bd67d 100644
--- a/mkspecs/features/qt_module_headers.prf
+++ b/mkspecs/features/qt_module_headers.prf
@@ -1,20 +1,16 @@
-QTDIR = $$[QT_HOST_PREFIX]
-!force_independent:exists($$QTDIR/.qmake.cache): \
- mod_component_base = $$QTDIR
-else: \
- mod_component_base = $$MODULE_BASE_OUTDIR
+load(qt_build_paths)
!build_pass {
qtPrepareTool(QMAKE_SYNCQT, syncqt)
contains(QT_CONFIG, private_tests): \ # -developer-build
QMAKE_SYNCQT += -check-includes
- QMAKE_SYNCQT += -module $$TARGET -mkspecsdir $$[QT_HOST_DATA/get]/mkspecs -outdir $$mod_component_base $$MODULE_BASE_DIR
+ QMAKE_SYNCQT += -module $$TARGET -mkspecsdir $$[QT_HOST_DATA/get]/mkspecs -outdir $$MODULE_BASE_OUTDIR $$MODULE_BASE_DIR
!silent: message($$QMAKE_SYNCQT)
system($$QMAKE_SYNCQT)|error("Failed to run: $$QMAKE_SYNCQT")
}
#load up the headers info
-include($$mod_component_base/include/$$TARGET/headers.pri, "", true)
+include($$MODULE_BASE_OUTDIR/include/$$TARGET/headers.pri, "", true)
lctarget = $$lower($$TARGET)
uctarget = $$upper($$TARGET)
@@ -55,7 +51,7 @@ count(MODULE_VERSION_HEADER, 1) {
}
# Create a module master header
-MODULE_MASTER_HEADER = $$mod_component_base/include/$$TARGET/$$TARGET
+MODULE_MASTER_HEADER = $$MODULE_BASE_OUTDIR/include/$$TARGET/$$TARGET
!build_pass {
MODULE_MASTER_HEADER_CONT = \
"/* This file was generated by qmake with the info from $${_PRO_FILE_}. */" \
diff --git a/mkspecs/features/qt_plugin.prf b/mkspecs/features/qt_plugin.prf
index 0209910203..b84fa47dd1 100644
--- a/mkspecs/features/qt_plugin.prf
+++ b/mkspecs/features/qt_plugin.prf
@@ -1,12 +1,17 @@
+load(qt_build_paths)
+
+isEmpty(PLUGIN_TYPE): error("PLUGIN_TYPE (plugins/ subdirectory) needs to be defined.")
+
TEMPLATE = lib
-isEmpty(VERSION):VERSION = $$QT_VERSION
-CONFIG += qt plugin
+CONFIG += plugin
+DESTDIR = $$MODULE_BASE_OUTDIR/plugins/$$PLUGIN_TYPE
-if(win32|mac):!macx-xcode {
+tool_plugin {
+ !build_pass:contains(QT_CONFIG, build_all): CONFIG += release
+} else:if(win32|mac):!macx-xcode {
contains(QT_CONFIG, debug_and_release):CONFIG += debug_and_release
contains(QT_CONFIG, build_all):CONFIG += build_all
}
-TARGET = $$qtLibraryTarget($$TARGET)
contains(QT_CONFIG, reduce_exports):CONFIG += hide_symbols
contains(QT_CONFIG, separate_debug_info):CONFIG += separate_debug_info
contains(QT_CONFIG, separate_debug_info_nocopy):CONFIG += separate_debug_info_nocopy
@@ -15,6 +20,25 @@ contains(QT_CONFIG, c++11):CONFIG += c++11
contains(QT_CONFIG, static):CONFIG += static
else:CONFIG += shared
+!build_pass:static {
+ isEmpty(MODULE): MODULE = $$section($$list($$basename(_PRO_FILE_)), ., 0, 0)
+
+ MODULE_PRI = $$MODULE_QMAKE_OUTDIR/mkspecs/modules/qt_plugin_$${MODULE}.pri
+
+ MODULE_PRI_CONT = \
+ "QT_PLUGIN.$${MODULE}.TYPE = $$PLUGIN_TYPE"
+ write_file($$MODULE_PRI, MODULE_PRI_CONT)|error("Aborting.")
+
+ pritarget.path = $$[QT_HOST_DATA]/mkspecs/modules
+ pritarget.files = $$MODULE_PRI
+ INSTALLS += pritarget
+}
+
+target.path = $$[QT_INSTALL_PLUGINS]/$$PLUGIN_TYPE
+INSTALLS += target
+
+TARGET = $$qtLibraryTarget($$TARGET)
+
load(qt_targets)
wince*:LIBS += $$QMAKE_LIBS_GUI
diff --git a/mkspecs/features/qt_tool.prf b/mkspecs/features/qt_tool.prf
index 01a26b238e..27753f26dd 100644
--- a/mkspecs/features/qt_tool.prf
+++ b/mkspecs/features/qt_tool.prf
@@ -1,5 +1,8 @@
TEMPLATE = app
+load(qt_build_paths)
+DESTDIR = $$MODULE_BASE_OUTDIR/bin
+
CONFIG += qt warn_on console
isEmpty(QMAKE_INFO_PLIST): CONFIG -= app_bundle
@@ -16,26 +19,13 @@ INSTALLS += target
MODULE_DEPENDS = $$replace(QT, -private$, )
- # Find the module's source root dir.
- MODULE_PROFILE_DIR = $$_PRO_FILE_PWD_
- for(ever) {
- exists($$MODULE_PROFILE_DIR/sync.profile):break()
- nmpri = $$dirname(MODULE_PROFILE_DIR)
- equals(nmpri, $$MODULE_PROFILE_DIR): \
- error("No sync.profile found. This does not look like a Qt module source tree.")
- MODULE_PROFILE_DIR = $$nmpri
- unset(nmpri)
- }
-
- isEmpty(MODULE_BASE_DIR): MODULE_BASE_DIR = $$MODULE_PROFILE_DIR
- MODULE_BASE_OUTDIR = $$shadowed($$MODULE_BASE_DIR)
- isEmpty(MODULE_QMAKE_OUTDIR): MODULE_QMAKE_OUTDIR = $$MODULE_BASE_OUTDIR
+ load(qt_build_paths)
load(resolve_target)
cmd = $$shell_path($$QMAKE_RESOLVED_TARGET)
qtAddTargetEnv(cmd)
- TOOL_PRI = $$MODULE_QMAKE_OUTDIR/mkspecs/modules/qt_$${MODULE}.pri
+ TOOL_PRI = $$MODULE_QMAKE_OUTDIR/mkspecs/modules/qt_tool_$${MODULE}.pri
TOOL_PRI_CONT = "QT_TOOL.$${MODULE}.command = $$val_escape(cmd)"
write_file($$TOOL_PRI, TOOL_PRI_CONT)|error("Aborting.")
diff --git a/qmake/library/qmakeevaluator.cpp b/qmake/library/qmakeevaluator.cpp
index f4125eca8e..e861c8d4f6 100644
--- a/qmake/library/qmakeevaluator.cpp
+++ b/qmake/library/qmakeevaluator.cpp
@@ -1127,20 +1127,23 @@ bool QMakeEvaluator::loadSpecInternal()
evalError(fL1S("Could not read qmake configuration file %1.").arg(spec));
return false;
}
-#ifdef Q_OS_UNIX
+#ifndef QT_BUILD_QMAKE
+ // Legacy support for Qt4 default specs
+# ifdef Q_OS_UNIX
if (m_qmakespec.endsWith(QLatin1String("/default-host"))
|| m_qmakespec.endsWith(QLatin1String("/default"))) {
QString rspec = QFileInfo(m_qmakespec).readLink();
if (!rspec.isEmpty())
m_qmakespec = QDir::cleanPath(QDir(m_qmakespec).absoluteFilePath(rspec));
}
-#else
+# else
// We can't resolve symlinks as they do on Unix, so configure.exe puts
// the source of the qmake.conf at the end of the default/qmake.conf in
// the QMAKESPEC_ORIGINAL variable.
const ProString &orig_spec = first(ProKey("QMAKESPEC_ORIGINAL"));
if (!orig_spec.isEmpty())
m_qmakespec = orig_spec.toQString();
+# endif
#endif
valuesRef(ProKey("QMAKESPEC")) << ProString(m_qmakespec);
m_qmakespecName = IoUtils::fileName(m_qmakespec).toString();
@@ -1188,7 +1191,12 @@ bool QMakeEvaluator::loadSpec()
updateMkspecPaths();
if (qmakespec.isEmpty())
- qmakespec = m_hostBuild ? QLatin1String("default-host") : QLatin1String("default");
+ qmakespec = propertyValue(ProKey(m_hostBuild ? "QMAKE_SPEC" : "QMAKE_XSPEC")).toQString();
+#ifndef QT_BUILD_QMAKE
+ // Legacy support for Qt4 qmake in Qt Creator, etc.
+ if (qmakespec.isEmpty())
+ qmakespec = QLatin1String("default-host") : QLatin1String("default");
+#endif
if (IoUtils::isRelativePath(qmakespec)) {
foreach (const QString &root, m_mkspecPaths) {
QString mkspec = root + QLatin1Char('/') + qmakespec;
diff --git a/qmake/property.cpp b/qmake/property.cpp
index d9056cdb72..f1e9ba63ac 100644
--- a/qmake/property.cpp
+++ b/qmake/property.cpp
@@ -71,6 +71,8 @@ static const struct {
{ "QT_HOST_PREFIX", QLibraryInfo::HostPrefixPath, true },
{ "QT_HOST_DATA", QLibraryInfo::HostDataPath, true },
{ "QT_HOST_BINS", QLibraryInfo::HostBinariesPath, true },
+ { "QMAKE_SPEC", QLibraryInfo::HostSpecPath, true },
+ { "QMAKE_XSPEC", QLibraryInfo::TargetSpecPath, true },
};
QMakeProperty::QMakeProperty() : settings(0)
diff --git a/qtbase.pro b/qtbase.pro
index 59814d707e..e66d9fbb28 100644
--- a/qtbase.pro
+++ b/qtbase.pro
@@ -87,16 +87,6 @@ mkspecs.files = \
$$OUT_PWD/mkspecs/qconfig.pri $$OUT_PWD/mkspecs/qmodule.pri $$OUT_PWD/mkspecs/qdevice.pri \
$$files($$PWD/mkspecs/*) # $$OUT_PWD contains only symlinks under Unix
mkspecs.files -= $$PWD/mkspecs/modules
-!equals(OUT_PWD, $$PWD) {
- # When shadow building, the default mkspecs only exist in the build tree.
- mkspecs.files += $$OUT_PWD/mkspecs/default-host $$OUT_PWD/mkspecs/default
-}
-!equals(QMAKE_HOST.os, Linux):!equals(QMAKE_HOST.os, Windows) {
- # MacOS' (and maybe other Unixes') cp command is too daft to honor -f when copying symlinks.
- mkspecs_pre.commands = rm -f $$[QT_HOST_DATA]/mkspecs/default-host $$[QT_HOST_DATA]/mkspecs/default
- QMAKE_EXTRA_TARGETS += mkspecs_pre
- mkspecs.depends += mkspecs_pre
-}
INSTALLS += mkspecs
global_docs.files = $$PWD/doc/global
diff --git a/src/angle/src/config.pri b/src/angle/src/config.pri
index 3770d6ef09..7aedbc92cb 100644
--- a/src/angle/src/config.pri
+++ b/src/angle/src/config.pri
@@ -13,7 +13,7 @@ isEmpty(ANGLE_DIR) {
}
win32 {
- GNUTOOLS_DIR=$$[QT_HOST_DATA]/../gnuwin32/bin
+ GNUTOOLS_DIR=$$PWD/../../../../gnuwin32/bin
exists($$GNUTOOLS_DIR/gperf.exe) {
GNUTOOLS = "(set $$escape_expand(\\\")PATH=$$replace(GNUTOOLS_DIR, [/\\\\], $${QMAKE_DIR_SEP});%PATH%$$escape_expand(\\\"))"
}
diff --git a/src/angle/src/libGLESv2/libGLESv2.pro b/src/angle/src/libGLESv2/libGLESv2.pro
index a4e83ea10d..c8da379862 100644
--- a/src/angle/src/libGLESv2/libGLESv2.pro
+++ b/src/angle/src/libGLESv2/libGLESv2.pro
@@ -1,6 +1,7 @@
TEMPLATE = lib
TARGET = libGLESv2
DEPENDPATH += . shaders
+CONFIG += simd
include(../common/common.pri)
@@ -60,10 +61,11 @@ SOURCES += \
$$ANGLE_DIR/src/libGLESv2/ResourceManager.cpp \
$$ANGLE_DIR/src/libGLESv2/Shader.cpp \
$$ANGLE_DIR/src/libGLESv2/Texture.cpp \
- $$ANGLE_DIR/src/libGLESv2/TextureSSE2.cpp \
$$ANGLE_DIR/src/libGLESv2/utilities.cpp \
$$ANGLE_DIR/src/libGLESv2/VertexDataManager.cpp
+SSE2_SOURCES += $$ANGLE_DIR/src/libGLESv2/TextureSSE2.cpp
+
float_converter.target = float_converter
float_converter.commands = python $$ANGLE_DIR/src/libGLESv2/Float16ToFloat32.py \
> $$ANGLE_DIR/src/libGLESv2/Float16ToFloat32.cpp
diff --git a/src/corelib/Qt5CTestMacros.cmake b/src/corelib/Qt5CTestMacros.cmake
index 3d1b3b3191..715ad9356e 100644
--- a/src/corelib/Qt5CTestMacros.cmake
+++ b/src/corelib/Qt5CTestMacros.cmake
@@ -59,3 +59,83 @@ macro(expect_fail _dir)
--build-options "-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}" ${BUILD_OPTIONS_LIST}
)
endmacro()
+
+function(test_module_includes)
+
+ set(all_args ${ARGN})
+ set(packages_string "")
+ set(libraries_string "")
+
+ foreach(_package ${Qt5_MODULE_TEST_DEPENDS})
+ set(packages_string
+ "
+ ${packages_string}
+ find_package(Qt5${_package} REQUIRED)
+ "
+ )
+ endforeach()
+
+ while(all_args)
+ list(GET all_args 0 qtmodule)
+ list(REMOVE_AT all_args 0 1)
+ set(packages_string
+ "${packages_string}
+ find_package(Qt5${qtmodule} REQUIRED)
+ include_directories(\${Qt5${qtmodule}_INCLUDE_DIRS})
+ add_definitions(\${Qt5${qtmodule}_DEFINITIONS})\n"
+ )
+ set(libraries_string "${libraries_string} Qt5::${qtmodule}")
+ endwhile()
+
+ file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/module_includes/CMakeLists.txt"
+ "
+ cmake_minimum_required(VERSION 2.8)
+ project(module_includes)
+
+ ${packages_string}
+
+ set(CMAKE_CXX_FLAGS \"\${CMAKE_CXX_FLAGS} \${Qt5Core_EXECUTABLE_COMPILE_FLAGS}\")
+
+ add_executable(module_includes_exe \"\${CMAKE_CURRENT_SOURCE_DIR}/main.cpp\")
+ target_link_libraries(module_includes_exe ${libraries_string})\n"
+ )
+
+ set(all_args ${ARGN})
+ set(includes_string "")
+ set(instances_string "")
+ while(all_args)
+ list(GET all_args 0 qtmodule)
+ list(GET all_args 1 qtinclude)
+ list(REMOVE_AT all_args 0 1)
+ set(includes_string
+ "${includes_string}
+ #include <${qtinclude}>
+ #include <Qt${qtmodule}/${qtinclude}>
+ #include <Qt${qtmodule}>
+ #include <Qt${qtmodule}/Qt${qtmodule}>"
+ )
+ set(instances_string
+ "${instances_string}
+ ${qtinclude} local${qtinclude};
+ ")
+ endwhile()
+
+ file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/module_includes/main.cpp"
+ "
+
+ ${includes_string}
+
+ int main(int, char **) { ${instances_string} return 0; }\n"
+ )
+
+ add_test(module_includes ${CMAKE_CTEST_COMMAND}
+ --build-and-test
+ "${CMAKE_CURRENT_BINARY_DIR}/module_includes/"
+ "${CMAKE_CURRENT_BINARY_DIR}/module_includes/build"
+ --build-config "${CMAKE_BUILD_TYPE}"
+ --build-generator ${CMAKE_GENERATOR}
+ --build-makeprogram ${CMAKE_MAKE_PROGRAM}
+ --build-project module_includes
+ --build-options "-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}" ${BUILD_OPTIONS_LIST}
+ )
+endfunction()
diff --git a/src/corelib/codecs/codecs.qdoc b/src/corelib/codecs/codecs.qdoc
index b982302355..3a9f5c8f79 100644
--- a/src/corelib/codecs/codecs.qdoc
+++ b/src/corelib/codecs/codecs.qdoc
@@ -31,10 +31,10 @@
\ingroup groups
\brief Codec support in Qt.
- These codecs provide facilities for conversion between Unicode and
- specific text encodings.
+ These \l{Qt Core} codecs classes provide facilities for conversion between
+ Unicode and specific text encodings.
- \generatelist{related}
+ \annotatedlist codecs
*/
/*!
diff --git a/src/corelib/doc/snippets/code/src_corelib_tools_qregularexpression.cpp b/src/corelib/doc/snippets/code/src_corelib_tools_qregularexpression.cpp
index 6538c7178d..f1479a8ed7 100644
--- a/src/corelib/doc/snippets/code/src_corelib_tools_qregularexpression.cpp
+++ b/src/corelib/doc/snippets/code/src_corelib_tools_qregularexpression.cpp
@@ -38,17 +38,28 @@
**
****************************************************************************/
+#include <QString>
+#include <QStringList>
+#include <QRegularExpression>
+#include <QRegularExpressionMatch>
+#include <QRegularExpressionMatchIterator>
+
+int main() {
+
+{
//! [0]
QRegularExpression re("a pattern");
//! [0]
+}
-
+{
//! [1]
QRegularExpression re;
re.setPattern("another pattern");
//! [1]
+}
-
+{
//! [2]
// matches two digits followed by a space and a word
QRegularExpression re("\\d\\d \\w+");
@@ -56,27 +67,31 @@ QRegularExpression re("\\d\\d \\w+");
// matches a backslash
QRegularExpression re2("\\\\");
//! [2]
+}
-
+{
//! [3]
QRegularExpression re("a third pattern");
QString pattern = re.pattern(); // pattern == "a third pattern"
//! [3]
+}
-
+{
//! [4]
// matches "Qt rocks", but also "QT rocks", "QT ROCKS", "qT rOcKs", etc.
QRegularExpression re("Qt rocks", QRegularExpression::CaseInsensitiveOption);
//! [4]
+}
-
+{
//! [5]
QRegularExpression re("^\\d+$");
re.setPatternOptions(QRegularExpression::MultilineOption);
// re matches any line in the subject string that contains only digits (but at least one)
//! [5]
+}
-
+{
//! [6]
QRegularExpression re = QRegularExpression("^two.*words$", QRegularExpression::MultilineOption
| QRegularExpression::DotMatchesEverythingOption);
@@ -84,16 +99,18 @@ QRegularExpression re = QRegularExpression("^two.*words$", QRegularExpression::M
QRegularExpression::PatternOptions options = re.patternOptions();
// options == QRegularExpression::MultilineOption | QRegularExpression::DotMatchesEverythingOption
//! [6]
+}
-
+{
//! [7]
// match two digits followed by a space and a word
QRegularExpression re("\\d\\d \\w+");
QRegularExpressionMatch match = re.match("abc123 def");
bool hasMatch = match.hasMatch(); // true
//! [7]
+}
-
+{
//! [8]
QRegularExpression re("\\d\\d \\w+");
QRegularExpressionMatch match = re.match("abc123 def");
@@ -102,8 +119,9 @@ if (match.hasMatch()) {
// ...
}
//! [8]
+}
-
+{
//! [9]
QRegularExpression re("\\d\\d \\w+");
QRegularExpressionMatch match = re.match("12 abc 45 def", 1);
@@ -112,31 +130,34 @@ if (match.hasMatch()) {
// ...
}
//! [9]
+}
-
+{
//! [10]
QRegularExpression re("^(\\d\\d)/(\\d\\d)/(\\d\\d\\d\\d)$");
QRegularExpressionMatch match = re.match("08/12/1985");
if (match.hasMatch()) {
- QString day = re.captured(1); // day == "08"
- QString month = re.captured(2); // month == "12"
- QString year = re.captured(3); // year == "1985"
+ QString day = match.captured(1); // day == "08"
+ QString month = match.captured(2); // month == "12"
+ QString year = match.captured(3); // year == "1985"
// ...
}
//! [10]
+}
-
+{
//! [11]
QRegularExpression re("abc(\\d+)def");
QRegularExpressionMatch match = re.match("XYZabc123defXYZ");
if (match.hasMatch()) {
- int startOffset = re.capturedStart(1); // startOffset == 6
- int endOffset = re.capturedEnd(1); // endOffset == 9
+ int startOffset = match.capturedStart(1); // startOffset == 6
+ int endOffset = match.capturedEnd(1); // endOffset == 9
// ...
}
//! [11]
+}
-
+{
//! [12]
QRegularExpression re("^(?<date>\\d\\d)/(?<month>\\d\\d)/(?<year>\\d\\d\\d\\d)$");
QRegularExpressionMatch match = re.match("08/12/1985");
@@ -146,14 +167,14 @@ if (match.hasMatch()) {
QString year = match.captured("year"); // year == 1985
}
//! [12]
+}
-
+{
//! [13]
QRegularExpression re("(\\w+)");
QRegularExpressionMatchIterator i = re.globalMatch("the quick fox");
//! [13]
-
//! [14]
QStringList words;
while (i.hasNext()) {
@@ -163,72 +184,86 @@ while (i.hasNext()) {
}
// words contains "the", "quick", "fox"
//! [14]
+}
-
+{
//! [15]
QString pattern("^(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) \\d\\d?, \\d\\d\\d\\d$");
QRegularExpression re(pattern);
QString input("Jan 21,");
-QRegularExpressionMatch match = re.match(input, 0, QRegularExpressionMatch::PartialPreferCompleteMatch);
+QRegularExpressionMatch match = re.match(input, 0, QRegularExpression::PartialPreferCompleteMatch);
bool hasMatch = match.hasMatch(); // false
bool hasPartialMatch = match.hasPartialMatch(); // true
//! [15]
+}
-
+{
+QString pattern("^(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) \\d\\d?, \\d\\d\\d\\d$");
+QRegularExpression re(pattern);
//! [16]
QString input("Dec 8, 1985");
-QRegularExpressionMatch match = re.match(input, 0, QRegularExpressionMatch::PartialPreferCompleteMatch);
+QRegularExpressionMatch match = re.match(input, 0, QRegularExpression::PartialPreferCompleteMatch);
bool hasMatch = match.hasMatch(); // true
bool hasPartialMatch = match.hasPartialMatch(); // false
//! [16]
+}
-
+{
//! [17]
QRegularExpression re("abc\\w+X|def");
-QRegularExpressionMatch match = re.match("abcdef", 0, QRegularExpressionMatch::PartialPreferCompleteMatch);
+QRegularExpressionMatch match = re.match("abcdef", 0, QRegularExpression::PartialPreferCompleteMatch);
bool hasMatch = match.hasMatch(); // true
bool hasPartialMatch = match.hasPartialMatch(); // false
QString captured = match.captured(0); // captured == "def"
//! [17]
+}
-
+{
//! [18]
QRegularExpression re("abc\\w+X|defY");
-QRegularExpressionMatch match = re.match("abcdef", 0, QRegularExpressionMatch::PartialPreferCompleteMatch);
+QRegularExpressionMatch match = re.match("abcdef", 0, QRegularExpression::PartialPreferCompleteMatch);
bool hasMatch = match.hasMatch(); // false
bool hasPartialMatch = match.hasPartialMatch(); // true
QString captured = match.captured(0); // captured == "abcdef"
//! [18]
+}
-
+{
//! [19]
QRegularExpression re("abc|ab");
-QRegularExpressionMatch match = re.match("ab", 0, QRegularExpressionMatch::PartialPreferFirstMatch);
+QRegularExpressionMatch match = re.match("ab", 0, QRegularExpression::PartialPreferFirstMatch);
bool hasMatch = match.hasMatch(); // false
bool hasPartialMatch = match.hasPartialMatch(); // true
//! [19]
+}
-
+{
//! [20]
QRegularExpression re("abc(def)?");
-QRegularExpressionMatch match = re.match("abc", 0, QRegularExpressionMatch::PartialPreferFirstMatch);
+QRegularExpressionMatch match = re.match("abc", 0, QRegularExpression::PartialPreferFirstMatch);
bool hasMatch = match.hasMatch(); // false
bool hasPartialMatch = match.hasPartialMatch(); // true
//! [20]
+}
+{
//! [21]
QRegularExpression re("(abc)*");
-QRegularExpressionMatch match = re.match("abc", 0, QRegularExpressionMatch::PartialPreferFirstMatch);
+QRegularExpressionMatch match = re.match("abc", 0, QRegularExpression::PartialPreferFirstMatch);
bool hasMatch = match.hasMatch(); // false
bool hasPartialMatch = match.hasPartialMatch(); // true
//! [21]
+}
+{
//! [22]
QRegularExpression invalidRe("(unmatched|parenthesis");
bool isValid = invalidRe.isValid(); // false
//! [22]
+}
+{
//! [23]
QRegularExpression invalidRe("(unmatched|parenthesis");
if (!invalidRe.isValid()) {
@@ -237,44 +272,62 @@ if (!invalidRe.isValid()) {
// ...
}
//! [23]
+}
+{
//! [24]
QRegularExpression re("^this pattern must match exactly$");
//! [24]
+}
+{
//! [25]
QString p("a .*|pattern");
QRegularExpression re("\\A(?:" + p + ")\\z"); // re matches exactly the pattern string p
//! [25]
+}
+{
//! [26]
QString escaped = QRegularExpression::escape("a(x) = f(x) + g(x)");
// escaped == "a\\(x\\)\\ \\=\\ f\\(x\\)\\ \\+\\ g\\(x\\)"
//! [26]
+}
+{
+QString name;
+QString nickname;
//! [27]
QString pattern = "(" + QRegularExpression::escape(name) +
"|" + QRegularExpression::escape(nickname) + ")";
QRegularExpression re(pattern);
//! [27]
+}
+{
+QString string;
+QRegularExpression re;
//! [28]
-QRegularExpressionMatch match = re.match(...);
+QRegularExpressionMatch match = re.match(string);
for (int i = 0; i <= match.lastCapturedIndex(); ++i) {
QString captured = match.captured(i);
// ...
}
//! [28]
+}
+{
//! [29]
-QRegularExpression("(\\d\\d) (?<name>\\w+)");
+QRegularExpression re("(\\d\\d) (?<name>\\w+)");
QRegularExpressionMatch match = re.match("23 Jordan");
if (match.hasMatch()) {
QString number = match.captured(1); // first == "23"
QString name = match.captured("name"); // name == "Jordan"
}
//! [29]
+}
+{
//! [30]
// extracts the words
QRegularExpression re("(\\w+)");
@@ -285,5 +338,6 @@ while (i.hasNext()) {
// ...
}
//! [30]
+}
-
+}
diff --git a/src/corelib/doc/snippets/qprocess/qprocess-simpleexecution.cpp b/src/corelib/doc/snippets/qprocess/qprocess-simpleexecution.cpp
index e7c1c36e9d..8181cb04dd 100644
--- a/src/corelib/doc/snippets/qprocess/qprocess-simpleexecution.cpp
+++ b/src/corelib/doc/snippets/qprocess/qprocess-simpleexecution.cpp
@@ -56,7 +56,7 @@ int main(int argc, char *argv[])
//! [2]
QStringList arguments;
- arguments << "-style" << "motif";
+ arguments << "-style" << "fusion";
QProcess *myProcess = new QProcess(parent);
myProcess->start(program, arguments);
diff --git a/src/corelib/doc/src/animation.qdoc b/src/corelib/doc/src/animation.qdoc
index c76845c93c..7724d533d6 100644
--- a/src/corelib/doc/src/animation.qdoc
+++ b/src/corelib/doc/src/animation.qdoc
@@ -28,6 +28,11 @@
/*!
\group animation
\title Animation Framework
+
+ This page lists classes belonging to \l{Qt Core}'s
+ \l{The Animation Framework}{animation framework}.
+
+ \annotatedlist animation
*/
/*!
@@ -102,7 +107,7 @@
the framework, please look up their class descriptions.
\section1 Classes in the Animation Framework
-
+
These classes provide a framework for creating both simple and complex
animations.
@@ -361,4 +366,3 @@
framework for animations, see the states example (it lives in the
\c{examples/animation/states} directory).
*/
-
diff --git a/src/corelib/doc/src/containers.qdoc b/src/corelib/doc/src/containers.qdoc
index 24c5629ae2..262add419c 100644
--- a/src/corelib/doc/src/containers.qdoc
+++ b/src/corelib/doc/src/containers.qdoc
@@ -26,22 +26,6 @@
****************************************************************************/
/*!
- \group tools
- \title Non-GUI Classes
- \ingroup groups
-
- \brief Collection classes such as list, queue, stack and string, along
- with other classes that can be used without needing QApplication.
-
- The non-GUI classes are general-purpose collection and string classes
- that may be used independently of the GUI classes.
-
- In particular, these classes do not depend on QApplication at all,
- and so can be used in non-GUI programs.
-
-*/
-
-/*!
\page containers.html
\title Container Classes
\ingroup technology-apis
@@ -394,13 +378,13 @@
QMapIterator, which is somewhat different because it iterates on
(key, value) pairs.
- Like QListIterator, QMapIterator provides
- \l{QMapIterator::toFront()}{toFront()},
- \l{QMapIterator::toBack()}{toBack()},
- \l{QMapIterator::hasNext()}{hasNext()},
- \l{QMapIterator::next()}{next()},
- \l{QMapIterator::peekNext()}{peekNext()},
- \l{QMapIterator::hasPrevious()}{hasPrevious()},
+ Like QListIterator, QMapIterator provides
+ \l{QMapIterator::toFront()}{toFront()},
+ \l{QMapIterator::toBack()}{toBack()},
+ \l{QMapIterator::hasNext()}{hasNext()},
+ \l{QMapIterator::next()}{next()},
+ \l{QMapIterator::peekNext()}{peekNext()},
+ \l{QMapIterator::hasPrevious()}{hasPrevious()},
\l{QMapIterator::previous()}{previous()}, and
\l{QMapIterator::peekPrevious()}{peekPrevious()}. The key and
value components are extracted by calling key() and value() on
diff --git a/src/corelib/doc/src/datastreamformat.qdoc b/src/corelib/doc/src/datastreamformat.qdoc
index 8c3b592276..e2c3f9bae1 100644
--- a/src/corelib/doc/src/datastreamformat.qdoc
+++ b/src/corelib/doc/src/datastreamformat.qdoc
@@ -33,7 +33,7 @@
The \l QDataStream allows you to serialize some of the Qt data types.
The table below lists the data types that QDataStream can serialize
and how they are represented. The format described below is
- \l{QDataStream::setVersion()}{version 12}.
+ \l{QDataStream::setVersion()}{version 13}.
It is always best to cast integers to a Qt integer type, such as
qint16 or quint32, when reading and writing. This ensures that
@@ -129,7 +129,7 @@
\li \list
\li Date (QDate)
\li Time (QTime)
- \li 0 for Qt::LocalTime, 1 for Qt::UTC (quint8)
+ \li The \l{Qt::TimeSpec}{time spec} (quint8)
\endlist
\row \li QEasingCurve
\li \list
diff --git a/src/corelib/doc/src/eventsandfilters.qdoc b/src/corelib/doc/src/eventsandfilters.qdoc
index 5fe444538d..e4605afb0b 100644
--- a/src/corelib/doc/src/eventsandfilters.qdoc
+++ b/src/corelib/doc/src/eventsandfilters.qdoc
@@ -32,10 +32,11 @@
\brief Classes used to create and handle events.
- These classes are used to create and handle events.
+ These \l{Qt Core} classes are used to create and handle events.
- For more information see the \link object.html Object model\endlink
- and \link signalsandslots.html Signals and Slots\endlink.
+ For more information see the \l{The Event System}{Event System} page.
+
+ \annotatedlist events
*/
/*!
diff --git a/src/corelib/doc/src/implicit-sharing.qdoc b/src/corelib/doc/src/implicit-sharing.qdoc
index 7b29998951..2038d43230 100644
--- a/src/corelib/doc/src/implicit-sharing.qdoc
+++ b/src/corelib/doc/src/implicit-sharing.qdoc
@@ -31,6 +31,12 @@
/*!
\group shared
\title Implicitly Shared Classes
+
+ These \l{Qt Core} classes provides a safe and efficient way of sharing and
+ manipulating data by \l{Implicit Sharing}{implicitly sharing} data.
+
+ \annotatedlist shared
+
*/
/*!
diff --git a/src/corelib/doc/src/io.qdoc b/src/corelib/doc/src/io.qdoc
index cd967844c0..7aff227931 100644
--- a/src/corelib/doc/src/io.qdoc
+++ b/src/corelib/doc/src/io.qdoc
@@ -33,7 +33,9 @@
\brief Classes providing file input and output along with directory and
network handling.
- These classes are used to handle input and output to and from external
- devices, processes, files etc. as well as manipulating files and directories.
-*/
+ These \l{Qt Core} classes are used to handle input and output to and from
+ external devices, processes, files etc. as well as manipulating files and
+ directories.
+ \annotatedlist io
+*/
diff --git a/src/corelib/doc/src/json.qdoc b/src/corelib/doc/src/json.qdoc
index 25496dd759..9e6e190dcb 100644
--- a/src/corelib/doc/src/json.qdoc
+++ b/src/corelib/doc/src/json.qdoc
@@ -108,5 +108,6 @@
\annotatedlist json
- All JSON classes are value based, implicitly shared classes.
+ All JSON classes are value based,
+ \l{Implicit Sharing}{implicitly shared classes}.
*/
diff --git a/src/corelib/doc/src/plugins-howto.qdoc b/src/corelib/doc/src/plugins-howto.qdoc
index f0031ee26b..bc387aeed9 100644
--- a/src/corelib/doc/src/plugins-howto.qdoc
+++ b/src/corelib/doc/src/plugins-howto.qdoc
@@ -32,12 +32,14 @@
\brief Plugin related classes.
- These classes deal with shared libraries, (e.g. .so and DLL files),
- and with Qt plugins.
+ These \l{Qt Core} classes deal with shared libraries, (e.g. .so and DLL
+ files), and with Qt plugins.
- See the \link plugins-howto.html plugins documentation\endlink.
+ See the \l{How to Create Qt Plugins} page for more information..
See also the \l{ActiveQt framework} for Windows.
+
+ \annotatedlist plugins
*/
/*!
diff --git a/src/corelib/doc/src/qtcore-index.qdoc b/src/corelib/doc/src/qtcore-index.qdoc
new file mode 100644
index 0000000000..f876a362c7
--- /dev/null
+++ b/src/corelib/doc/src/qtcore-index.qdoc
@@ -0,0 +1,119 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \page qtcore-index.html
+ \title Qt Core
+
+ \brief The Qt Core module is part of Qt's essential modules.
+
+ \section1 Getting Started
+ All other Qt modules rely on this module. To include the
+ definitions of the module's classes, use the following directive:
+
+ \snippet code/doc_src_qtcore.cpp 0
+
+ \section1 Core Functionalities
+
+ Qt adds these features to C++:
+
+ \list
+ \li a very powerful mechanism for seamless object communication called
+ signals and slots
+ \li queryable and designable object properties
+ \li hierarchical and queryable object trees that organize
+ \li object ownership in a natural way with guarded pointers (QPointer)
+ \li a dynamic cast that works across library boundaries
+ \endlist
+
+ The following pages provide more information about Qt's core features:
+ \list
+ \li \l{The Meta-Object System}
+ \li \l{The Property System}
+ \li \l{Object Model}
+ \li \l{Object Trees & Ownership}
+ \li \l{Signals & Slots}
+ \endlist
+
+ \section1 Threading and Concurrent Programming
+
+ Qt provides thread support in the form of platform-independent \l{Threading
+ Classes}{threading classes}, a thread-safe way of posting events, and
+ signal-slot connections across threads. Multithreaded programming is also a
+ useful paradigm for performing time-consuming operations without freezing
+ the user interface of an application.
+
+ The \l{Thread Support in Qt} page contains information on implementing
+ threads in applications. Additional concurrent classes are provided by the
+ \l{Qt Concurrent} module.
+
+ \section1 Input/Output, Resources, and Containers
+
+ Qt provides a resource system for organizing application files and assets,
+ a set of containers, and classes for receiving input and printing output.
+ \list
+ \li \l{Container Classes}
+ \li \l{Serializing Qt Data Types}
+ \li \l{Implicit Sharing}
+ \endlist
+
+ In addition, Qt Core provides a platform-independent mechanism for storing
+ binary files in the application's executable.
+
+ \list
+ \li \l{The Qt Resource System}
+ \endlist
+
+ \section1 Additional Frameworks
+ Qt Core also provides some of Qt's key frameworks.
+
+ \list
+ \li \l{The Animation Framework}
+ \li \l{JSON Support in Qt}
+ \li \l{The State Machine Framework}
+ \li \l{How to Create Qt Plugins}
+ \li \l{The Event System}
+ \endlist
+
+ \section1 Related Information
+ \section1 Reference
+ These are links to the API reference materials.
+ \list
+ \li \l{Qt Core C++ Classes}{C++ classes}
+ \list
+ \li \l{Animation Framework}{Animation Classes}
+ \li \l{Threading Classes}
+ \li \l{Container Classes}
+ \li \l{Plugin Classes}
+ \li \l{Implicitly Shared Classes}
+ \li \l{State Machine Classes}
+ \li \l{Input/Output and Networking}{Input/Output Classes}
+ \li \l{Event Classes}
+ \endlist
+ \endlist
+
+*/
diff --git a/src/corelib/doc/src/qtcore.qdoc b/src/corelib/doc/src/qtcore.qdoc
index 0d06bb7998..4b4814d5b7 100644
--- a/src/corelib/doc/src/qtcore.qdoc
+++ b/src/corelib/doc/src/qtcore.qdoc
@@ -27,16 +27,13 @@
/*!
\module QtCore
- \title QtCore Module
+ \title Qt Core C++ Classes
\ingroup modules
- \keyword QtCore
-
- \brief The QtCore module contains core non-GUI functionality.
+ \brief Provides core non-GUI functionality.
All other Qt modules rely on this module. To include the
definitions of the module's classes, use the following directive:
\snippet code/doc_src_qtcore.cpp 0
*/
-
diff --git a/src/corelib/doc/src/statemachine.qdoc b/src/corelib/doc/src/statemachine.qdoc
index dd4f992288..1a5c216e04 100644
--- a/src/corelib/doc/src/statemachine.qdoc
+++ b/src/corelib/doc/src/statemachine.qdoc
@@ -28,6 +28,11 @@
/*!
\group statemachine
\title State Machine Classes
+
+ These \l{Qt Core} classes are part of the \l{The State Machine Framework}{
+ State Machine Framework}.
+
+ \annotatedlist statemachine
*/
/*!
@@ -69,7 +74,7 @@
\section1 Classes in the State Machine Framework
These classes are provided by qt for creating event-driven state machines.
-
+
\annotatedlist statemachine
\section1 A Simple State Machine
diff --git a/src/corelib/doc/src/threads.qdoc b/src/corelib/doc/src/threads.qdoc
index 0f752bc726..64d33e3b34 100644
--- a/src/corelib/doc/src/threads.qdoc
+++ b/src/corelib/doc/src/threads.qdoc
@@ -28,6 +28,10 @@
/*!
\group thread
\title Threading Classes
+
+ These \l{Qt Core} classes provide threading support to applications.
+ The \l{Thread Support in Qt} page covers how to use these classes.
+ \annotatedlist thread
*/
/*!
@@ -111,13 +115,13 @@
/*!
\page threads-starting.html
\title Starting Threads with QThread
-
+
\contentspage Thread Support in Qt
\nextpage Synchronizing Threads
A QThread instance represents a thread and provides the means to
\l{QThread::start()}{start()} a thread, which will then execute the
- reimplementation of QThread::run(). The \c run() implementation is for a
+ reimplementation of QThread::run(). The \c run() implementation is for a
thread what the \c main() entry point is for the application. All code
executed in a call stack that starts in the \c run() function is executed
by the new thread, and the thread finishes when the function returns.
@@ -141,12 +145,12 @@
Then, create an instance of the thread object and call
QThread::start(). Note that you must create the QApplication (or
QCoreApplication) object before you can create a QThread.
-
- The function will return immediately and the
+
+ The function will return immediately and the
main thread will continue. The code that appears in the
\l{QThread::run()}{run()} reimplementation will then be executed
in a separate thread.
-
+
Creating threads is explained in more detail in the QThread
documentation.
@@ -160,7 +164,7 @@
/*!
\page threads-synchronizing.html
\title Synchronizing Threads
-
+
\previouspage Starting Threads with QThread
\contentspage Thread Support in Qt
\nextpage Reentrancy and Thread-Safety
@@ -227,7 +231,7 @@
\list
\li A \e thread-safe function can be called simultaneously from
- multiple threads, even when the invocations use shared data,
+ multiple threads, even when the invocations use shared data,
because all references to the shared data are serialized.
\li A \e reentrant function can also be called simultaneously from
multiple threads, but only if each invocation uses its own data.
@@ -577,8 +581,8 @@
\endlist
- Qt Concurrent supports several STL-compatible container and iterator types,
- but works best with Qt containers that have random-access iterators, such as
+ Qt Concurrent supports several STL-compatible container and iterator types,
+ but works best with Qt containers that have random-access iterators, such as
QList or QVector. The map and filter functions accept both containers and begin/end iterators.
STL Iterator support overview:
@@ -609,14 +613,14 @@
\li QList, QVector, std::vector
\li Supported and Recommended
\endtable
-
+
Random access iterators can be faster in cases where Qt Concurrent is iterating
over a large number of lightweight items, since they allow skipping to any point
in the container. In addition, using random access iterators allows Qt Concurrent
to provide progress information trough QFuture::progressValue() and QFutureWatcher::
progressValueChanged().
- The non in-place modifying functions such as mapped() and filtered() makes a
+ The non in-place modifying functions such as mapped() and filtered() makes a
copy of the container when called. If you are using STL containers this copy operation
might take some time, in this case we recommend specifying the begin and end iterators
for the container instead.
@@ -643,7 +647,7 @@
QPainter can be used in a thread to paint onto QImage, QPrinter, and
QPicture paint devices. Painting onto QPixmaps and QWidgets is \e not
- supported. On Mac OS X the automatic progress dialog will not be
+ supported. On Mac OS X the automatic progress dialog will not be
displayed if you are printing from outside the GUI thread.
Any number of threads can paint at any given time, however only
diff --git a/src/corelib/global/qfeatures.h b/src/corelib/global/qfeatures.h
index b4b73a9aaa..b4194c18f8 100644
--- a/src/corelib/global/qfeatures.h
+++ b/src/corelib/global/qfeatures.h
@@ -326,11 +326,6 @@
#define QT_NO_SOCKS5
#endif
-// QSoftKeyManager
-#if !defined(QT_NO_SOFTKEYMANAGER) && (defined(QT_NO_ACTION))
-#define QT_NO_SOFTKEYMANAGER
-#endif
-
// QSplitter
#if !defined(QT_NO_SPLITTER) && (defined(QT_NO_RUBBERBAND))
#define QT_NO_SPLITTER
diff --git a/src/corelib/global/qfeatures.txt b/src/corelib/global/qfeatures.txt
index 7f31259c16..0f3a5c9a1d 100644
--- a/src/corelib/global/qfeatures.txt
+++ b/src/corelib/global/qfeatures.txt
@@ -63,13 +63,6 @@ Requires:
Name: QAction
SeeAlso: ???
-Feature: SOFTKEYMANAGER
-Description: Supports softkeys.
-Section: Gui
-Requires: ACTION
-Name: QSoftKeyManager
-SeeAlso: ???
-
Feature: CURSOR
Description: Supports mouse cursors.
Section: Kernel
diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp
index ccf071826a..ffdf8d0fd3 100644
--- a/src/corelib/global/qlibraryinfo.cpp
+++ b/src/corelib/global/qlibraryinfo.cpp
@@ -276,6 +276,8 @@ static const struct {
{ "HostPrefix", "" },
{ "HostBinaries", "bin" },
{ "HostData", "." },
+ { "TargetSpec", "" },
+ { "HostSpec", "" },
#endif
};
@@ -378,6 +380,12 @@ QLibraryInfo::rawLocation(LibraryLocation loc, PathGroup group)
#endif // QT_NO_SETTINGS
}
+#ifdef QT_BOOTSTRAPPED
+ // The specs need to be returned verbatim.
+ if (loc == TargetSpecPath || loc == HostSpecPath)
+ return ret;
+#endif
+
if (!ret.isEmpty() && QDir::isRelativePath(ret)) {
QString baseDir;
#ifdef QT_BOOTSTRAPPED
diff --git a/src/corelib/global/qlibraryinfo.h b/src/corelib/global/qlibraryinfo.h
index 1d9b809207..93b0c81562 100644
--- a/src/corelib/global/qlibraryinfo.h
+++ b/src/corelib/global/qlibraryinfo.h
@@ -81,7 +81,9 @@ public:
HostPrefixPath,
HostBinariesPath,
HostDataPath,
- LastHostPath = HostDataPath,
+ TargetSpecPath,
+ HostSpecPath,
+ LastHostPath = HostSpecPath,
#endif
SettingsPath = 100
};
diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h
index e7953b47dd..6430c85936 100644
--- a/src/corelib/global/qnamespace.h
+++ b/src/corelib/global/qnamespace.h
@@ -311,8 +311,6 @@ public:
BypassGraphicsProxyWidget = 0x20000000,
WindowOkButtonHint = 0x00080000,
WindowCancelButtonHint = 0x00100000,
- WindowSoftkeysVisibleHint = 0x40000000,
- WindowSoftkeysRespondHint = 0x80000000,
NoDropShadowWindowHint = 0x40000000
};
@@ -470,9 +468,6 @@ public:
WA_WState_AcceptedTouchBeginEvent = 122,
WA_TouchPadAcceptSingleTouchEvents = 123,
- WA_MergeSoftkeys = 124,
- WA_MergeSoftkeysRecursively = 125,
-
WA_X11DoNotAcceptFocus = 126,
WA_MacNoShadow = 127,
diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc
index 50578d78c5..66442a83c7 100644
--- a/src/corelib/global/qnamespace.qdoc
+++ b/src/corelib/global/qnamespace.qdoc
@@ -1160,17 +1160,6 @@
\value WA_TouchPadAcceptSingleTouchEvents Allows touchpad single
touch events to be sent to the widget.
- \value WA_MergeSoftkeys Allows widget to merge softkeys with parent widget,
- i.e. widget can set only one softkeys and request softkey implementation
- to take rest of the softkeys from the parent. Note parents are traversed until
- WA_MergeSoftkeys is not set. See also Qt::WA_MergeSoftkeysRecursively
- This attribute currently has effect only on Symbian platforms
-
- \value WA_MergeSoftkeysRecursively Allows widget to merge softkeys recursively
- with all parents. If this attribute is set, the widget parents are traversed until
- window boundary (widget without parent or dialog) is found.
- This attribute currently has effect only on Symbian platforms
-
\value WA_X11DoNotAcceptFocus Asks the window manager to not give focus
to this top level window. This attribute has no effect on non-X11
platforms.
@@ -2031,14 +2020,6 @@
\value WindowCancelButtonHint Adds a Cancel button to the window decoration of a dialog.
Only supported for Windows CE.
- \value WindowSoftkeysVisibleHint Makes softkeys visible when widget is fullscreen.
- Only supported for Symbian.
-
- \value WindowSoftkeysRespondHint Makes softkeys to receive key events even
- when invisible. With this hint the softkey actions are triggered
- even the softkeys are invisible i.e. the window is displayed with
- \c showFullscreen(). Only supported for Symbian.
-
\value WindowTransparentForInput Informs the window system that this window
is used only for output (displaying something) and does not take input.
Therefore input events should pass through as if it wasn't there.
diff --git a/src/corelib/global/qt_windows.h b/src/corelib/global/qt_windows.h
index 4bd8d60754..00a511a96f 100644
--- a/src/corelib/global/qt_windows.h
+++ b/src/corelib/global/qt_windows.h
@@ -46,17 +46,17 @@
// Borland's windows.h does not set these correctly, resulting in
// unusable WinSDK standard dialogs
#ifndef WINVER
-#define WINVER 0x400
+# define WINVER 0x0501
#endif
#ifndef _WIN32_WINNT
-#define _WIN32_WINNT 0x400
+# define _WIN32_WINNT 0x0501
#endif
#endif
#if defined(Q_CC_MINGW)
// mingw's windows.h does not set _WIN32_WINNT, resulting breaking compilation
#ifndef WINVER
-#define WINVER 0x500
+# define WINVER 0x501
#endif
#endif
@@ -65,6 +65,13 @@
#endif
#include <windows.h>
+#if defined(_WIN32_IE) && _WIN32_IE < 0x0501
+# undef _WIN32_IE
+#endif
+#if !defined(_WIN32_IE)
+# define _WIN32_IE 0x0501
+#endif
+
#ifdef _WIN32_WCE
#include <ceconfig.h>
#endif
diff --git a/src/corelib/io/io.pri b/src/corelib/io/io.pri
index 9e89f9fdc0..f57dcebe33 100644
--- a/src/corelib/io/io.pri
+++ b/src/corelib/io/io.pri
@@ -118,15 +118,13 @@ win32 {
} else {
SOURCES += io/qstandardpaths_unix.cpp
}
- } else:standardpathsjson {
- SOURCES += io/qstandardpaths_json.cpp
} else:blackberry {
SOURCES += io/qstandardpaths_blackberry.cpp
} else {
SOURCES += io/qstandardpaths_unix.cpp
}
- linux-* {
+ linux-*|if(qnx:contains(QT_CONFIG, inotify)) {
SOURCES += io/qfilesystemwatcher_inotify.cpp
HEADERS += io/qfilesystemwatcher_inotify_p.h
}
diff --git a/src/corelib/io/qfilesystemengine.cpp b/src/corelib/io/qfilesystemengine.cpp
index fe06210fb9..8707aec0b8 100644
--- a/src/corelib/io/qfilesystemengine.cpp
+++ b/src/corelib/io/qfilesystemengine.cpp
@@ -300,6 +300,13 @@ void QFileSystemMetaData::fillFromDirEnt(const QT_DIRENT &entry)
const struct dirent_extra_stat * const extra_stat =
reinterpret_cast<struct dirent_extra_stat *>(extra);
+ // Remember whether this was a link or not, this saves an lstat() call later.
+ if (extra->d_type == _DTYPE_LSTAT) {
+ knownFlagsMask |= QFileSystemMetaData::LinkType;
+ if (S_ISLNK(extra_stat->d_stat.st_mode))
+ entryFlags |= QFileSystemMetaData::LinkType;
+ }
+
// For symlinks, the extra type _DTYPE_LSTAT doesn't work for filling out the meta data,
// as we need the stat() information there, not the lstat() information.
// In this case, don't use the extra information.
diff --git a/src/corelib/io/qfilesystemwatcher.cpp b/src/corelib/io/qfilesystemwatcher.cpp
index 77a5959f8f..449be9b7b5 100644
--- a/src/corelib/io/qfilesystemwatcher.cpp
+++ b/src/corelib/io/qfilesystemwatcher.cpp
@@ -51,11 +51,14 @@
#include <qset.h>
#include <qtimer.h>
+#if defined(Q_OS_LINUX) || (defined(Q_OS_QNX) && !defined(QT_NO_INOTIFY))
+#define USE_INOTIFY
+#endif
#include "qfilesystemwatcher_polling_p.h"
#if defined(Q_OS_WIN)
# include "qfilesystemwatcher_win_p.h"
-#elif defined(Q_OS_LINUX)
+#elif defined(USE_INOTIFY)
# include "qfilesystemwatcher_inotify_p.h"
#elif defined(Q_OS_FREEBSD) || defined(Q_OS_MAC)
# include "qfilesystemwatcher_kqueue_p.h"
@@ -67,7 +70,7 @@ QFileSystemWatcherEngine *QFileSystemWatcherPrivate::createNativeEngine(QObject
{
#if defined(Q_OS_WIN)
return new QWindowsFileSystemWatcherEngine(parent);
-#elif defined(Q_OS_LINUX)
+#elif defined(USE_INOTIFY)
// there is a chance that inotify may fail on Linux pre-2.6.13 (August
// 2005), so we can't just new inotify directly.
return QInotifyFileSystemWatcherEngine::create(parent);
diff --git a/src/corelib/io/qfilesystemwatcher_inotify.cpp b/src/corelib/io/qfilesystemwatcher_inotify.cpp
index 390a280ff2..11ac0e5b5d 100644
--- a/src/corelib/io/qfilesystemwatcher_inotify.cpp
+++ b/src/corelib/io/qfilesystemwatcher_inotify.cpp
@@ -52,12 +52,20 @@
#include <qsocketnotifier.h>
#include <qvarlengtharray.h>
+#if defined(Q_OS_LINUX)
#include <sys/syscall.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include <fcntl.h>
+#endif
#if defined(QT_NO_INOTIFY)
+
+#if defined(Q_OS_QNX)
+// These files should only be compiled on QNX if the inotify headers are found
+#error "Should not get here."
+#endif
+
#include <linux/types.h>
#if defined(__i386__)
diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp
index 395effaff9..c52053000d 100644
--- a/src/corelib/io/qprocess.cpp
+++ b/src/corelib/io/qprocess.cpp
@@ -458,8 +458,8 @@ void QProcessPrivate::Channel::clear()
are supplied as individual strings in a QStringList.
For example, the following code snippet runs the analog clock
- example in the Motif style on X11 platforms by passing strings
- containing "-style" and "motif" as two items in the list of
+ example in the Fusion style on X11 platforms by passing strings
+ containing "-style" and "fusion" as two items in the list of
arguments:
\snippet qprocess/qprocess-simpleexecution.cpp 0
diff --git a/src/corelib/io/qstandardpaths.cpp b/src/corelib/io/qstandardpaths.cpp
index 91e343b021..4d7e359117 100644
--- a/src/corelib/io/qstandardpaths.cpp
+++ b/src/corelib/io/qstandardpaths.cpp
@@ -272,7 +272,7 @@ QString QStandardPaths::findExecutable(const QString &executableName, const QStr
searchPaths.reserve(rawPaths.size());
foreach (const QString &rawPath, rawPaths) {
QString cleanPath = QDir::cleanPath(rawPath);
- if (cleanPath.size() > 1 && cleanPath.endsWith('/'))
+ if (cleanPath.size() > 1 && cleanPath.endsWith(QLatin1Char('/')))
cleanPath.truncate(cleanPath.size() - 1);
searchPaths.push_back(cleanPath);
}
diff --git a/src/corelib/io/qstandardpaths_json.cpp b/src/corelib/io/qstandardpaths_json.cpp
deleted file mode 100644
index 839cd9e873..0000000000
--- a/src/corelib/io/qstandardpaths_json.cpp
+++ /dev/null
@@ -1,258 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include "qstandardpaths.h"
-
-#include <QString>
-#include <QJsonDocument>
-#include <QJsonObject>
-#include <QJsonValue>
-#include <QJsonArray>
-#include <QFile>
-#include <QDir>
-#include <QAtomicPointer>
-#include <QCoreApplication>
-#include <QRegularExpression>
-#include <QRegularExpressionMatchIterator>
-#include <QRegularExpressionMatch>
-
-#ifndef QT_NO_STANDARDPATHS
-
-QT_BEGIN_NAMESPACE
-
-class QStandardPathsPrivate {
-public:
- QStandardPathsPrivate() : object(0){}
- ~QStandardPathsPrivate() { delete object.load(); }
- QAtomicPointer<QJsonObject> object;
-};
-
-Q_GLOBAL_STATIC(QStandardPathsPrivate, configCache);
-
-/*!
- \internal
- Substitute environment variables in the form ${name}
-
- The JSON QStandardPaths implementation can be configured on a per user
- (or per application) basis through the use of environment variables,
- which are evaluated each time a location is queried. This function
- performs that evaluation on \a value. No substitution is performed
- for undefined variables.
-
- This slightly underselects according to the 2009-09-20 version of
- the GNU setenv(3) manual page: It disallows '}' within the variable
- name. ${var}} will look for a variable named "var", not "var}".
- */
-static QString substituteEnvVars(const QJsonValue & value)
-{
- QString str = value.toString();
- if (str.isEmpty() || !str.contains(QLatin1String("${")))
- return str;
-
- // optimize for a common case
- str.replace(QLatin1String("${HOME}"), QDir::homePath());
-
- // Do ${} format environment variable substitution if necessary
- // repeat this test because ${HOME} might expand to the empty string
- if (!str.isEmpty() && str.contains(QLatin1String("${"))) {
- QRegularExpression varRegExp(QLatin1String("\\$\\{([^\\}=]*)\\}"));
- QRegularExpressionMatchIterator matchIterator =
- varRegExp.globalMatch(str);
- while (matchIterator.hasNext()) {
- QRegularExpressionMatch match = matchIterator.next();
- QByteArray envValue =
- qgetenv(match.captured(1).toLatin1().data());
- if (!envValue.isNull()) {
- QString replacement =
- QFile::decodeName(envValue);
- str.replace(match.captured(0), replacement);
- }
- }
- }
- return str;
-}
-
-static void appendOrganizationAndApp(QString &path)
-{
- const QString org = QCoreApplication::organizationName();
- if (!org.isEmpty())
- path += QLatin1Char('/') + org;
- const QString appName = QCoreApplication::applicationName();
- if (!appName.isEmpty())
- path += QLatin1Char('/') + appName;
-}
-
-QString QStandardPaths::writableLocation(StandardLocation type)
-{
- QStringList locations = QStandardPaths::standardLocations(type);
- if (locations.isEmpty())
- return QString();
- return locations.first();
-}
-
-QStringList QStandardPaths::standardLocations(StandardLocation type)
-{
- switch (type) {
- case HomeLocation:
- return QStringList(QDir::homePath()); // set $HOME
- case TempLocation:
- return QStringList(QDir::tempPath()); // set $TMPDIR
- default:
- break;
- }
-
- if (isTestModeEnabled()) {
- const QString qttestDir = QDir::homePath() + QLatin1String("/.qttest");
- QString path;
- switch (type) {
- case GenericDataLocation:
- case DataLocation:
- path = qttestDir + QLatin1String("/share");
- if (type == DataLocation)
- appendOrganizationAndApp(path);
- return QStringList(path);
- case GenericCacheLocation:
- case CacheLocation:
- path = qttestDir + QLatin1String("/cache");
- if (type == CacheLocation)
- appendOrganizationAndApp(path);
- return QStringList(path);
- case ConfigLocation:
- return QStringList(qttestDir + QLatin1String("/config"));
- default:
- break;
- }
- }
-
-
- QJsonObject * localConfigObject = configCache()->object.loadAcquire();
- if (localConfigObject == 0) {
- QString configHome = QFile::decodeName(qgetenv("PATH_CONFIG_HOME"));
- if (configHome.isEmpty())
- configHome = QLatin1String("/etc/user-dirs.json");
- QFile file(configHome);
- if (file.open(QIODevice::ReadOnly)) {
- QJsonDocument configDoc = QJsonDocument::fromJson(file.readAll());
- if (configDoc.isNull())
- return QStringList();
-
- QJsonObject myConfigObject = configDoc.object();
- localConfigObject = new QJsonObject(myConfigObject);
- if (!configCache()->object.testAndSetRelease(0, localConfigObject)) {
- delete localConfigObject;
- localConfigObject = configCache()->object.loadAcquire();
- }
- } else {
- return QStringList();
- }
- }
-
- QLatin1String key("");
-
- switch (type) {
- case DocumentsLocation:
- key = QLatin1String("DOCUMENTS");
- break;
- case PicturesLocation:
- key = QLatin1String("PICTURES");
- break;
- case MusicLocation:
- key = QLatin1String("MUSIC");
- break;
- case MoviesLocation:
- key = QLatin1String("VIDEOS");
- break;
- case DownloadLocation:
- key = QLatin1String("DOWNLOAD");
- break;
- case ApplicationsLocation:
- key = QLatin1String("APPLICATIONS");
- break;
- case CacheLocation:
- key = QLatin1String("CACHE");
- break;
- case GenericCacheLocation:
- key = QLatin1String("GENERIC_CACHE");
- break;
- case DataLocation:
- key = QLatin1String("DATA");
- break;
- case GenericDataLocation:
- key = QLatin1String("GENERIC_DATA");
- break;
- case ConfigLocation:
- key = QLatin1String("CONFIG");
- break;
- case RuntimeLocation:
- key = QLatin1String("RUNTIME");
- break;
- case DesktopLocation:
- key = QLatin1String("DESKTOP");
- break;
- case FontsLocation:
- key = QLatin1String("FONTS");
- break;
-
- default:
- return QStringList();
- }
-
- QJsonObject::const_iterator iter = localConfigObject->constFind(key);
- if (iter == localConfigObject->constEnd())
- return QStringList();
-
- switch (iter.value().type()) {
- case QJsonValue::Array: {
- QStringList resultList;
- foreach (const QJsonValue &item, iter.value().toArray())
- resultList.append(substituteEnvVars(item));
- return resultList;
- }
- case QJsonValue::String:
- return QStringList(substituteEnvVars(iter.value()));
- default:
- break;
- }
- return QStringList();
-}
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_STANDARDPATHS
diff --git a/src/corelib/io/qwindowspipereader.cpp b/src/corelib/io/qwindowspipereader.cpp
index cca6e80810..bef6097043 100644
--- a/src/corelib/io/qwindowspipereader.cpp
+++ b/src/corelib/io/qwindowspipereader.cpp
@@ -213,7 +213,8 @@ void QWindowsPipeReader::startAsyncRead()
// We get notified by the QWinOverlappedIoNotifier - even in the synchronous case.
return;
} else {
- switch (GetLastError()) {
+ const DWORD dwError = GetLastError();
+ switch (dwError) {
case ERROR_IO_PENDING:
// This is not an error. We're getting notified, when data arrives.
return;
@@ -223,16 +224,19 @@ void QWindowsPipeReader::startAsyncRead()
// didn't fit into the pipe's system buffer.
// We're getting notified by the QWinOverlappedIoNotifier.
break;
+ case ERROR_BROKEN_PIPE:
case ERROR_PIPE_NOT_CONNECTED:
{
// It may happen, that the other side closes the connection directly
// after writing data. Then we must set the appropriate socket state.
+ readSequenceStarted = false;
pipeBroken = true;
emit pipeClosed();
return;
}
default:
- emit winError(GetLastError(), QLatin1String("QWindowsPipeReader::startAsyncRead"));
+ readSequenceStarted = false;
+ emit winError(dwError, QLatin1String("QWindowsPipeReader::startAsyncRead"));
return;
}
}
diff --git a/src/corelib/itemmodels/qabstractitemmodel_p.h b/src/corelib/itemmodels/qabstractitemmodel_p.h
index c672888992..e44931a16b 100644
--- a/src/corelib/itemmodels/qabstractitemmodel_p.h
+++ b/src/corelib/itemmodels/qabstractitemmodel_p.h
@@ -95,7 +95,7 @@ public:
void itemsAboutToBeMoved(const QModelIndex &srcParent, int srcFirst, int srcLast, const QModelIndex &destinationParent, int destinationChild, Qt::Orientation);
void itemsMoved(const QModelIndex &srcParent, int srcFirst, int srcLast, const QModelIndex &destinationParent, int destinationChild, Qt::Orientation orientation);
bool allowMove(const QModelIndex &srcParent, int srcFirst, int srcLast, const QModelIndex &destinationParent, int destinationChild, Qt::Orientation orientation);
-
+
inline QModelIndex createIndex(int row, int column, void *data = 0) const {
return q_func()->createIndex(row, column, data);
}
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index 8ff4aa7c54..590d127094 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -577,8 +577,12 @@ void QCoreApplication::flush()
\a argc must be greater than zero and \a argv must contain at least
one valid character string.
*/
-QCoreApplication::QCoreApplication(int &argc, char **argv, int _internal)
-: QObject(*new QCoreApplicationPrivate(argc, argv, _internal))
+QCoreApplication::QCoreApplication(int &argc, char **argv
+#ifndef Q_QDOC
+ , int _internal
+#endif
+ )
+ : QObject(*new QCoreApplicationPrivate(argc, argv, _internal))
{
init();
QCoreApplicationPrivate::eventDispatcher->startingUp();
@@ -698,7 +702,17 @@ bool QCoreApplication::testAttribute(Qt::ApplicationAttribute attribute)
return QCoreApplicationPrivate::testAttribute(attribute);
}
-/*!/
+
+/*!
+ \property QCoreApplication::quitLockEnabled
+
+ Returns true if the use of the QEventLoopLocker feature can cause the
+ application to quit, otherwise returns false.
+
+ \sa QEventLoopLocker
+*/
+
+/*!
Returns true if the use of the QEventLoopLocker feature can cause the
application to quit, otherwise returns false.
@@ -2220,7 +2234,7 @@ void QCoreApplication::installNativeEventFilter(QAbstractNativeEventFilter *filt
}
/*!
- Removes an event filter object \a obj from this object. The
+ Removes an event \a filterObject from this object. The
request is ignored if such an event filter has not been installed.
All event filters for this object are automatically removed when
@@ -2232,12 +2246,12 @@ void QCoreApplication::installNativeEventFilter(QAbstractNativeEventFilter *filt
\sa installNativeEventFilter()
\since 5.0
*/
-void QCoreApplication::removeNativeEventFilter(QAbstractNativeEventFilter *filterObj)
+void QCoreApplication::removeNativeEventFilter(QAbstractNativeEventFilter *filterObject)
{
QAbstractEventDispatcher *eventDispatcher = QAbstractEventDispatcher::instance();
- if (!filterObj || !eventDispatcher)
+ if (!filterObject || !eventDispatcher)
return;
- eventDispatcher->removeNativeEventFilter(filterObj);
+ eventDispatcher->removeNativeEventFilter(filterObject);
}
/*!
diff --git a/src/corelib/kernel/qcoreapplication.h b/src/corelib/kernel/qcoreapplication.h
index 46eab4e740..b65f0cd314 100644
--- a/src/corelib/kernel/qcoreapplication.h
+++ b/src/corelib/kernel/qcoreapplication.h
@@ -85,7 +85,11 @@ public:
GuiServer // # deprecated
};
- QCoreApplication(int &argc, char **argv, int = ApplicationFlags);
+ QCoreApplication(int &argc, char **argv
+#ifndef Q_QDOC
+ , int = ApplicationFlags
+#endif
+ );
~QCoreApplication();
diff --git a/src/corelib/kernel/qcoreevent.cpp b/src/corelib/kernel/qcoreevent.cpp
index 71690ba90b..c0292ee984 100644
--- a/src/corelib/kernel/qcoreevent.cpp
+++ b/src/corelib/kernel/qcoreevent.cpp
@@ -270,7 +270,6 @@ QT_BEGIN_NAMESPACE
\omitvalue MacGLClearDrawable
\omitvalue NetworkReplyUpdated
\omitvalue FutureCallOut
- \omitvalue UpdateSoftKeys
\omitvalue NativeGesture
*/
diff --git a/src/corelib/kernel/qcoreevent.h b/src/corelib/kernel/qcoreevent.h
index d30f93f9f3..6cce838649 100644
--- a/src/corelib/kernel/qcoreevent.h
+++ b/src/corelib/kernel/qcoreevent.h
@@ -256,8 +256,6 @@ public:
RequestSoftwareInputPanel = 199,
CloseSoftwareInputPanel = 200,
- UpdateSoftKeys = 201, // Internal for compressing soft key updates
-
WinIdChange = 203,
#ifndef QT_NO_GESTURES
Gesture = 198,
diff --git a/src/corelib/kernel/qeventdispatcher_blackberry.cpp b/src/corelib/kernel/qeventdispatcher_blackberry.cpp
index b2ec574c89..4be1d73b7a 100644
--- a/src/corelib/kernel/qeventdispatcher_blackberry.cpp
+++ b/src/corelib/kernel/qeventdispatcher_blackberry.cpp
@@ -67,7 +67,7 @@ struct bpsIOHandlerData {
fd_set *exceptfds;
};
-static int bpsIOReadyDomain = -1;
+static int bpsUnblockDomain = -1;
static int bpsIOHandler(int fd, int io_events, void *data)
{
@@ -103,13 +103,13 @@ static int bpsIOHandler(int fd, int io_events, void *data)
qEventDispatcherDebug << "Sending bpsIOReadyDomain event";
// create IO ready event
bps_event_t *event;
- int result = bps_event_create(&event, bpsIOReadyDomain, 0, NULL, NULL);
+ int result = bps_event_create(&event, bpsUnblockDomain, 0, NULL, NULL);
if (result != BPS_SUCCESS) {
qWarning("QEventDispatcherBlackberryPrivate::QEventDispatcherBlackberry: bps_event_create() failed");
return BPS_FAILURE;
}
- // post IO ready event to our thread
+ // post unblock event to our thread
result = bps_push_event(event);
if (result != BPS_SUCCESS) {
qWarning("QEventDispatcherBlackberryPrivate::QEventDispatcherBlackberry: bps_push_event() failed");
@@ -129,31 +129,33 @@ QEventDispatcherBlackberryPrivate::QEventDispatcherBlackberryPrivate()
if (result != BPS_SUCCESS)
qFatal("QEventDispatcherBlackberryPrivate::QEventDispatcherBlackberry: bps_initialize() failed");
- // get domain for IO ready events - ignoring race condition here for now
- if (bpsIOReadyDomain == -1) {
- bpsIOReadyDomain = bps_register_domain();
- if (bpsIOReadyDomain == -1)
+ bps_channel = bps_channel_get_active();
+
+ // get domain for IO ready and wake up events - ignoring race condition here for now
+ if (bpsUnblockDomain == -1) {
+ bpsUnblockDomain = bps_register_domain();
+ if (bpsUnblockDomain == -1)
qWarning("QEventDispatcherBlackberryPrivate::QEventDispatcherBlackberry: bps_register_domain() failed");
}
-
- // Register thread_pipe[0] with bps
- int io_events = BPS_IO_INPUT;
- result = bps_add_fd(thread_pipe[0], io_events, &bpsIOHandler, ioData.data());
- if (result != BPS_SUCCESS)
- qWarning() << Q_FUNC_INFO << "bps_add_fd() failed";
}
QEventDispatcherBlackberryPrivate::~QEventDispatcherBlackberryPrivate()
{
- // Unregister thread_pipe[0] from bps
- const int result = bps_remove_fd(thread_pipe[0]);
- if (result != BPS_SUCCESS)
- qWarning() << Q_FUNC_INFO << "bps_remove_fd() failed";
-
// we're done using BPS
bps_shutdown();
}
+int QEventDispatcherBlackberryPrivate::initThreadWakeUp()
+{
+ return -1; // no fd's used
+}
+
+int QEventDispatcherBlackberryPrivate::processThreadWakeUp(int nsel)
+{
+ Q_UNUSED(nsel);
+ return wakeUps.fetchAndStoreRelaxed(0);
+}
+
/////////////////////////////////////////////////////////////////////////////
QEventDispatcherBlackberry::QEventDispatcherBlackberry(QObject *parent)
@@ -317,7 +319,7 @@ int QEventDispatcherBlackberry::select(int nfds, fd_set *readfds, fd_set *writef
if (!event) // In case of !event, we break out of the loop to let Qt process the timers
break; // (since timeout has expired) and socket notifiers that are now ready.
- if (bps_event_get_domain(event) == bpsIOReadyDomain) {
+ if (bps_event_get_domain(event) == bpsUnblockDomain) {
timeoutTotal = 0; // in order to immediately drain the event queue of native events
event = 0; // (especially touch move events) we don't break out here
}
@@ -339,6 +341,21 @@ int QEventDispatcherBlackberry::select(int nfds, fd_set *readfds, fd_set *writef
return d->ioData->count;
}
+void QEventDispatcherBlackberry::wakeUp()
+{
+ Q_D(QEventDispatcherBlackberry);
+ if (d->wakeUps.testAndSetAcquire(0, 1)) {
+ bps_event_t *event;
+ if (bps_event_create(&event, bpsUnblockDomain, 0, 0, 0) == BPS_SUCCESS) {
+ if (bps_channel_push_event(d->bps_channel, event) == BPS_SUCCESS)
+ return;
+ else
+ bps_event_destroy(event);
+ }
+ qWarning("QEventDispatcherBlackberryPrivate::wakeUp failed");
+ }
+}
+
int QEventDispatcherBlackberry::ioEvents(int fd)
{
int io_events = 0;
diff --git a/src/corelib/kernel/qeventdispatcher_blackberry_p.h b/src/corelib/kernel/qeventdispatcher_blackberry_p.h
index 84cdf9e2dd..79ed21dbf2 100644
--- a/src/corelib/kernel/qeventdispatcher_blackberry_p.h
+++ b/src/corelib/kernel/qeventdispatcher_blackberry_p.h
@@ -71,6 +71,8 @@ public:
void registerSocketNotifier(QSocketNotifier *notifier);
void unregisterSocketNotifier(QSocketNotifier *notifier);
+ void wakeUp();
+
protected:
QEventDispatcherBlackberry(QEventDispatcherBlackberryPrivate &dd, QObject *parent = 0);
@@ -89,6 +91,10 @@ public:
QEventDispatcherBlackberryPrivate();
~QEventDispatcherBlackberryPrivate();
+ int initThreadWakeUp();
+ int processThreadWakeUp(int nsel);
+
+ int bps_channel;
QScopedPointer<bpsIOHandlerData> ioData;
};
diff --git a/src/corelib/kernel/qeventdispatcher_unix.cpp b/src/corelib/kernel/qeventdispatcher_unix.cpp
index 44715b0553..6c2a610a56 100644
--- a/src/corelib/kernel/qeventdispatcher_unix.cpp
+++ b/src/corelib/kernel/qeventdispatcher_unix.cpp
@@ -110,7 +110,7 @@ QEventDispatcherUNIXPrivate::QEventDispatcherUNIXPrivate()
bool pipefail = false;
// initialize the common parts of the event loop
-#if defined(Q_OS_NACL)
+#if defined(Q_OS_NACL) || defined (Q_OS_BLACKBERRY)
// do nothing.
#elif defined(Q_OS_INTEGRITY)
// INTEGRITY doesn't like a "select" on pipes, so use socketpair instead
@@ -157,7 +157,7 @@ QEventDispatcherUNIXPrivate::QEventDispatcherUNIXPrivate()
QEventDispatcherUNIXPrivate::~QEventDispatcherUNIXPrivate()
{
-#if defined(Q_OS_NACL)
+#if defined(Q_OS_NACL) || defined (Q_OS_BLACKBERRY)
// do nothing.
#elif defined(Q_OS_VXWORKS)
close(thread_pipe[0]);
@@ -211,8 +211,8 @@ int QEventDispatcherUNIXPrivate::doSelect(QEventLoop::ProcessEventsFlags flags,
FD_ZERO(&sn_vec[2].select_fds);
}
- FD_SET(thread_pipe[0], &sn_vec[0].select_fds);
- highest = qMax(highest, thread_pipe[0]);
+ int wakeUpFd = initThreadWakeUp();
+ highest = qMax(highest, wakeUpFd);
nsel = q->select(highest + 1,
&sn_vec[0].select_fds,
@@ -271,25 +271,7 @@ int QEventDispatcherUNIXPrivate::doSelect(QEventLoop::ProcessEventsFlags flags,
}
}
- // some other thread woke us up... consume the data on the thread pipe so that
- // select doesn't immediately return next time
- int nevents = 0;
- if (nsel > 0 && FD_ISSET(thread_pipe[0], &sn_vec[0].select_fds)) {
-#if defined(Q_OS_VXWORKS)
- char c[16];
- ::read(thread_pipe[0], c, sizeof(c));
- ::ioctl(thread_pipe[0], FIOFLUSH, 0);
-#else
- char c[16];
- while (::read(thread_pipe[0], c, sizeof(c)) > 0)
- ;
-#endif
- if (!wakeUps.testAndSetRelease(1, 0)) {
- // hopefully, this is dead code
- qWarning("QEventDispatcherUNIX: internal error, wakeUps.testAndSetRelease(1, 0) failed!");
- }
- ++nevents;
- }
+ int nevents = processThreadWakeUp(nsel);
// activate socket notifiers
if (! (flags & QEventLoop::ExcludeSocketNotifiers) && nsel > 0 && sn_highest >= 0) {
@@ -307,6 +289,35 @@ int QEventDispatcherUNIXPrivate::doSelect(QEventLoop::ProcessEventsFlags flags,
return (nevents + q->activateSocketNotifiers());
}
+int QEventDispatcherUNIXPrivate::initThreadWakeUp()
+{
+ FD_SET(thread_pipe[0], &sn_vec[0].select_fds);
+ return thread_pipe[0];
+}
+
+int QEventDispatcherUNIXPrivate::processThreadWakeUp(int nsel)
+{
+ if (nsel > 0 && FD_ISSET(thread_pipe[0], &sn_vec[0].select_fds)) {
+ // some other thread woke us up... consume the data on the thread pipe so that
+ // select doesn't immediately return next time
+#if defined(Q_OS_VXWORKS)
+ char c[16];
+ ::read(thread_pipe[0], c, sizeof(c));
+ ::ioctl(thread_pipe[0], FIOFLUSH, 0);
+#else
+ char c[16];
+ while (::read(thread_pipe[0], c, sizeof(c)) > 0)
+ ;
+#endif
+ if (!wakeUps.testAndSetRelease(1, 0)) {
+ // hopefully, this is dead code
+ qWarning("QEventDispatcherUNIX: internal error, wakeUps.testAndSetRelease(1, 0) failed!");
+ }
+ return 1;
+ }
+ return 0;
+}
+
QEventDispatcherUNIX::QEventDispatcherUNIX(QObject *parent)
: QAbstractEventDispatcher(*new QEventDispatcherUNIXPrivate, parent)
{ }
diff --git a/src/corelib/kernel/qeventdispatcher_unix_p.h b/src/corelib/kernel/qeventdispatcher_unix_p.h
index 0c5d06ddd1..98ea19ced8 100644
--- a/src/corelib/kernel/qeventdispatcher_unix_p.h
+++ b/src/corelib/kernel/qeventdispatcher_unix_p.h
@@ -144,6 +144,8 @@ public:
~QEventDispatcherUNIXPrivate();
int doSelect(QEventLoop::ProcessEventsFlags flags, timeval *timeout);
+ virtual int initThreadWakeUp();
+ virtual int processThreadWakeUp(int nsel);
bool mainThread;
int thread_pipe[2];
diff --git a/src/corelib/kernel/qmath.h b/src/corelib/kernel/qmath.h
index e76c2da57c..c5aa90e519 100644
--- a/src/corelib/kernel/qmath.h
+++ b/src/corelib/kernel/qmath.h
@@ -192,10 +192,58 @@ inline qreal qPow(qreal x, qreal y)
return pow(x, y);
}
+#ifndef M_E
+#define M_E (2.7182818284590452354)
+#endif
+
+#ifndef M_LOG2E
+#define M_LOG2E (1.4426950408889634074)
+#endif
+
+#ifndef M_LOG10E
+#define M_LOG10E (0.43429448190325182765)
+#endif
+
+#ifndef M_LN2
+#define M_LN2 (0.69314718055994530942)
+#endif
+
+#ifndef M_LN10
+#define M_LN10 (2.30258509299404568402)
+#endif
+
#ifndef M_PI
#define M_PI (3.14159265358979323846)
#endif
+#ifndef M_PI_2
+#define M_PI_2 (1.57079632679489661923)
+#endif
+
+#ifndef M_PI_4
+#define M_PI_4 (0.78539816339744830962)
+#endif
+
+#ifndef M_1_PI
+#define M_1_PI (0.31830988618379067154)
+#endif
+
+#ifndef M_2_PI
+#define M_2_PI (0.63661977236758134308)
+#endif
+
+#ifndef M_2_SQRTPI
+#define M_2_SQRTPI (1.12837916709551257390)
+#endif
+
+#ifndef M_SQRT2
+#define M_SQRT2 (1.41421356237309504880)
+#endif
+
+#ifndef M_SQRT1_2
+#define M_SQRT1_2 (0.70710678118654752440)
+#endif
+
inline qreal qFastSin(qreal x)
{
int si = int(x * (0.5 * QT_SINE_TABLE_SIZE / M_PI)); // Would be more accurate with qRound, but slower.
diff --git a/src/corelib/kernel/qmimedata.cpp b/src/corelib/kernel/qmimedata.cpp
index f48d1c7576..bbc9577b8c 100644
--- a/src/corelib/kernel/qmimedata.cpp
+++ b/src/corelib/kernel/qmimedata.cpp
@@ -192,13 +192,10 @@ QVariant QMimeDataPrivate::retrieveTypedData(const QString &format, QVariant::Ty
case QVariant::ByteArray:
case QVariant::Color:
return data.toByteArray();
- break;
case QVariant::String:
return data.toString().toUtf8();
- break;
case QVariant::Url:
return data.toUrl().toEncoded();
- break;
case QVariant::List: {
// has to be list of URLs
QByteArray result;
diff --git a/src/corelib/thread/qfutureinterface.cpp b/src/corelib/thread/qfutureinterface.cpp
index ce9eb143d7..e85f632fdf 100644
--- a/src/corelib/thread/qfutureinterface.cpp
+++ b/src/corelib/thread/qfutureinterface.cpp
@@ -419,6 +419,16 @@ bool QFutureInterfaceBase::referenceCountIsOne() const
return d->refCount.load() == 1;
}
+bool QFutureInterfaceBase::refT() const
+{
+ return d->refCount.refT();
+}
+
+bool QFutureInterfaceBase::derefT() const
+{
+ return d->refCount.derefT();
+}
+
QFutureInterfaceBasePrivate::QFutureInterfaceBasePrivate(QFutureInterfaceBase::State initialState)
: refCount(1), m_progressValue(0), m_progressMinimum(0), m_progressMaximum(0),
state(initialState), pendingResults(0),
diff --git a/src/corelib/thread/qfutureinterface.h b/src/corelib/thread/qfutureinterface.h
index b7bf779412..3cbb9506ec 100644
--- a/src/corelib/thread/qfutureinterface.h
+++ b/src/corelib/thread/qfutureinterface.h
@@ -130,6 +130,8 @@ public:
protected:
bool referenceCountIsOne() const;
+ bool refT() const;
+ bool derefT() const;
public:
#ifndef QFUTURE_TEST
@@ -148,13 +150,17 @@ class QFutureInterface : public QFutureInterfaceBase
public:
QFutureInterface(State initialState = NoState)
: QFutureInterfaceBase(initialState)
- { }
+ {
+ refT();
+ }
QFutureInterface(const QFutureInterface &other)
: QFutureInterfaceBase(other)
- { }
+ {
+ refT();
+ }
~QFutureInterface()
{
- if (referenceCountIsOne())
+ if (!derefT())
resultStore().clear();
}
@@ -163,7 +169,8 @@ public:
QFutureInterface &operator=(const QFutureInterface &other)
{
- if (referenceCountIsOne())
+ other.refT();
+ if (!derefT())
resultStore().clear();
QFutureInterfaceBase::operator=(other);
return *this;
diff --git a/src/corelib/thread/qfutureinterface_p.h b/src/corelib/thread/qfutureinterface_p.h
index a9081d4c89..ece5e56768 100644
--- a/src/corelib/thread/qfutureinterface_p.h
+++ b/src/corelib/thread/qfutureinterface_p.h
@@ -129,7 +129,31 @@ class QFutureInterfaceBasePrivate
public:
QFutureInterfaceBasePrivate(QFutureInterfaceBase::State initialState);
- QAtomicInt refCount;
+ // When the last QFuture<T> reference is removed, we need to make
+ // sure that data stored in the ResultStore is cleaned out.
+ // Since QFutureInterfaceBasePrivate can be shared between QFuture<T>
+ // and QFuture<void> objects, we use a separate ref. counter
+ // to keep track of QFuture<T> objects.
+ class RefCount
+ {
+ public:
+ inline RefCount(int r = 0, int rt = 0)
+ : m_refCount(r), m_refCountT(rt) {}
+ // Default ref counter for QFIBP
+ inline bool ref() { return m_refCount.ref(); }
+ inline bool deref() { return m_refCount.deref(); }
+ inline int load() const { return m_refCount.load(); }
+ // Ref counter for type T
+ inline bool refT() { return m_refCountT.ref(); }
+ inline bool derefT() { return m_refCountT.deref(); }
+ inline int loadT() const { return m_refCountT.load(); }
+
+ private:
+ QAtomicInt m_refCount;
+ QAtomicInt m_refCountT;
+ };
+
+ RefCount refCount;
mutable QMutex m_mutex;
QWaitCondition waitCondition;
QList<QFutureCallOutInterface *> outputConnections;
diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp
index 7d18e93dce..56dc0fade9 100644
--- a/src/corelib/tools/qdatetime.cpp
+++ b/src/corelib/tools/qdatetime.cpp
@@ -93,47 +93,67 @@ static inline QDate fixedDate(int y, int m, int d)
return result;
}
-static inline qint64 julianDayFromDate(qint64 year, int month, int day)
+static inline qint64 floordiv(qint64 a, qint64 b)
{
- // Gregorian calendar
- // Algorithm from Henry F. Fliegel and Thomas C. Van Flandern
+ return (a - (a < 0 ? b-1 : 0)) / b;
+}
+static inline qint64 floordiv(qint64 a, int b)
+{
+ return (a - (a < 0 ? b-1 : 0)) / b;
+}
+
+static inline int floordiv(int a, int b)
+{
+ return (a - (a < 0 ? b-1 : 0)) / b;
+}
+
+static inline qint64 julianDayFromDate(int year, int month, int day)
+{
+ // Adjust for no year 0
if (year < 0)
++year;
- return (1461 * (year + 4800 + (month - 14) / 12)) / 4
- + (367 * (month - 2 - 12 * ((month - 14) / 12))) / 12
- - (3 * ((year + 4900 + (month - 14) / 12) / 100)) / 4
- + day - 32075;
+/*
+ * Math from The Calendar FAQ at http://www.tondering.dk/claus/cal/julperiod.php
+ * This formula is correct for all julian days, when using mathematical integer
+ * division (round to negative infinity), not c++11 integer division (round to zero)
+ */
+ int a = floordiv(14 - month, 12);
+ qint64 y = (qint64)year + 4800 - a;
+ int m = month + 12 * a - 3;
+ return day + floordiv(153 * m + 2, 5) + 365 * y + floordiv(y, 4) - floordiv(y, 100) + floordiv(y, 400) - 32045;
}
-static void getDateFromJulianDay(qint64 julianDay, int *year, int *month, int *day)
+static void getDateFromJulianDay(qint64 julianDay, int *yearp, int *monthp, int *dayp)
{
- int y, m, d;
+/*
+ * Math from The Calendar FAQ at http://www.tondering.dk/claus/cal/julperiod.php
+ * This formula is correct for all julian days, when using mathematical integer
+ * division (round to negative infinity), not c++11 integer division (round to zero)
+ */
+ qint64 a = julianDay + 32044;
+ qint64 b = floordiv(4 * a + 3, 146097);
+ int c = a - floordiv(146097 * b, 4);
- // Gregorian calendar
- // This algorithm is from Henry F. Fliegel and Thomas C. Van Flandern
- qint64 ell, n, i, j; //TODO These will need to be bigger to prevent overflow!!!
- ell = julianDay + 68569;
- n = (4 * ell) / 146097;
- ell = ell - (146097 * n + 3) / 4;
- i = (4000 * (ell + 1)) / 1461001;
- ell = ell - (1461 * i) / 4 + 31;
- j = (80 * ell) / 2447;
- d = ell - (2447 * j) / 80;
- ell = j / 11;
- m = j + 2 - (12 * ell);
- y = 100 * (n - 49) + i + ell;
+ int d = floordiv(4 * c + 3, 1461);
+ int e = c - floordiv(1461 * d, 4);
+ int m = floordiv(5 * e + 2, 153);
- if (y<= 0)
- --y;
+ int day = e - floordiv(153 * m + 2, 5) + 1;
+ int month = m + 3 - 12 * floordiv(m, 10);
+ int year = 100 * b + d - 4800 + floordiv(m, 10);
- if (year)
- *year = y;
- if (month)
- *month = m;
- if (day)
- *day = d;
+ // Adjust for no year 0
+ if (year <= 0)
+ --year ;
+
+ if (yearp)
+ *yearp = year;
+ if (monthp)
+ *monthp = month;
+ if (dayp)
+ *dayp = day;
}
@@ -225,14 +245,8 @@ static QString fmtDateTime(const QString& f, const QTime* dt = 0, const QDate* d
QDate::toJulianDay() and can be set using QDate::fromJulianDay().
The range of dates able to be stored by QDate as a Julian Day number is
- limited for convenience from std::numeric_limits<qint64>::min() / 2 to
- std::numeric_limits<qint64>::max() / 2, which on most platforms means
- from around 2.5 quadrillion BCE to around 2.5 quadrillion CE, effectively
- covering the full range of astronomical time. The range of Julian Days
- able to be accurately converted to and from valid YMD form Dates is
- restricted to 1 January 4800 BCE to 31 December 1400000 CE due to
- shortcomings in the available conversion formulas. Conversions outside this
- range are not guaranteed to be correct. This may change in the future.
+ for technical reasons limited to between -784350574879 and 784354017364,
+ which means from before 2 billion BCE to after 2 billion CE.
\sa QTime, QDateTime, QDateEdit, QDateTimeEdit, QCalendarWidget
*/
@@ -859,9 +873,6 @@ QString QDate::toString(const QString& format) const
If the specified date is invalid, the QDate object is set to be
invalid.
- Note that any date before 4800 BCE or after about 1.4 million CE
- may not be accurately stored.
-
\sa isValid()
*/
bool QDate::setDate(int year, int month, int day)
@@ -882,9 +893,6 @@ bool QDate::setDate(int year, int month, int day)
Returns 0 if the date is invalid.
- Note that any date before 4800 BCE or after about 1.4 million CE
- may not be accurately stored.
-
\sa year(), month(), day(), isValid()
*/
void QDate::getDate(int *year, int *month, int *day)
@@ -2100,14 +2108,8 @@ int QTime::elapsed() const
QDate::toJulianDay() and can be set using QDate::fromJulianDay().
The range of dates able to be stored by QDate as a Julian Day number is
- limited for convenience from std::numeric_limits<qint64>::min() / 2 to
- std::numeric_limits<qint64>::max() / 2, which on most platforms means
- from around 2.5 quadrillion BCE to around 2.5 quadrillion CE, effectively
- covering the full range of astronomical time. The range of Julian Days
- able to be accurately converted to and from valid YMD form Dates is
- restricted to 1 January 4800 BCE to 31 December 1400000 CE due to
- shortcomings in the available conversion formulas. Conversions outside this
- range are not guaranteed to be correct. This may change in the future.
+ for technical reasons limited to between -784350574879 and 784354017364,
+ which means from before 2 billion BCE to after 2 billion CE.
\section2
Use of System Timezone
@@ -2418,7 +2420,7 @@ void QDateTime::setMSecsSinceEpoch(qint64 msecs)
QDateTimePrivate::Spec oldSpec = d->spec;
- int ddays = msecs / MSECS_PER_DAY;
+ qint64 ddays = msecs / MSECS_PER_DAY;
msecs %= MSECS_PER_DAY;
if (msecs < 0) {
// negative
@@ -3391,10 +3393,11 @@ QDateTime QDateTime::fromString(const QString& s, Qt::DateFormat f)
int year;
QStringList timeParts = parts.at(3).split(QLatin1Char(':'));
if ((timeParts.count() == 3) || (timeParts.count() == 2)) {
+ // Year is after time, e.g. "Sun Dec 1 13:02:00 1974"
year = parts.at(4).toInt(&ok);
if (!ok)
return QDateTime();
- } else {
+ } else { // Year is before time, e.g. "Sun Dec 1 1974 13:02:00"
timeParts = parts.at(4).split(QLatin1Char(':'));
if ((timeParts.count() != 3) && (timeParts.count() != 2))
return QDateTime();
@@ -3743,7 +3746,8 @@ static bool hasUnquotedAP(const QString &f)
for (int i=0; i<max; ++i) {
if (f.at(i) == quote) {
inquote = !inquote;
- } else if (!inquote && f.at(i).toUpper() == QLatin1Char('A')) {
+ } else if (!inquote && f.at(i).toUpper() == QLatin1Char('A')
+ && i + 1 < max && f.at(i + 1).toUpper() == QLatin1Char('P')) {
return true;
}
}
diff --git a/src/corelib/tools/qdatetime.h b/src/corelib/tools/qdatetime.h
index ed7d8adb5f..22db5a4830 100644
--- a/src/corelib/tools/qdatetime.h
+++ b/src/corelib/tools/qdatetime.h
@@ -121,8 +121,8 @@ QT_DEPRECATED inline bool setYMD(int y, int m, int d)
private:
static inline qint64 nullJd() { return std::numeric_limits<qint64>::min(); }
- static inline qint64 minJd() { return std::numeric_limits<qint64>::min() / 2; }
- static inline qint64 maxJd() { return (std::numeric_limits<qint64>::max()) / 2; }
+ static inline qint64 minJd() { return Q_INT64_C(-784350574879); }
+ static inline qint64 maxJd() { return Q_INT64_C( 784354017364); }
qint64 jd;
diff --git a/src/corelib/tools/qmap.cpp b/src/corelib/tools/qmap.cpp
index dea87c6b63..7c33d60750 100644
--- a/src/corelib/tools/qmap.cpp
+++ b/src/corelib/tools/qmap.cpp
@@ -50,7 +50,7 @@
QT_BEGIN_NAMESPACE
-const QMapDataBase QMapDataBase::shared_null = { Q_REFCOUNT_INITIALIZE_STATIC, 0, { 0, 0, 0 } };
+const QMapDataBase QMapDataBase::shared_null = { Q_REFCOUNT_INITIALIZE_STATIC, 0, { 0, 0, 0 }, 0 };
const QMapNodeBase *QMapNodeBase::nextNode() const
{
@@ -177,6 +177,12 @@ void QMapDataBase::freeNodeAndRebalance(QMapNodeBase *z)
QMapNodeBase *x_parent;
if (y->left == 0) {
x = y->right;
+ if (y == mostLeftNode) {
+ if (x)
+ mostLeftNode = x; // It cannot have (left) children due the red black invariant.
+ else
+ mostLeftNode = y->parent();
+ }
} else {
if (y->right == 0) {
x = y->left;
@@ -290,6 +296,13 @@ void QMapDataBase::freeNodeAndRebalance(QMapNodeBase *z)
--size;
}
+void QMapDataBase::recalcMostLeftNode()
+{
+ mostLeftNode = &header;
+ while (mostLeftNode->left)
+ mostLeftNode = mostLeftNode->left;
+}
+
static inline int qMapAlignmentThreshold()
{
// malloc on 32-bit platforms should return pointers that are 8-byte
@@ -324,6 +337,8 @@ QMapNodeBase *QMapDataBase::createNode(int alloc, int alignment, QMapNodeBase *p
if (parent) {
if (left) {
parent->left = node;
+ if (parent == mostLeftNode)
+ mostLeftNode = node;
} else {
parent->right = node;
}
@@ -352,6 +367,7 @@ QMapDataBase *QMapDataBase::createData()
d->header.p = 0;
d->header.left = 0;
d->header.right = 0;
+ d->mostLeftNode = &(d->header);
return d;
}
diff --git a/src/corelib/tools/qmap.h b/src/corelib/tools/qmap.h
index 642cf82f08..d44a79473d 100644
--- a/src/corelib/tools/qmap.h
+++ b/src/corelib/tools/qmap.h
@@ -173,11 +173,13 @@ struct Q_CORE_EXPORT QMapDataBase
QtPrivate::RefCount ref;
int size;
QMapNodeBase header;
+ QMapNodeBase *mostLeftNode;
void rotateLeft(QMapNodeBase *x);
void rotateRight(QMapNodeBase *x);
void rebalance(QMapNodeBase *x);
void freeNodeAndRebalance(QMapNodeBase *z);
+ void recalcMostLeftNode();
QMapNodeBase *createNode(int size, int alignment, QMapNodeBase *parent, bool left);
void freeTree(QMapNodeBase *root, int alignment);
@@ -197,8 +199,8 @@ struct QMapData : public QMapDataBase
const Node *end() const { return static_cast<const Node *>(&header); }
Node *end() { return static_cast<Node *>(&header); }
- const Node *begin() const { if (root()) return root()->minimumNode(); return end(); }
- Node *begin() { if (root()) return root()->minimumNode(); return end(); }
+ const Node *begin() const { if (root()) return static_cast<const Node*>(mostLeftNode); return end(); }
+ Node *begin() { if (root()) return static_cast<Node*>(mostLeftNode); return end(); }
void deleteNode(Node *z);
Node *findNode(const Key &akey) const;
@@ -555,6 +557,7 @@ inline QMap<Key, T>::QMap(const QMap<Key, T> &other)
if (other.d->header.left) {
d->header.left = static_cast<Node *>(other.d->header.left)->copy(d);
d->header.left->setParent(&d->header);
+ d->recalcMostLeftNode();
}
}
}
@@ -780,6 +783,7 @@ Q_OUTOFLINE_TEMPLATE void QMap<Key, T>::detach_helper()
if (!d->ref.deref())
d->destroy();
d = x;
+ d->recalcMostLeftNode();
}
template <class Key, class T>
@@ -935,7 +939,7 @@ Q_OUTOFLINE_TEMPLATE QMap<Key, T>::QMap(const std::map<Key, T> &other)
typename std::map<Key,T>::const_iterator it = other.end();
while (it != other.begin()) {
--it;
- insert((*it).first, (*it).second);
+ d->createNode((*it).first, (*it).second, d->begin(), true); // insert on most left node.
}
}
@@ -946,7 +950,7 @@ Q_OUTOFLINE_TEMPLATE std::map<Key, T> QMap<Key, T>::toStdMap() const
const_iterator it = end();
while (it != begin()) {
--it;
- map.insert(std::pair<Key, T>(it.key(), it.value()));
+ map.insert(map.begin(), std::pair<Key, T>(it.key(), it.value()));
}
return map;
}
diff --git a/src/corelib/tools/qregexp.cpp b/src/corelib/tools/qregexp.cpp
index e87e5efc1f..7aea083788 100644
--- a/src/corelib/tools/qregexp.cpp
+++ b/src/corelib/tools/qregexp.cpp
@@ -1324,14 +1324,11 @@ Q_CORE_EXPORT QString qt_regexp_toCanonical(const QString &pattern, QRegExp::Pat
#ifndef QT_NO_REGEXP_WILDCARD
case QRegExp::Wildcard:
return wc2rx(pattern, false);
- break;
case QRegExp::WildcardUnix:
return wc2rx(pattern, true);
- break;
#endif
case QRegExp::FixedString:
return QRegExp::escape(pattern);
- break;
case QRegExp::W3CXmlSchema11:
default:
return pattern;
diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h
index 94733f77da..2c688db507 100644
--- a/src/corelib/tools/qvector.h
+++ b/src/corelib/tools/qvector.h
@@ -252,7 +252,7 @@ void QVector<T>::defaultConstruct(T *from, T *to)
new (from++) T();
}
} else {
- ::memset(from, 0, (to - from) * sizeof(T));
+ ::memset(static_cast<void *>(from), 0, (to - from) * sizeof(T));
}
}
@@ -267,7 +267,7 @@ void QVector<T>::copyConstruct(const T *srcFrom, const T *srcTo, T *dstFrom)
while (srcFrom != srcTo)
new (dstFrom++) T(*srcFrom++);
} else {
- ::memcpy(dstFrom, srcFrom, (srcTo - srcFrom) * sizeof(T));
+ ::memcpy(static_cast<void *>(dstFrom), static_cast<const void *>(srcFrom), (srcTo - srcFrom) * sizeof(T));
}
}
@@ -467,7 +467,7 @@ void QVector<T>::reallocData(const int asize, const int aalloc, QArrayData::Allo
new (dst++) T(*srcBegin++);
}
} else {
- ::memcpy(static_cast<void *>(dst), srcBegin, (srcEnd - srcBegin) * sizeof(T));
+ ::memcpy(static_cast<void *>(dst), static_cast<void *>(srcBegin), (srcEnd - srcBegin) * sizeof(T));
dst += srcEnd - srcBegin;
// destruct unused / not moved data
diff --git a/src/dbus/qdbusdemarshaller.cpp b/src/dbus/qdbusdemarshaller.cpp
index c25e7a33ec..31e3fe2bdb 100644
--- a/src/dbus/qdbusdemarshaller.cpp
+++ b/src/dbus/qdbusdemarshaller.cpp
@@ -300,7 +300,6 @@ QVariant QDBusDemarshaller::toVariantInternal()
// I hope you never dereference this pointer!
return QVariant::fromValue<void *>(ptr);
- break;
};
}
diff --git a/src/gui/accessible/qaccessible.cpp b/src/gui/accessible/qaccessible.cpp
index feaf468c54..61f1773d70 100644
--- a/src/gui/accessible/qaccessible.cpp
+++ b/src/gui/accessible/qaccessible.cpp
@@ -41,8 +41,6 @@
#include "qaccessible.h"
-#ifndef QT_NO_ACCESSIBILITY
-
#include "qaccessibleplugin.h"
#include "qaccessibleobject.h"
#include "qaccessiblebridge.h"
@@ -1265,4 +1263,3 @@ QDebug operator<<(QDebug d, const QAccessibleEvent &ev)
QT_END_NAMESPACE
-#endif
diff --git a/src/gui/accessible/qaccessible.h b/src/gui/accessible/qaccessible.h
index 08c0952a5a..1fb6c65482 100644
--- a/src/gui/accessible/qaccessible.h
+++ b/src/gui/accessible/qaccessible.h
@@ -58,8 +58,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-#ifndef QT_NO_ACCESSIBILITY
-
class QAccessibleInterface;
class QAccessibleEvent;
class QWindow;
@@ -678,8 +676,6 @@ inline void QAccessible::updateAccessibility(QObject *object, int child, Event r
}
#endif
-#endif // QT_NO_ACCESSIBILITY
-
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index 25999b7d06..9da360bc26 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -4915,43 +4915,33 @@ int QImage::metric(PaintDeviceMetric metric) const
switch (metric) {
case PdmWidth:
return d->width;
- break;
case PdmHeight:
return d->height;
- break;
case PdmWidthMM:
return qRound(d->width * 1000 / d->dpmx);
- break;
case PdmHeightMM:
return qRound(d->height * 1000 / d->dpmy);
- break;
case PdmNumColors:
return d->colortable.size();
- break;
case PdmDepth:
return d->depth;
- break;
case PdmDpiX:
return qRound(d->dpmx * 0.0254);
- break;
case PdmDpiY:
return qRound(d->dpmy * 0.0254);
- break;
case PdmPhysicalDpiX:
return qRound(d->dpmx * 0.0254);
- break;
case PdmPhysicalDpiY:
return qRound(d->dpmy * 0.0254);
- break;
default:
qWarning("QImage::metric(): Unhandled metric type %d", metric);
diff --git a/src/gui/image/qpnghandler.cpp b/src/gui/image/qpnghandler.cpp
index 2307ceb7ae..8434282178 100644
--- a/src/gui/image/qpnghandler.cpp
+++ b/src/gui/image/qpnghandler.cpp
@@ -849,13 +849,6 @@ bool Q_INTERNAL_WIN_NO_THROW QPNGImageWriter::writeImage(const QImage& image, vo
png_set_gAMA(png_ptr, info_ptr, 1.0/gamma);
}
- png_color_8 sig_bit;
- sig_bit.red = 8;
- sig_bit.green = 8;
- sig_bit.blue = 8;
- sig_bit.alpha = image.hasAlphaChannel() ? 8 : 0;
- png_set_sBIT(png_ptr, info_ptr, &sig_bit);
-
if (image.format() == QImage::Format_MonoLSB)
png_set_packswap(png_ptr);
diff --git a/src/gui/itemmodels/qstandarditemmodel.cpp b/src/gui/itemmodels/qstandarditemmodel.cpp
index 6e919eb0b2..fdd00fe980 100644
--- a/src/gui/itemmodels/qstandarditemmodel.cpp
+++ b/src/gui/itemmodels/qstandarditemmodel.cpp
@@ -2935,7 +2935,7 @@ QMimeData *QStandardItemModel::mimeData(const QModelIndexList &indexes) const
return data;
QByteArray encoded;
QDataStream stream(&encoded, QIODevice::WriteOnly);
-
+
QSet<QStandardItem*> itemsSet;
QStack<QStandardItem*> stack;
itemsSet.reserve(indexes.count());
@@ -2945,7 +2945,7 @@ QMimeData *QStandardItemModel::mimeData(const QModelIndexList &indexes) const
itemsSet << item;
stack.push(item);
}
-
+
//remove duplicates childrens
{
QSet<QStandardItem *> seen;
@@ -2954,7 +2954,7 @@ QMimeData *QStandardItemModel::mimeData(const QModelIndexList &indexes) const
if (seen.contains(itm))
continue;
seen.insert(itm);
-
+
const QVector<QStandardItem*> &childList = itm->d_func()->children;
for (int i = 0; i < childList.count(); ++i) {
QStandardItem *chi = childList.at(i);
@@ -2968,17 +2968,17 @@ QMimeData *QStandardItemModel::mimeData(const QModelIndexList &indexes) const
}
}
}
-
+
stack.reserve(itemsSet.count());
foreach (QStandardItem *item, itemsSet) {
stack.push(item);
}
-
+
//stream everything recursively
while (!stack.isEmpty()) {
QStandardItem *item = stack.pop();
if(itemsSet.contains(item)) { //if the item is selection 'top-level', strem its position
- stream << item->row() << item->column();
+ stream << item->row() << item->column();
}
if(item) {
stream << *item << item->columnCount() << item->d_ptr->children.count();
@@ -2996,7 +2996,7 @@ QMimeData *QStandardItemModel::mimeData(const QModelIndexList &indexes) const
/* \internal
Used by QStandardItemModel::dropMimeData
- stream out an item and his children
+ stream out an item and his children
*/
void QStandardItemModelPrivate::decodeDataRecursive(QDataStream &stream, QStandardItem *item)
{
@@ -3004,9 +3004,9 @@ void QStandardItemModelPrivate::decodeDataRecursive(QDataStream &stream, QStanda
stream >> *item;
stream >> colCount >> childCount;
item->setColumnCount(colCount);
-
+
int childPos = childCount;
-
+
while(childPos > 0) {
childPos--;
QStandardItem *child = createItem();
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index 64d2f8001f..efb34ffe9f 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -105,6 +105,7 @@ QPointF QGuiApplicationPrivate::lastCursorPosition(0.0, 0.0);
bool QGuiApplicationPrivate::tabletState = false;
QWindow *QGuiApplicationPrivate::tabletPressTarget = 0;
+QWindow *QGuiApplicationPrivate::currentMouseWindow = 0;
QPlatformIntegration *QGuiApplicationPrivate::platform_integration = 0;
QPlatformTheme *QGuiApplicationPrivate::platform_theme = 0;
@@ -455,7 +456,19 @@ void QGuiApplicationPrivate::showModalWindow(QWindow *modal)
{
self->modalWindowList.prepend(modal);
- QEvent e(QEvent::WindowBlocked);
+ // Send leave for currently entered window if it should be blocked
+ if (currentMouseWindow && (currentMouseWindow->windowType() & Qt::Popup) != Qt::Popup) {
+ bool shouldBeBlocked = self->isWindowBlocked(currentMouseWindow);
+ if (shouldBeBlocked) {
+ // Remove the new window from modalWindowList temporarily so leave can go through
+ self->modalWindowList.removeFirst();
+ QEvent e(QEvent::Leave);
+ QGuiApplication::sendEvent(currentMouseWindow, &e);
+ currentMouseWindow = 0;
+ self->modalWindowList.prepend(modal);
+ }
+ }
+
QWindowList windows = QGuiApplication::topLevelWindows();
for (int i = 0; i < windows.count(); ++i) {
QWindow *window = windows.at(i);
@@ -470,7 +483,6 @@ void QGuiApplicationPrivate::hideModalWindow(QWindow *window)
{
self->modalWindowList.removeAll(window);
- QEvent e(QEvent::WindowUnblocked);
QWindowList windows = QGuiApplication::topLevelWindows();
for (int i = 0; i < windows.count(); ++i) {
QWindow *window = windows.at(i);
@@ -1410,6 +1422,8 @@ void QGuiApplicationPrivate::processEnterEvent(QWindowSystemInterfacePrivate::En
return;
}
+ currentMouseWindow = e->enter;
+
QEvent event(QEvent::Enter);
QCoreApplication::sendSpontaneousEvent(e->enter.data(), &event);
}
@@ -1423,6 +1437,8 @@ void QGuiApplicationPrivate::processLeaveEvent(QWindowSystemInterfacePrivate::Le
return;
}
+ currentMouseWindow = 0;
+
QEvent event(QEvent::Leave);
QCoreApplication::sendSpontaneousEvent(e->leave.data(), &event);
}
diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h
index 44a9275688..c9eb672220 100644
--- a/src/gui/kernel/qguiapplication_p.h
+++ b/src/gui/kernel/qguiapplication_p.h
@@ -189,6 +189,7 @@ public:
static QPointF lastCursorPosition;
static bool tabletState;
static QWindow *tabletPressTarget;
+ static QWindow *currentMouseWindow;
#ifndef QT_NO_CLIPBOARD
static QClipboard *qt_clipboard;
diff --git a/src/gui/kernel/qplatformintegration.cpp b/src/gui/kernel/qplatformintegration.cpp
index cf55c59bab..5259ed9164 100644
--- a/src/gui/kernel/qplatformintegration.cpp
+++ b/src/gui/kernel/qplatformintegration.cpp
@@ -195,6 +195,10 @@ QPlatformServices *QPlatformIntegration::services() const
\value BufferQueueingOpenGL The OpenGL implementation on the platform will queue
up buffers when swapBuffers() is called and block only when its buffer pipeline
is full, rather than block immediately.
+
+ \value MultipleWindows The platform supports multiple QWindows, i.e. does some kind
+ of compositing either client or server side. Some platforms might only support a
+ single fullscreen window.
*/
diff --git a/src/gui/kernel/qplatformintegration.h b/src/gui/kernel/qplatformintegration.h
index 7e8888407c..b4c8ebff5a 100644
--- a/src/gui/kernel/qplatformintegration.h
+++ b/src/gui/kernel/qplatformintegration.h
@@ -83,11 +83,12 @@ class Q_GUI_EXPORT QPlatformIntegration
public:
enum Capability {
ThreadedPixmaps = 1,
- OpenGL = 2,
- ThreadedOpenGL = 3,
- SharedGraphicsCache = 4,
- BufferQueueingOpenGL = 5,
- WindowMasks = 6
+ OpenGL,
+ ThreadedOpenGL,
+ SharedGraphicsCache,
+ BufferQueueingOpenGL,
+ WindowMasks,
+ MultipleWindows
};
virtual ~QPlatformIntegration() { }
diff --git a/src/gui/kernel/qplatformmenu.h b/src/gui/kernel/qplatformmenu.h
index 64f738b331..7e7ccdb294 100644
--- a/src/gui/kernel/qplatformmenu.h
+++ b/src/gui/kernel/qplatformmenu.h
@@ -102,6 +102,7 @@ public:
virtual void setText(const QString &text) = 0;
virtual void setEnabled(bool enabled) = 0;
+ virtual void setVisible(bool visible) = 0;
virtual QPlatformMenuItem *menuItemAt(int position) const = 0;
virtual QPlatformMenuItem *menuItemForTag(quintptr tag) const = 0;
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index 4f1610cb21..d845be3d01 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -214,6 +214,8 @@ QWindow::~QWindow()
{
if (QGuiApplicationPrivate::focus_window == this)
QGuiApplicationPrivate::focus_window = 0;
+ if (QGuiApplicationPrivate::currentMouseWindow == this)
+ QGuiApplicationPrivate::currentMouseWindow = 0;
QGuiApplicationPrivate::window_list.removeAll(this);
destroy();
}
@@ -939,9 +941,24 @@ void QWindow::setMinimumSize(const QSize &size)
QSize adjustedSize = QSize(qBound(0, size.width(), QWINDOWSIZE_MAX), qBound(0, size.height(), QWINDOWSIZE_MAX));
if (d->minimumSize == adjustedSize)
return;
+ QSize oldSize = d->minimumSize;
d->minimumSize = adjustedSize;
if (d->platformWindow && isTopLevel())
d->platformWindow->propagateSizeHints();
+ if (d->minimumSize.width() != oldSize.width())
+ emit minimumWidthChanged(d->minimumSize.width());
+ if (d->minimumSize.height() != oldSize.height())
+ emit minimumHeightChanged(d->minimumSize.height());
+}
+
+void QWindow::setMinimumWidth(int w)
+{
+ setMinimumSize(QSize(w, minimumHeight()));
+}
+
+void QWindow::setMinimumHeight(int h)
+{
+ setMinimumSize(QSize(minimumWidth(), h));
}
/*!
@@ -957,9 +974,24 @@ void QWindow::setMaximumSize(const QSize &size)
QSize adjustedSize = QSize(qBound(0, size.width(), QWINDOWSIZE_MAX), qBound(0, size.height(), QWINDOWSIZE_MAX));
if (d->maximumSize == adjustedSize)
return;
+ QSize oldSize = d->maximumSize;
d->maximumSize = adjustedSize;
if (d->platformWindow && isTopLevel())
d->platformWindow->propagateSizeHints();
+ if (d->maximumSize.width() != oldSize.width())
+ emit maximumWidthChanged(d->maximumSize.width());
+ if (d->maximumSize.height() != oldSize.height())
+ emit maximumHeightChanged(d->maximumSize.height());
+}
+
+void QWindow::setMaximumWidth(int w)
+{
+ setMaximumSize(QSize(w, maximumHeight()));
+}
+
+void QWindow::setMaximumHeight(int h)
+{
+ setMaximumSize(QSize(maximumWidth(), h));
}
/*!
@@ -1058,6 +1090,26 @@ void QWindow::setGeometry(const QRect &rect)
*/
/*!
+ \property QWindow::minimumWidth
+ \brief the minimum width of the window's geometry
+*/
+
+/*!
+ \property QWindow::minimumHeight
+ \brief the minimum height of the window's geometry
+*/
+
+/*!
+ \property QWindow::maximumWidth
+ \brief the maximum width of the window's geometry
+*/
+
+/*!
+ \property QWindow::maximumHeight
+ \brief the maximum height of the window's geometry
+*/
+
+/*!
Returns the geometry of the window, excluding its window frame.
\sa frameMargins(), frameGeometry()
@@ -1445,6 +1497,8 @@ bool QWindow::close()
if (QGuiApplicationPrivate::focus_window == this)
QGuiApplicationPrivate::focus_window = 0;
+ if (QGuiApplicationPrivate::currentMouseWindow == this)
+ QGuiApplicationPrivate::currentMouseWindow = 0;
QGuiApplicationPrivate::window_list.removeAll(this);
destroy();
diff --git a/src/gui/kernel/qwindow.h b/src/gui/kernel/qwindow.h
index 62268cd88a..4832adfb63 100644
--- a/src/gui/kernel/qwindow.h
+++ b/src/gui/kernel/qwindow.h
@@ -104,6 +104,10 @@ class Q_GUI_EXPORT QWindow : public QObject, public QSurface
Q_PROPERTY(QPoint pos READ pos WRITE setPos)
Q_PROPERTY(QSize size READ size WRITE resize)
Q_PROPERTY(QRect geometry READ geometry WRITE setGeometry)
+ Q_PROPERTY(int minimumWidth READ minimumWidth WRITE setMinimumWidth NOTIFY minimumWidthChanged)
+ Q_PROPERTY(int minimumHeight READ minimumHeight WRITE setMinimumHeight NOTIFY minimumHeightChanged)
+ Q_PROPERTY(int maximumWidth READ maximumWidth WRITE setMaximumWidth NOTIFY maximumWidthChanged)
+ Q_PROPERTY(int maximumHeight READ maximumHeight WRITE setMaximumHeight NOTIFY maximumHeightChanged)
Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged)
Q_PROPERTY(Qt::ScreenOrientation contentOrientation READ contentOrientation WRITE reportContentOrientationChange NOTIFY contentOrientationChanged)
#ifndef QT_NO_CURSOR
@@ -170,6 +174,11 @@ public:
bool isExposed() const;
+ int minimumWidth() const { return minimumSize().width(); }
+ int minimumHeight() const { return minimumSize().height(); }
+ int maximumWidth() const { return maximumSize().width(); }
+ int maximumHeight() const { return maximumSize().height(); }
+
QSize minimumSize() const;
QSize maximumSize() const;
QSize baseSize() const;
@@ -273,6 +282,11 @@ public Q_SLOTS:
setGeometry(QRect(x(), y(), width(), arg));
}
+ void setMinimumWidth(int w);
+ void setMinimumHeight(int h);
+ void setMaximumWidth(int w);
+ void setMaximumHeight(int h);
+
Q_SIGNALS:
void screenChanged(QScreen *screen);
void windowModalityChanged(Qt::WindowModality windowModality);
@@ -283,6 +297,11 @@ Q_SIGNALS:
void widthChanged(int arg);
void heightChanged(int arg);
+ void minimumWidthChanged(int arg);
+ void minimumHeightChanged(int arg);
+ void maximumWidthChanged(int arg);
+ void maximumHeightChanged(int arg);
+
void visibleChanged(bool arg);
void contentOrientationChanged(Qt::ScreenOrientation orientation);
diff --git a/src/gui/kernel/qwindow_p.h b/src/gui/kernel/qwindow_p.h
index 159f05d1a5..bce6a4ff04 100644
--- a/src/gui/kernel/qwindow_p.h
+++ b/src/gui/kernel/qwindow_p.h
@@ -80,6 +80,7 @@ public:
, positionPolicy(WindowFrameExclusive)
, contentOrientation(Qt::PrimaryOrientation)
, windowOrientation(Qt::PrimaryOrientation)
+ , minimumSize(0, 0)
, maximumSize(QWINDOWSIZE_MAX, QWINDOWSIZE_MAX)
, modality(Qt::NonModal)
, blockedByModalWindow(false)
diff --git a/src/gui/opengl/qopenglframebufferobject.cpp b/src/gui/opengl/qopenglframebufferobject.cpp
index ef8e420c27..380ada37e0 100644
--- a/src/gui/opengl/qopenglframebufferobject.cpp
+++ b/src/gui/opengl/qopenglframebufferobject.cpp
@@ -349,7 +349,6 @@ bool QOpenGLFramebufferObjectPrivate::checkFramebufferStatus(QOpenGLContext *ctx
case GL_NO_ERROR:
case GL_FRAMEBUFFER_COMPLETE:
return true;
- break;
case GL_FRAMEBUFFER_UNSUPPORTED:
qDebug("QOpenGLFramebufferObject: Unsupported framebuffer format.");
break;
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index 7070e5732d..0cfe953e43 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -7498,8 +7498,11 @@ start_lengthVariant:
l.setLineWidth(lineWidth);
height += leading;
+
+ // Make sure lines are positioned on whole pixels
+ height = qCeil(height);
l.setPosition(QPointF(0., height));
- height += l.height();
+ height += textLayout.engine()->lines[l.lineNumber()].height().toReal();
width = qMax(width, l.naturalTextWidth());
if (!dontclip && !brect && height >= r.height())
break;
diff --git a/src/gui/painting/qpathclipper.cpp b/src/gui/painting/qpathclipper.cpp
index 8cf57a8987..4b53257832 100644
--- a/src/gui/painting/qpathclipper.cpp
+++ b/src/gui/painting/qpathclipper.cpp
@@ -1630,7 +1630,6 @@ QPainterPath QPathClipper::clip(Operation operation)
result.addRect(subjectBounds);
return result;
}
- break;
case BoolAnd:
return clipPath;
case BoolOr:
diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp
index bdcf166243..fa4e7a75bc 100644
--- a/src/gui/text/qfontengine.cpp
+++ b/src/gui/text/qfontengine.cpp
@@ -1370,7 +1370,9 @@ bool QFontEngineMulti::stringToCMap(const QChar *str, int len,
bool surrogate = (str[i].isHighSurrogate() && i < len-1 && str[i+1].isLowSurrogate());
uint ucs4 = surrogate ? QChar::surrogateToUcs4(str[i], str[i+1]) : str[i].unicode();
if (glyphs->glyphs[glyph_pos] == 0 && str[i].category() != QChar::Separator_Line) {
- QGlyphLayoutInstance tmp = glyphs->instance(glyph_pos);
+ QGlyphLayoutInstance tmp;
+ if (!(flags & GlyphIndicesOnly))
+ tmp = glyphs->instance(glyph_pos);
for (int x=1; x < engines.size(); ++x) {
if (engines.at(x) == 0 && !shouldLoadFontEngineForCharacter(x, ucs4))
continue;
@@ -1400,9 +1402,8 @@ bool QFontEngineMulti::stringToCMap(const QChar *str, int len,
}
// ensure we use metrics from the 1st font when we use the fallback image.
- if (!glyphs->glyphs[glyph_pos]) {
+ if (!(flags & GlyphIndicesOnly) && !glyphs->glyphs[glyph_pos])
glyphs->setInstance(glyph_pos, tmp);
- }
}
if (surrogate)
diff --git a/src/gui/text/qsyntaxhighlighter.cpp b/src/gui/text/qsyntaxhighlighter.cpp
index 7baf55caea..f183e1eb20 100644
--- a/src/gui/text/qsyntaxhighlighter.cpp
+++ b/src/gui/text/qsyntaxhighlighter.cpp
@@ -119,18 +119,14 @@ void QSyntaxHighlighterPrivate::applyFormatChanges()
formatsChanged = true;
}
- QTextCharFormat emptyFormat;
-
- QTextLayout::FormatRange r;
- r.start = -1;
-
int i = 0;
while (i < formatChanges.count()) {
+ QTextLayout::FormatRange r;
- while (i < formatChanges.count() && formatChanges.at(i) == emptyFormat)
+ while (i < formatChanges.count() && formatChanges.at(i) == r.format)
++i;
- if (i >= formatChanges.count())
+ if (i == formatChanges.count())
break;
r.start = i;
@@ -139,9 +135,7 @@ void QSyntaxHighlighterPrivate::applyFormatChanges()
while (i < formatChanges.count() && formatChanges.at(i) == r.format)
++i;
- if (i >= formatChanges.count())
- break;
-
+ Q_ASSERT(i <= formatChanges.count());
r.length = i - r.start;
if (preeditAreaLength != 0) {
@@ -153,21 +147,6 @@ void QSyntaxHighlighterPrivate::applyFormatChanges()
ranges << r;
formatsChanged = true;
- r.start = -1;
- }
-
- if (r.start != -1) {
- r.length = formatChanges.count() - r.start;
-
- if (preeditAreaLength != 0) {
- if (r.start >= preeditAreaStart)
- r.start += preeditAreaLength;
- else if (r.start + r.length >= preeditAreaStart)
- r.length += preeditAreaLength;
- }
-
- ranges << r;
- formatsChanged = true;
}
if (formatsChanged) {
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp
index a0a92897c5..0ca8e8d9a6 100644
--- a/src/gui/text/qtextlayout.cpp
+++ b/src/gui/text/qtextlayout.cpp
@@ -916,7 +916,7 @@ QRectF QTextLayout::boundingRect() const
QFixed lineWidth = si.width < QFIXED_MAX ? qMax(si.width, si.textWidth) : si.textWidth;
xmax = qMax(xmax, si.x+lineWidth);
// ### shouldn't the ascent be used in ymin???
- ymax = qMax(ymax, si.y+si.height());
+ ymax = qMax(ymax, si.y+si.height().ceil());
}
return QRectF(xmin.toReal(), ymin.toReal(), (xmax-xmin).toReal(), (ymax-ymin).toReal());
}
@@ -1466,7 +1466,7 @@ qreal QTextLine::descent() const
*/
qreal QTextLine::height() const
{
- return eng->lines[index].height().toReal();
+ return eng->lines[index].height().ceil().toReal();
}
/*!
diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp
index 51076c6c22..34496cb380 100644
--- a/src/network/access/qhttpnetworkconnectionchannel.cpp
+++ b/src/network/access/qhttpnetworkconnectionchannel.cpp
@@ -296,7 +296,6 @@ bool QHttpNetworkConnectionChannel::sendRequest()
// premature eof happened
connection->d_func()->emitReplyError(socket, reply, QNetworkReply::UnknownNetworkError);
return false;
- break;
} else if (readPointer == 0 || currentReadSize == 0) {
// nothing to read currently, break the loop
break;
diff --git a/src/network/access/qhttpnetworkrequest.cpp b/src/network/access/qhttpnetworkrequest.cpp
index e9a66287f9..ef65efddca 100644
--- a/src/network/access/qhttpnetworkrequest.cpp
+++ b/src/network/access/qhttpnetworkrequest.cpp
@@ -83,31 +83,22 @@ QByteArray QHttpNetworkRequestPrivate::methodName() const
switch (operation) {
case QHttpNetworkRequest::Get:
return "GET";
- break;
case QHttpNetworkRequest::Head:
return "HEAD";
- break;
case QHttpNetworkRequest::Post:
return "POST";
- break;
case QHttpNetworkRequest::Options:
return "OPTIONS";
- break;
case QHttpNetworkRequest::Put:
return "PUT";
- break;
case QHttpNetworkRequest::Delete:
return "DELETE";
- break;
case QHttpNetworkRequest::Trace:
return "TRACE";
- break;
case QHttpNetworkRequest::Connect:
return "CONNECT";
- break;
case QHttpNetworkRequest::Custom:
return customVerb;
- break;
default:
break;
}
diff --git a/src/network/access/qnetworkrequest.cpp b/src/network/access/qnetworkrequest.cpp
index 6d036ad491..b7d8dbbb20 100644
--- a/src/network/access/qnetworkrequest.cpp
+++ b/src/network/access/qnetworkrequest.cpp
@@ -979,53 +979,41 @@ static int name_to_month(const char* month_str)
switch (month_str[1]) {
case 'a':
return 1;
- break;
case 'u':
switch (month_str[2] ) {
case 'n':
return 6;
- break;
case 'l':
return 7;
- break;
}
}
break;
case 'F':
return 2;
- break;
case 'M':
switch (month_str[2] ) {
case 'r':
return 3;
- break;
case 'y':
return 5;
- break;
}
break;
case 'A':
switch (month_str[1]) {
case 'p':
return 4;
- break;
case 'u':
return 8;
- break;
}
break;
case 'O':
return 10;
- break;
case 'S':
return 9;
- break;
case 'N':
return 11;
- break;
case 'D':
return 12;
- break;
}
return 0;
diff --git a/src/network/kernel/qnetworkproxy.cpp b/src/network/kernel/qnetworkproxy.cpp
index adaefac440..aa16be2b4a 100644
--- a/src/network/kernel/qnetworkproxy.cpp
+++ b/src/network/kernel/qnetworkproxy.cpp
@@ -253,6 +253,9 @@ public:
, httpSocketEngineHandler(0)
#endif
{
+#ifdef QT_USE_SYSTEM_PROXIES
+ setApplicationProxyFactory(new QSystemConfigurationProxyFactory);
+#endif
#ifndef QT_NO_SOCKS5
socks5SocketEngineHandler = new QSocks5SocketEngineHandler();
#endif
@@ -1557,10 +1560,9 @@ void QNetworkProxyFactory::setApplicationProxyFactory(QNetworkProxyFactory *fact
\li On Windows platforms, this function may take several seconds to
execute depending on the configuration of the user's system.
- \li On BlackBerry, this function ignores network configuration specified
- in \a query. Only UrlRequest quieries are supported. SOCKS is not supported.
- The proxy information is retrieved only for the default configuration.
- Also, PAC and exclusion lists are currently not supported.
+ \li On BlackBerry, only UrlRequest queries are supported. SOCKS is
+ not supported. The proxy credentials are only retrieved for the
+ default configuration.
\endlist
*/
diff --git a/src/network/kernel/qnetworkproxy_blackberry.cpp b/src/network/kernel/qnetworkproxy_blackberry.cpp
index c257f085ff..2743b90404 100644
--- a/src/network/kernel/qnetworkproxy_blackberry.cpp
+++ b/src/network/kernel/qnetworkproxy_blackberry.cpp
@@ -79,11 +79,34 @@ QList<QNetworkProxy> QNetworkProxyFactory::systemProxyForQuery(const QNetworkPro
netstatus_proxy_details_t details;
memset(&details, 0, sizeof(netstatus_proxy_details_t));
+
+#if BPS_VERSION >= 3001001
+
+ QByteArray bUrl(url.toEncoded());
+ QString sInterface(query.networkConfiguration().name());
+ QByteArray bInterface;
+ if (!sInterface.isEmpty()) {
+ if (query.networkConfiguration().type() != QNetworkConfiguration::InternetAccessPoint) {
+ qWarning("Unsupported configuration type: %d", query.networkConfiguration().type());
+ return QList<QNetworkProxy>() << QNetworkProxy(QNetworkProxy::NoProxy);
+ }
+ bInterface = sInterface.toUtf8();
+ }
+
+ if (netstatus_get_proxy_details_for_url(bUrl.constData(), (bInterface.isEmpty() ? NULL : bInterface.constData()), &details) != BPS_SUCCESS) {
+ qWarning("netstatus_get_proxy_details_for_url failed! errno: %d", errno);
+ return QList<QNetworkProxy>() << QNetworkProxy(QNetworkProxy::NoProxy);
+ }
+
+#else
+
if (netstatus_get_proxy_details(&details) != BPS_SUCCESS) {
qWarning("netstatus_get_proxy_details failed! errno: %d", errno);
return QList<QNetworkProxy>() << QNetworkProxy(QNetworkProxy::NoProxy);
}
+#endif
+
if (details.http_proxy_host == NULL) { // No proxy
netstatus_free_proxy_details(&details);
return QList<QNetworkProxy>() << QNetworkProxy(QNetworkProxy::NoProxy);
diff --git a/src/network/socket/socket.pri b/src/network/socket/socket.pri
index 3429275a67..0204a92999 100644
--- a/src/network/socket/socket.pri
+++ b/src/network/socket/socket.pri
@@ -60,3 +60,7 @@ integrity: {
DEFINES += QT_LOCALSOCKET_TCP
}
+
+contains(QT_CONFIG, system-proxies) {
+ DEFINES += QT_USE_SYSTEM_PROXIES
+}
diff --git a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp
index 469ac59dcf..ec2f1b02af 100644
--- a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp
+++ b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp
@@ -339,8 +339,8 @@ void QGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph, QFixed sub
if (!ctx->d_ptr->workaround_brokenAlphaTexSubImage_init) {
// don't know which driver versions exhibit this bug, so be conservative for now
- const QByteArray versionString(reinterpret_cast<const char*>(glGetString(GL_VERSION)));
- ctx->d_ptr->workaround_brokenAlphaTexSubImage = versionString.indexOf("NVIDIA") >= 0;
+ const QByteArray vendorString(reinterpret_cast<const char*>(glGetString(GL_VENDOR)));
+ ctx->d_ptr->workaround_brokenAlphaTexSubImage = vendorString.indexOf("NVIDIA") >= 0;
ctx->d_ptr->workaround_brokenAlphaTexSubImage_init = true;
}
diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp
index 413c7f5410..a5c2d1c8b2 100644
--- a/src/opengl/qglframebufferobject.cpp
+++ b/src/opengl/qglframebufferobject.cpp
@@ -393,7 +393,6 @@ bool QGLFramebufferObjectPrivate::checkFramebufferStatus() const
case GL_NO_ERROR:
case GL_FRAMEBUFFER_COMPLETE:
return true;
- break;
case GL_FRAMEBUFFER_UNSUPPORTED:
qDebug("QGLFramebufferObject: Unsupported framebuffer format.");
break;
diff --git a/src/platformsupport/dnd/qsimpledrag.cpp b/src/platformsupport/dnd/qsimpledrag.cpp
index d8ef17ede3..18e6b97e3c 100644
--- a/src/platformsupport/dnd/qsimpledrag.cpp
+++ b/src/platformsupport/dnd/qsimpledrag.cpp
@@ -253,8 +253,19 @@ void QBasicDrag::updateCursor(Qt::DropAction action)
}
QCursor *cursor = qApp->overrideCursor();
- if (cursor && cursorShape != cursor->shape()) {
- qApp->changeOverrideCursor(QCursor(cursorShape));
+ QPixmap pixmap = m_drag->dragCursor(action);
+ if (!cursor) {
+ qApp->changeOverrideCursor((pixmap.isNull()) ? QCursor(cursorShape) : QCursor(pixmap));
+ } else {
+ if (!pixmap.isNull()) {
+ if ((cursor->pixmap().cacheKey() != pixmap.cacheKey())) {
+ qApp->changeOverrideCursor(QCursor(pixmap));
+ }
+ } else {
+ if (cursorShape != cursor->shape()) {
+ qApp->changeOverrideCursor(QCursor(cursorShape));
+ }
+ }
}
updateAction(action);
}
diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
index 8306a47e4f..66ca2d37fa 100644
--- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
+++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
@@ -79,8 +79,8 @@ static const char *languageForWritingSystem[] = {
"my", // Myanmar
"ka", // Georgian
"km", // Khmer
- "zh-cn", // SimplifiedChinese
- "zh-tw", // TraditionalChinese
+ "zh-Hans", // SimplifiedChinese
+ "zh-Hant", // TraditionalChinese
"ja", // Japanese
"ko", // Korean
"vi", // Vietnamese
diff --git a/src/platformsupport/linuxaccessibility/atspiadaptor.cpp b/src/platformsupport/linuxaccessibility/atspiadaptor.cpp
index f69e2365d8..6926f546a2 100644
--- a/src/platformsupport/linuxaccessibility/atspiadaptor.cpp
+++ b/src/platformsupport/linuxaccessibility/atspiadaptor.cpp
@@ -1023,7 +1023,11 @@ void AtSpiAdaptor::notify(QAccessibleEvent *event)
case QAccessible::TextCaretMoved: {
if (sendObject || sendObject_text_caret_moved) {
QAIPointer iface = QAIPointer(event->accessibleInterface());
- Q_ASSERT(iface->textInterface());
+ if (!iface->textInterface()) {
+ qWarning() << "Sending TextCaretMoved from object that does not implement text interface: " << iface << iface->object();
+ return;
+ }
+
QString path = pathForInterface(iface);
QDBusVariant cursorData;
int pos = iface->textInterface()->cursorPosition();
@@ -1503,7 +1507,7 @@ QString AtSpiAdaptor::pathForObject(QObject *object) const
qAtspiDebug() << "AtSpiAdaptor::pathForObject: warning: creating path with QAction as object.";
}
quintptr uintptr = reinterpret_cast<quintptr>(object);
- if (!m_handledObjects.contains(uintptr))
+ if (!m_handledObjects.contains(uintptr) || m_handledObjects.value(uintptr) == 0)
m_handledObjects[uintptr] = QPointer<QObject>(object);
return QLatin1String(QSPI_OBJECT_PATH_PREFIX) + QString::number(uintptr);
}
diff --git a/src/plugins/accessible/qaccessiblebase.pri b/src/plugins/accessible/qaccessiblebase.pri
deleted file mode 100644
index 95c1fad13a..0000000000
--- a/src/plugins/accessible/qaccessiblebase.pri
+++ /dev/null
@@ -1,2 +0,0 @@
-target.path += $$[QT_INSTALL_PLUGINS]/accessible
-INSTALLS += target
diff --git a/src/plugins/accessible/widgets/itemviews.cpp b/src/plugins/accessible/widgets/itemviews.cpp
index 0aeff6e1a3..301838997f 100644
--- a/src/plugins/accessible/widgets/itemviews.cpp
+++ b/src/plugins/accessible/widgets/itemviews.cpp
@@ -79,8 +79,7 @@ int QAccessibleTable::logicalIndex(const QModelIndex &index) const
return -1;
int vHeader = verticalHeader() ? 1 : 0;
int hHeader = horizontalHeader() ? 1 : 0;
- // row * number columns + column + 1 for one based counting
- return (index.row() + hHeader)*(index.model()->columnCount() + vHeader) + (index.column() + vHeader) + 1;
+ return (index.row() + hHeader)*(index.model()->columnCount() + vHeader) + (index.column() + vHeader);
}
QAccessibleInterface *QAccessibleTable::childFromLogical(int logicalIndex) const
@@ -88,7 +87,6 @@ QAccessibleInterface *QAccessibleTable::childFromLogical(int logicalIndex) const
if (!view()->model())
return 0;
- logicalIndex--; // one based counting ftw
int vHeader = verticalHeader() ? 1 : 0;
int hHeader = horizontalHeader() ? 1 : 0;
@@ -376,16 +374,20 @@ int QAccessibleTable::indexOfChild(const QAccessibleInterface *iface) const
{
if (!view()->model())
return -1;
+ QSharedPointer<QAccessibleInterface> parent(iface->parent());
+ if (parent->object() != view())
+ return -1;
+
Q_ASSERT(iface->role() != QAccessible::TreeItem); // should be handled by tree class
if (iface->role() == QAccessible::Cell || iface->role() == QAccessible::ListItem) {
const QAccessibleTableCell* cell = static_cast<const QAccessibleTableCell*>(iface);
- return logicalIndex(cell->m_index) - 1;
+ return logicalIndex(cell->m_index);
} else if (iface->role() == QAccessible::ColumnHeader){
const QAccessibleTableHeaderCell* cell = static_cast<const QAccessibleTableHeaderCell*>(iface);
return cell->index + (verticalHeader() ? 1 : 0);
} else if (iface->role() == QAccessible::RowHeader){
const QAccessibleTableHeaderCell* cell = static_cast<const QAccessibleTableHeaderCell*>(iface);
- return (cell->index+1) * (view()->model()->rowCount()+1);
+ return (cell->index + 1) * (view()->model()->rowCount() + 1);
} else if (iface->role() == QAccessible::Pane) {
return 0; // corner button
} else {
@@ -424,8 +426,7 @@ QAccessibleInterface *QAccessibleTable::parent() const
QAccessibleInterface *QAccessibleTable::child(int index) const
{
- // Fixme: get rid of the +1 madness
- return childFromLogical(index + 1);
+ return childFromLogical(index);
}
void *QAccessibleTable::interface_cast(QAccessible::InterfaceType t)
@@ -470,9 +471,8 @@ QAccessibleInterface *QAccessibleTree::childAt(int x, int y) const
int row = treeView->d_func()->viewIndex(index) + (horizontalHeader() ? 1 : 0);
int column = index.column();
- int i = row * view()->model()->columnCount() + column + 1;
- Q_ASSERT(i > view()->model()->columnCount());
- return child(i - 1);
+ int i = row * view()->model()->columnCount() + column;
+ return child(i);
}
int QAccessibleTree::childCount() const
@@ -521,7 +521,11 @@ int QAccessibleTree::indexOfChild(const QAccessibleInterface *iface) const
{
if (!view()->model())
return -1;
- if (iface->role() == QAccessible::TreeItem) {
+ QSharedPointer<QAccessibleInterface> parent(iface->parent());
+ if (parent->object() != view())
+ return -1;
+
+ if (iface->role() == QAccessible::TreeItem) {
const QAccessibleTableCell* cell = static_cast<const QAccessibleTableCell*>(iface);
const QTreeView *treeView = qobject_cast<const QTreeView*>(view());
Q_ASSERT(treeView);
@@ -534,7 +538,7 @@ int QAccessibleTree::indexOfChild(const QAccessibleInterface *iface) const
return index;
} else if (iface->role() == QAccessible::ColumnHeader){
const QAccessibleTableHeaderCell* cell = static_cast<const QAccessibleTableHeaderCell*>(iface);
- //qDebug() << "QAccessibleTree::indexOfChild header " << cell->index << "is: " << cell->index + 1;
+ //qDebug() << "QAccessibleTree::indexOfChild header " << cell->index;
return cell->index;
} else {
qWarning() << "WARNING QAccessibleTable::indexOfChild invalid child"
@@ -846,7 +850,7 @@ void QAccessibleTableHeaderCell::setText(QAccessible::Text, const QString &)
bool QAccessibleTableHeaderCell::isValid() const
{
- return view && view->model() && (index > 0)
+ return view && view->model() && (index >= 0)
&& ((orientation == Qt::Horizontal) ? (index < view->model()->columnCount()) : (index < view->model()->rowCount()));
}
diff --git a/src/plugins/accessible/widgets/qaccessiblewidgets.cpp b/src/plugins/accessible/widgets/qaccessiblewidgets.cpp
index eac31b8068..9d0d3f0145 100644
--- a/src/plugins/accessible/widgets/qaccessiblewidgets.cpp
+++ b/src/plugins/accessible/widgets/qaccessiblewidgets.cpp
@@ -592,11 +592,6 @@ int QAccessibleDockWidget::indexOfChild(const QAccessibleInterface *child) const
return -1;
}
-QAccessible::Role QAccessibleDockWidget::role() const
-{
- return QAccessible::Window;
-}
-
QRect QAccessibleDockWidget::rect() const
{
QRect rect;
diff --git a/src/plugins/accessible/widgets/qaccessiblewidgets.h b/src/plugins/accessible/widgets/qaccessiblewidgets.h
index ec2583235f..b309d59c54 100644
--- a/src/plugins/accessible/widgets/qaccessiblewidgets.h
+++ b/src/plugins/accessible/widgets/qaccessiblewidgets.h
@@ -275,7 +275,6 @@ public:
int indexOfChild(const QAccessibleInterface *child) const;
int childCount() const;
QRect rect () const;
- QAccessible::Role role() const;
QDockWidget *dockWidget() const;
};
diff --git a/src/plugins/accessible/widgets/simplewidgets.cpp b/src/plugins/accessible/widgets/simplewidgets.cpp
index bb90061a7e..9bdb1decde 100644
--- a/src/plugins/accessible/widgets/simplewidgets.cpp
+++ b/src/plugins/accessible/widgets/simplewidgets.cpp
@@ -53,6 +53,7 @@
#include <qgroupbox.h>
#include <qlcdnumber.h>
#include <qlineedit.h>
+#include <private/qlineedit_p.h>
#include <qstyle.h>
#include <qstyleoption.h>
#include <qtextdocument.h>
@@ -672,10 +673,20 @@ int QAccessibleLineEdit::cursorPosition() const
return lineEdit()->cursorPosition();
}
-QRect QAccessibleLineEdit::characterRect(int /*offset*/) const
+QRect QAccessibleLineEdit::characterRect(int offset) const
{
- // QLineEdit doesn't hand out character rects
- return QRect();
+ int x = lineEdit()->d_func()->control->cursorToX(offset);
+ int y;
+ lineEdit()->getTextMargins(0, &y, 0, 0);
+ QFontMetrics fm(lineEdit()->font());
+ const QString ch = text(offset, offset + 1);
+ if (ch.isEmpty())
+ return QRect();
+ int w = fm.width(ch);
+ int h = fm.height();
+ QRect r(x, y, w, h);
+ r.moveTo(lineEdit()->mapToGlobal(r.topLeft()));
+ return r;
}
int QAccessibleLineEdit::selectionCount() const
diff --git a/src/plugins/accessible/widgets/widgets.pro b/src/plugins/accessible/widgets/widgets.pro
index 3bf7dede56..afabbac9bc 100644
--- a/src/plugins/accessible/widgets/widgets.pro
+++ b/src/plugins/accessible/widgets/widgets.pro
@@ -1,9 +1,9 @@
TARGET = qtaccessiblewidgets
+
+PLUGIN_TYPE = accessible
load(qt_plugin)
-include (../qaccessiblebase.pri)
QT += core-private gui-private widgets-private
-DESTDIR = $$QT.gui.plugins/accessible
QTDIR_build:REQUIRES += "contains(QT_CONFIG, accessibility)"
diff --git a/src/plugins/bearer/blackberry/blackberry.pro b/src/plugins/bearer/blackberry/blackberry.pro
index 5d4cf29554..220a506d90 100644
--- a/src/plugins/bearer/blackberry/blackberry.pro
+++ b/src/plugins/bearer/blackberry/blackberry.pro
@@ -1,4 +1,6 @@
TARGET = qbbbearer
+
+PLUGIN_TYPE = bearer
load(qt_plugin)
QT = core-private network-private
@@ -15,7 +17,3 @@ SOURCES += qbbengine.cpp \
main.cpp
OTHER_FILES += blackberry.json
-
-DESTDIR = $$QT.network.plugins/bearer
-target.path += $$[QT_INSTALL_PLUGINS]/bearer
-INSTALLS += target
diff --git a/src/plugins/bearer/blackberry/qbbengine.cpp b/src/plugins/bearer/blackberry/qbbengine.cpp
index 79452aeae5..d64a8fe20f 100644
--- a/src/plugins/bearer/blackberry/qbbengine.cpp
+++ b/src/plugins/bearer/blackberry/qbbengine.cpp
@@ -316,15 +316,14 @@ void QBBEngine::updateConfiguration(const char *interface)
const QString id = idForName(name);
- const int numberOfIpAddresses = netstatus_interface_get_num_ip_addresses(details);
- const bool isConnected = netstatus_interface_is_connected(details);
const netstatus_interface_type_t type = netstatus_interface_get_type(details);
+ const netstatus_ip_status_t ipStatus = netstatus_interface_get_ip_status(details);
netstatus_free_interface_details(&details);
QNetworkConfiguration::StateFlags state = QNetworkConfiguration::Defined;
- if (isConnected && (numberOfIpAddresses > 0))
+ if (ipStatus == NETSTATUS_IP_STATUS_OK)
state |= QNetworkConfiguration::Active;
QMutexLocker locker(&mutex);
diff --git a/src/plugins/bearer/connman/connman.pro b/src/plugins/bearer/connman/connman.pro
index 679637b37f..99d9b367f2 100644
--- a/src/plugins/bearer/connman/connman.pro
+++ b/src/plugins/bearer/connman/connman.pro
@@ -1,4 +1,6 @@
TARGET = qconnmanbearer
+
+PLUGIN_TYPE = bearer
load(qt_plugin)
QT = core network-private dbus
@@ -17,7 +19,3 @@ SOURCES += main.cpp \
OTHER_FILES += connman.json
-DESTDIR = $$QT.network.plugins/bearer
-target.path += $$[QT_INSTALL_PLUGINS]/bearer
-INSTALLS += target
-
diff --git a/src/plugins/bearer/corewlan/corewlan.pro b/src/plugins/bearer/corewlan/corewlan.pro
index b60dac907c..481b75c8ab 100644
--- a/src/plugins/bearer/corewlan/corewlan.pro
+++ b/src/plugins/bearer/corewlan/corewlan.pro
@@ -1,4 +1,6 @@
TARGET = qcorewlanbearer
+
+PLUGIN_TYPE = bearer
load(qt_plugin)
QT = core-private network-private
@@ -20,7 +22,3 @@ SOURCES += main.cpp \
OBJECTIVE_SOURCES += qcorewlanengine.mm
OTHER_FILES += corewlan.json
-
-DESTDIR = $$QT.network.plugins/bearer
-target.path += $$[QT_INSTALL_PLUGINS]/bearer
-INSTALLS += target
diff --git a/src/plugins/bearer/generic/generic.pro b/src/plugins/bearer/generic/generic.pro
index e66c5b2c7a..a1da0dddda 100644
--- a/src/plugins/bearer/generic/generic.pro
+++ b/src/plugins/bearer/generic/generic.pro
@@ -1,4 +1,6 @@
TARGET = qgenericbearer
+
+PLUGIN_TYPE = bearer
load(qt_plugin)
QT = core-private network-private
@@ -12,7 +14,3 @@ SOURCES += qgenericengine.cpp \
main.cpp
OTHER_FILES += generic.json
-
-DESTDIR = $$QT.network.plugins/bearer
-target.path += $$[QT_INSTALL_PLUGINS]/bearer
-INSTALLS += target
diff --git a/src/plugins/bearer/nativewifi/nativewifi.pro b/src/plugins/bearer/nativewifi/nativewifi.pro
index 3124d58ff2..4382cd08cd 100644
--- a/src/plugins/bearer/nativewifi/nativewifi.pro
+++ b/src/plugins/bearer/nativewifi/nativewifi.pro
@@ -1,4 +1,6 @@
TARGET = qnativewifibearer
+
+PLUGIN_TYPE = bearer
load(qt_plugin)
QT = core-private network-private
@@ -13,7 +15,3 @@ SOURCES += main.cpp \
../qnetworksession_impl.cpp
OTHER_FILES += nativewifi.json
-
-DESTDIR = $$QT.network.plugins/bearer
-target.path += $$[QT_INSTALL_PLUGINS]/bearer
-INSTALLS += target
diff --git a/src/plugins/bearer/networkmanager/networkmanager.pro b/src/plugins/bearer/networkmanager/networkmanager.pro
index c1c6664897..4f299e22f2 100644
--- a/src/plugins/bearer/networkmanager/networkmanager.pro
+++ b/src/plugins/bearer/networkmanager/networkmanager.pro
@@ -1,4 +1,6 @@
TARGET = qnmbearer
+
+PLUGIN_TYPE = bearer
load(qt_plugin)
QT = core network-private dbus
@@ -16,7 +18,3 @@ SOURCES += main.cpp \
../qnetworksession_impl.cpp
OTHER_FILES += networkmanager.json
-
-DESTDIR = $$QT.network.plugins/bearer
-target.path += $$[QT_INSTALL_PLUGINS]/bearer
-INSTALLS += target
diff --git a/src/plugins/bearer/nla/nla.pro b/src/plugins/bearer/nla/nla.pro
index 29e98953b1..56c06a57b1 100644
--- a/src/plugins/bearer/nla/nla.pro
+++ b/src/plugins/bearer/nla/nla.pro
@@ -1,4 +1,6 @@
TARGET = qnlabearer
+
+PLUGIN_TYPE = bearer
load(qt_plugin)
QT = core core-private network network-private
@@ -19,7 +21,3 @@ SOURCES += main.cpp \
../qnetworksession_impl.cpp
OTHER_FILES += nla.json
-
-DESTDIR = $$QT.network.plugins/bearer
-target.path += $$[QT_INSTALL_PLUGINS]/bearer
-INSTALLS += target
diff --git a/src/plugins/generic/evdevkeyboard/evdevkeyboard.pro b/src/plugins/generic/evdevkeyboard/evdevkeyboard.pro
index aa85fdcb06..97b827b779 100644
--- a/src/plugins/generic/evdevkeyboard/evdevkeyboard.pro
+++ b/src/plugins/generic/evdevkeyboard/evdevkeyboard.pro
@@ -1,9 +1,7 @@
TARGET = qevdevkeyboardplugin
-load(qt_plugin)
-DESTDIR = $$QT.gui.plugins/generic
-target.path = $$[QT_INSTALL_PLUGINS]/generic
-INSTALLS += target
+PLUGIN_TYPE = generic
+load(qt_plugin)
QT += core-private platformsupport-private gui-private
diff --git a/src/plugins/generic/evdevmouse/evdevmouse.pro b/src/plugins/generic/evdevmouse/evdevmouse.pro
index fd7d0fee6a..c1356593df 100644
--- a/src/plugins/generic/evdevmouse/evdevmouse.pro
+++ b/src/plugins/generic/evdevmouse/evdevmouse.pro
@@ -1,9 +1,7 @@
TARGET = qevdevmouseplugin
-load(qt_plugin)
-DESTDIR = $$QT.gui.plugins/generic
-target.path = $$[QT_INSTALL_PLUGINS]/generic
-INSTALLS += target
+PLUGIN_TYPE = generic
+load(qt_plugin)
QT += core-private platformsupport-private gui-private
diff --git a/src/plugins/generic/evdevtablet/evdevtablet.pro b/src/plugins/generic/evdevtablet/evdevtablet.pro
index 841d7b96f7..066819be33 100644
--- a/src/plugins/generic/evdevtablet/evdevtablet.pro
+++ b/src/plugins/generic/evdevtablet/evdevtablet.pro
@@ -1,9 +1,7 @@
TARGET = qevdevtabletplugin
-load(qt_plugin)
-DESTDIR = $$QT.gui.plugins/generic
-target.path = $$[QT_INSTALL_PLUGINS]/generic
-INSTALLS += target
+PLUGIN_TYPE = generic
+load(qt_plugin)
SOURCES = main.cpp
diff --git a/src/plugins/generic/evdevtouch/evdevtouch.pro b/src/plugins/generic/evdevtouch/evdevtouch.pro
index a47d00fbf0..2c1d6913ad 100644
--- a/src/plugins/generic/evdevtouch/evdevtouch.pro
+++ b/src/plugins/generic/evdevtouch/evdevtouch.pro
@@ -1,9 +1,7 @@
TARGET = qevdevtouchplugin
-load(qt_plugin)
-DESTDIR = $$QT.gui.plugins/generic
-target.path = $$[QT_INSTALL_PLUGINS]/generic
-INSTALLS += target
+PLUGIN_TYPE = generic
+load(qt_plugin)
SOURCES = main.cpp
diff --git a/src/plugins/generic/meego/meego.pro b/src/plugins/generic/meego/meego.pro
index 692ace485f..b8845418e8 100644
--- a/src/plugins/generic/meego/meego.pro
+++ b/src/plugins/generic/meego/meego.pro
@@ -1,10 +1,7 @@
TARGET = qmeegointegration
-load(qt_plugin)
-
-QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/generic
-target.path = $$[QT_INSTALL_PLUGINS]/generic
-INSTALLS += target
+PLUGIN_TYPE = generic
+load(qt_plugin)
SOURCES = qmeegointegration.cpp \
main.cpp \
diff --git a/src/plugins/generic/tslib/tslib.pro b/src/plugins/generic/tslib/tslib.pro
index 9046e18f77..ab0645d89a 100644
--- a/src/plugins/generic/tslib/tslib.pro
+++ b/src/plugins/generic/tslib/tslib.pro
@@ -1,9 +1,7 @@
TARGET = qtslibplugin
-load(qt_plugin)
-DESTDIR = $$QT.gui.plugins/generic
-target.path = $$[QT_INSTALL_PLUGINS]/generic
-INSTALLS += target
+PLUGIN_TYPE = generic
+load(qt_plugin)
HEADERS = qtslib.h
diff --git a/src/plugins/imageformats/gif/gif.pro b/src/plugins/imageformats/gif/gif.pro
index b85ee984ac..d5acfedff7 100644
--- a/src/plugins/imageformats/gif/gif.pro
+++ b/src/plugins/imageformats/gif/gif.pro
@@ -1,11 +1,9 @@
TARGET = qgif
+
+PLUGIN_TYPE = imageformats
load(qt_plugin)
include(../../../gui/image/qgifhandler.pri)
SOURCES += $$PWD/main.cpp
HEADERS += $$PWD/main.h
OTHER_FILES += gif.json
-
-DESTDIR = $$QT.gui.plugins/imageformats
-target.path += $$[QT_INSTALL_PLUGINS]/imageformats
-INSTALLS += target
diff --git a/src/plugins/imageformats/ico/ico.pro b/src/plugins/imageformats/ico/ico.pro
index 242e42b869..48bfd6b344 100644
--- a/src/plugins/imageformats/ico/ico.pro
+++ b/src/plugins/imageformats/ico/ico.pro
@@ -1,4 +1,6 @@
TARGET = qico
+
+PLUGIN_TYPE = imageformats
load(qt_plugin)
QTDIR_build:REQUIRES = "!contains(QT_CONFIG, no-ico)"
@@ -7,7 +9,3 @@ HEADERS += qicohandler.h main.h
SOURCES += main.cpp \
qicohandler.cpp
OTHER_FILES += ico.json
-
-DESTDIR = $$QT.gui.plugins/imageformats
-target.path += $$[QT_INSTALL_PLUGINS]/imageformats
-INSTALLS += target
diff --git a/src/plugins/imageformats/jpeg/jpeg.pro b/src/plugins/imageformats/jpeg/jpeg.pro
index f2a41129d5..35153eb59c 100644
--- a/src/plugins/imageformats/jpeg/jpeg.pro
+++ b/src/plugins/imageformats/jpeg/jpeg.pro
@@ -1,4 +1,6 @@
TARGET = qjpeg
+
+PLUGIN_TYPE = imageformats
load(qt_plugin)
QT += core-private
@@ -9,7 +11,3 @@ include(../../../gui/image/qjpeghandler.pri)
SOURCES += main.cpp
HEADERS += main.h
OTHER_FILES += jpeg.json
-
-DESTDIR = $$QT.gui.plugins/imageformats
-target.path += $$[QT_INSTALL_PLUGINS]/imageformats
-INSTALLS += target
diff --git a/src/plugins/platforminputcontexts/ibus/ibus.pro b/src/plugins/platforminputcontexts/ibus/ibus.pro
index 8c8ab52c3c..033d5a4d5c 100644
--- a/src/plugins/platforminputcontexts/ibus/ibus.pro
+++ b/src/plugins/platforminputcontexts/ibus/ibus.pro
@@ -1,7 +1,7 @@
TARGET = ibusplatforminputcontextplugin
-load(qt_plugin)
-QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforminputcontexts
+PLUGIN_TYPE = platforminputcontexts
+load(qt_plugin)
QT += dbus gui-private
SOURCES += $$PWD/qibusplatforminputcontext.cpp \
@@ -16,6 +16,3 @@ HEADERS += $$PWD/qibusplatforminputcontext.h \
$$PWD/qibustypes.h
OTHER_FILES += $$PWD/ibus.json
-
-target.path += $$[QT_INSTALL_PLUGINS]/platforminputcontexts
-INSTALLS += target
diff --git a/src/plugins/platforminputcontexts/maliit/maliit.pro b/src/plugins/platforminputcontexts/maliit/maliit.pro
index 4174072c2b..dec6833196 100644
--- a/src/plugins/platforminputcontexts/maliit/maliit.pro
+++ b/src/plugins/platforminputcontexts/maliit/maliit.pro
@@ -1,7 +1,7 @@
TARGET = maliitplatforminputcontextplugin
-load(qt_plugin)
-QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforminputcontexts
+PLUGIN_TYPE = platforminputcontexts
+load(qt_plugin)
QT += dbus gui-private
SOURCES += $$PWD/qmaliitplatforminputcontext.cpp \
@@ -16,6 +16,3 @@ HEADERS += $$PWD/qmaliitplatforminputcontext.h \
$$PWD/contextadaptor.h
OTHER_FILES += $$PWD/maliit.json
-
-target.path += $$[QT_INSTALL_PLUGINS]/platforminputcontexts
-INSTALLS += target
diff --git a/src/plugins/platforms/cocoa/cocoa.pro b/src/plugins/platforms/cocoa/cocoa.pro
index 106664a6b0..3ea5dc2d1c 100644
--- a/src/plugins/platforms/cocoa/cocoa.pro
+++ b/src/plugins/platforms/cocoa/cocoa.pro
@@ -1,6 +1,7 @@
TARGET = qcocoa
+
+PLUGIN_TYPE = platforms
load(qt_plugin)
-DESTDIR = $$QT.gui.plugins/platforms
OBJECTIVE_SOURCES += main.mm \
qcocoaintegration.mm \
@@ -91,8 +92,6 @@ QT += core-private gui-private platformsupport-private
}
OTHER_FILES += cocoa.json
-target.path += $$[QT_INSTALL_PLUGINS]/platforms
-INSTALLS += target
# Build the release libqcocoa.dylib only, skip the debug version.
# The Qt plugin loader will dlopen both if found, causing duplicate
diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.h b/src/plugins/platforms/cocoa/qcocoaintegration.h
index d465d47e12..ea43bbbc10 100644
--- a/src/plugins/platforms/cocoa/qcocoaintegration.h
+++ b/src/plugins/platforms/cocoa/qcocoaintegration.h
@@ -128,7 +128,9 @@ private:
QAbstractEventDispatcher *mEventDispatcher;
QScopedPointer<QPlatformInputContext> mInputContext;
+#ifndef QT_NO_ACCESSIBILITY
QScopedPointer<QPlatformAccessibility> mAccessibility;
+#endif
QScopedPointer<QPlatformTheme> mPlatformTheme;
QList<QCocoaScreen *> mScreens;
QCocoaClipboard *mCocoaClipboard;
diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm
index b069446c50..481055aae4 100644
--- a/src/plugins/platforms/cocoa/qcocoaintegration.mm
+++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm
@@ -180,7 +180,9 @@ QCocoaIntegration::QCocoaIntegration()
: mFontDb(new QCoreTextFontDatabase())
, mEventDispatcher(new QCocoaEventDispatcher())
, mInputContext(new QCocoaInputContext)
+#ifndef QT_NO_ACCESSIBILITY
, mAccessibility(new QPlatformAccessibility)
+#endif
, mCocoaClipboard(new QCocoaClipboard)
, mCocoaDrag(new QCocoaDrag)
, mNativeInterface(new QCocoaNativeInterface)
@@ -302,11 +304,15 @@ void QCocoaIntegration::updateScreens()
bool QCocoaIntegration::hasCapability(QPlatformIntegration::Capability cap) const
{
switch (cap) {
- case ThreadedPixmaps: return true;
- case OpenGL : return true;
- case ThreadedOpenGL : return true;
- case BufferQueueingOpenGL: return true;
- default: return QPlatformIntegration::hasCapability(cap);
+ case ThreadedPixmaps:
+ case OpenGL:
+ case ThreadedOpenGL:
+ case BufferQueueingOpenGL:
+ case WindowMasks:
+ case MultipleWindows:
+ return true;
+ default:
+ return QPlatformIntegration::hasCapability(cap);
}
}
@@ -349,7 +355,11 @@ QPlatformInputContext *QCocoaIntegration::inputContext() const
QPlatformAccessibility *QCocoaIntegration::accessibility() const
{
+#ifndef QT_NO_ACCESSIBILITY
return mAccessibility.data();
+#else
+ return 0;
+#endif
}
QPlatformClipboard *QCocoaIntegration::clipboard() const
diff --git a/src/plugins/platforms/cocoa/qcocoamenu.h b/src/plugins/platforms/cocoa/qcocoamenu.h
index 38952a2e5d..3afe089225 100644
--- a/src/plugins/platforms/cocoa/qcocoamenu.h
+++ b/src/plugins/platforms/cocoa/qcocoamenu.h
@@ -70,6 +70,7 @@ public:
void removeMenuItem(QPlatformMenuItem *menuItem);
void syncMenuItem(QPlatformMenuItem *menuItem);
void setEnabled(bool enabled);
+ void setVisible(bool visible);
void syncSeparatorsCollapsible(bool enable);
void syncModalState(bool modal);
diff --git a/src/plugins/platforms/cocoa/qcocoamenu.mm b/src/plugins/platforms/cocoa/qcocoamenu.mm
index 4d35b3202e..36d5c81f34 100644
--- a/src/plugins/platforms/cocoa/qcocoamenu.mm
+++ b/src/plugins/platforms/cocoa/qcocoamenu.mm
@@ -268,6 +268,12 @@ void QCocoaMenu::setParentItem(QCocoaMenuItem *item)
void QCocoaMenu::setEnabled(bool enabled)
{
m_enabled = enabled;
+ syncModalState(!m_enabled);
+}
+
+void QCocoaMenu::setVisible(bool visible)
+{
+ [m_nativeItem setSubmenu:(visible ? m_nativeMenu : nil)];
}
QPlatformMenuItem *QCocoaMenu::menuItemAt(int position) const
diff --git a/src/plugins/platforms/cocoa/qcocoamenuitem.mm b/src/plugins/platforms/cocoa/qcocoamenuitem.mm
index 150d3eef7d..d78ff73bb6 100644
--- a/src/plugins/platforms/cocoa/qcocoamenuitem.mm
+++ b/src/plugins/platforms/cocoa/qcocoamenuitem.mm
@@ -263,7 +263,7 @@ NSMenuItem *QCocoaMenuItem::sync()
// [m_native setHidden:YES];
// [m_native setHidden:NO];
[m_native setHidden: !m_isVisible];
-
+ [m_native setEnabled: m_enabled];
QString text = m_text;
QKeySequence accel = m_shortcut;
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.h b/src/plugins/platforms/cocoa/qcocoawindow.h
index d5dbe58de9..db3a20c2be 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.h
+++ b/src/plugins/platforms/cocoa/qcocoawindow.h
@@ -107,6 +107,7 @@ public:
void lower();
void propagateSizeHints();
void setOpacity(qreal level);
+ void setMask(const QRegion &region);
bool setKeyboardGrabEnabled(bool grab);
bool setMouseGrabEnabled(bool grab);
QMargins frameMargins() const;
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
index b9ad35600e..de6e7dc43e 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
@@ -509,6 +509,16 @@ void QCocoaWindow::setOpacity(qreal level)
[m_nsWindow setAlphaValue:level];
}
+void QCocoaWindow::setMask(const QRegion &region)
+{
+ if (m_nsWindow) {
+ [m_nsWindow setOpaque:NO];
+ [m_nsWindow setBackgroundColor:[NSColor clearColor]];
+ }
+
+ [m_contentView setMaskRegion:&region];
+}
+
bool QCocoaWindow::setKeyboardGrabEnabled(bool grab)
{
if (!m_nsWindow)
@@ -703,11 +713,6 @@ void QCocoaWindow::setNSWindow(NSWindow *window)
name:nil // Get all notifications
object:m_nsWindow];
- // ### Accept touch events by default.
- // Beware that enabling touch events has a negative impact on the overall performance.
- // We probably need a QWindowSystemInterface API to enable/disable touch events.
- [m_contentView setAcceptsTouchEvents:YES];
-
[window setContentView:m_contentView];
}
diff --git a/src/plugins/platforms/cocoa/qnsview.h b/src/plugins/platforms/cocoa/qnsview.h
index 32e140f9ff..246d311f7b 100644
--- a/src/plugins/platforms/cocoa/qnsview.h
+++ b/src/plugins/platforms/cocoa/qnsview.h
@@ -54,6 +54,8 @@ QT_END_NAMESPACE
@interface QNSView : NSView <NSTextInputClient> {
CGImageRef m_cgImage;
+ CGImageRef m_maskImage;
+ uchar *m_maskData;
QWindow *m_window;
QCocoaWindow *m_platformWindow;
Qt::MouseButtons m_buttons;
@@ -68,6 +70,7 @@ QT_END_NAMESPACE
- (id)initWithQWindow:(QWindow *)window platformWindow:(QCocoaWindow *) platformWindow;
- (void)setImage:(QImage *)image;
+- (void)setMaskRegion:(const QRegion *)region;
- (void)drawRect:(NSRect)dirtyRect;
- (void)updateGeometry;
- (void)windowNotification : (NSNotification *) windowNotification;
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm
index 33d0fb4bae..d62913a7af 100644
--- a/src/plugins/platforms/cocoa/qnsview.mm
+++ b/src/plugins/platforms/cocoa/qnsview.mm
@@ -75,6 +75,8 @@ static QTouchDevice *touchDevice = 0;
self = [super initWithFrame : NSMakeRect(0,0, 300,300)];
if (self) {
m_cgImage = 0;
+ m_maskImage = 0;
+ m_maskData = 0;
m_window = 0;
m_buttons = Qt::NoButton;
m_sendKeyEvent = false;
@@ -93,6 +95,10 @@ static QTouchDevice *touchDevice = 0;
{
CGImageRelease(m_cgImage);
m_cgImage = 0;
+ CGImageRelease(m_maskImage);
+ m_maskImage = 0;
+ delete[] m_maskData;
+ m_maskData = 0;
m_window = 0;
[super dealloc];
}
@@ -205,47 +211,86 @@ static QTouchDevice *touchDevice = 0;
}
}
-- (void) setImage:(QImage *)image
+static CGImageRef qt_mac_toCGImage(QImage *qImage, bool isMask, uchar **dataCopy)
{
- CGImageRelease(m_cgImage);
-
- int width = image->width();
- int height = image->height();
+ int width = qImage->width();
+ int height = qImage->height();
if (width <= 0 || height <= 0) {
qWarning() << Q_FUNC_INFO <<
"setting invalid size" << width << "x" << height << "for qnsview image";
- m_cgImage = 0;
- return;
+ return 0;
}
- const uchar *imageData = image->bits();
- int bitDepth = image->depth();
+ const uchar *imageData = qImage->bits();
+ if (dataCopy) {
+ delete[] *dataCopy;
+ *dataCopy = new uchar[qImage->byteCount()];
+ memcpy(*dataCopy, imageData, qImage->byteCount());
+ }
+ int bitDepth = qImage->depth();
int colorBufferSize = 8;
- int bytesPrLine = image->bytesPerLine();
-
- CGColorSpaceRef cgColourSpaceRef = CGColorSpaceCreateDeviceRGB();
+ int bytesPrLine = qImage->bytesPerLine();
CGDataProviderRef cgDataProviderRef = CGDataProviderCreateWithData(
NULL,
- imageData,
- image->byteCount(),
+ dataCopy ? *dataCopy : imageData,
+ qImage->byteCount(),
NULL);
- m_cgImage = CGImageCreate(width,
- height,
- colorBufferSize,
- bitDepth,
- bytesPrLine,
- cgColourSpaceRef,
- kCGBitmapByteOrder32Little | kCGImageAlphaNoneSkipFirst,
- cgDataProviderRef,
- NULL,
- false,
- kCGRenderingIntentDefault);
+ CGImageRef cgImage = 0;
+ if (isMask) {
+ cgImage = CGImageMaskCreate(width,
+ height,
+ colorBufferSize,
+ bitDepth,
+ bytesPrLine,
+ cgDataProviderRef,
+ NULL,
+ false);
+ } else {
+ CGColorSpaceRef cgColourSpaceRef = CGColorSpaceCreateDeviceRGB();
+ cgImage = CGImageCreate(width,
+ height,
+ colorBufferSize,
+ bitDepth,
+ bytesPrLine,
+ cgColourSpaceRef,
+ kCGBitmapByteOrder32Little | kCGImageAlphaNoneSkipFirst,
+ cgDataProviderRef,
+ NULL,
+ false,
+ kCGRenderingIntentDefault);
+ CGColorSpaceRelease(cgColourSpaceRef);
+ }
+ return cgImage;
+}
- CGColorSpaceRelease(cgColourSpaceRef);
+- (void) setImage:(QImage *)image
+{
+ CGImageRelease(m_cgImage);
+ m_cgImage = qt_mac_toCGImage(image, false, 0);
+}
+
+- (void) setMaskRegion:(const QRegion *)region
+{
+ if (m_maskImage)
+ CGImageRelease(m_maskImage);
+ if (region->isEmpty()) {
+ m_maskImage = 0;
+ }
+ const QRect &rect = qt_mac_toQRect([self frame]);
+ QImage maskImage(rect.size(), QImage::Format_RGB888);
+ maskImage.fill(Qt::white);
+ QPainter p(&maskImage);
+ p.setRenderHint(QPainter::Antialiasing);
+ p.setClipRegion(*region);
+ p.fillRect(rect, QBrush(Qt::black));
+ p.end();
+
+ maskImage = maskImage.convertToFormat(QImage::Format_Indexed8);
+ m_maskImage = qt_mac_toCGImage(&maskImage, true, &m_maskData);
}
- (void) drawRect:(NSRect)dirtyRect
@@ -263,13 +308,19 @@ static QTouchDevice *touchDevice = 0;
CGContextTranslateCTM(cgContext, 0, dy);
CGContextScaleCTM(cgContext, 1, -1);
+ CGImageRef subMask = 0;
+ if (m_maskImage) {
+ subMask = CGImageCreateWithImageInRect(m_maskImage, dirtyCGRect);
+ CGContextClipToMask(cgContext, dirtyCGRect, subMask);
+ }
+
CGImageRef subImage = CGImageCreateWithImageInRect(m_cgImage, dirtyCGRect);
CGContextDrawImage(cgContext,dirtyCGRect,subImage);
CGContextRestoreGState(cgContext);
CGImageRelease(subImage);
-
+ CGImageRelease(subMask);
}
- (BOOL) isFlipped
diff --git a/src/plugins/platforms/cocoa/qprintengine_mac.mm b/src/plugins/platforms/cocoa/qprintengine_mac.mm
index f2c567f0eb..94c89ad8db 100644
--- a/src/plugins/platforms/cocoa/qprintengine_mac.mm
+++ b/src/plugins/platforms/cocoa/qprintengine_mac.mm
@@ -795,13 +795,15 @@ QVariant QMacPrintEngine::property(PrintEnginePropertyKey key) const
if (d->hasCustomPageMargins) {
margins << d->leftMargin << d->topMargin
<< d->rightMargin << d->bottomMargin;
- } else {
+ } else if (!d->hasCustomPaperSize) {
PMPaperMargins paperMargins;
PMPaper paper;
PMGetPageFormatPaper(d->format(), &paper);
PMPaperGetMargins(paper, &paperMargins);
margins << paperMargins.left << paperMargins.top
<< paperMargins.right << paperMargins.bottom;
+ } else {
+ margins << 0 << 0 << 0 << 0;
}
ret = margins;
break;
diff --git a/src/plugins/platforms/directfb/directfb.pro b/src/plugins/platforms/directfb/directfb.pro
index 85821662a0..29c5ebd99b 100644
--- a/src/plugins/platforms/directfb/directfb.pro
+++ b/src/plugins/platforms/directfb/directfb.pro
@@ -1,6 +1,7 @@
TARGET = qdirectfb
+
+PLUGIN_TYPE = platforms
load(qt_plugin)
-DESTDIR = $$QT.gui.plugins/platforms
QT += core-private gui-private platformsupport-private
@@ -46,7 +47,5 @@ contains(QT_CONFIG, directfb_egl) {
CONFIG += qpa/genericunixfontdatabase
-target.path += $$[QT_INSTALL_PLUGINS]/platforms
-INSTALLS += target
OTHER_FILES += directfb.json
diff --git a/src/plugins/platforms/eglfs/eglfs.pro b/src/plugins/platforms/eglfs/eglfs.pro
index f22ccc55d2..1223b6b133 100644
--- a/src/plugins/platforms/eglfs/eglfs.pro
+++ b/src/plugins/platforms/eglfs/eglfs.pro
@@ -1,10 +1,10 @@
TARGET = qeglfs
+
+PLUGIN_TYPE = platforms
load(qt_plugin)
QT += core-private gui-private platformsupport-private
-DESTDIR = $$QT.gui.plugins/platforms
-
#DEFINES += QEGL_EXTRA_DEBUG
#Avoid X11 header collision
@@ -44,9 +44,6 @@ INCLUDEPATH += $$PWD
CONFIG += egl qpa/genericunixfontdatabase
-target.path += $$[QT_INSTALL_PLUGINS]/platforms
-INSTALLS += target
-
RESOURCES += cursor.qrc
OTHER_FILES += \
diff --git a/src/plugins/platforms/eglfs/qeglfswindow.cpp b/src/plugins/platforms/eglfs/qeglfswindow.cpp
index 036b26a165..32d20e6aaa 100644
--- a/src/plugins/platforms/eglfs/qeglfswindow.cpp
+++ b/src/plugins/platforms/eglfs/qeglfswindow.cpp
@@ -89,8 +89,9 @@ void QEglFSWindow::create()
m_window = hooks->createNativeWindow(hooks->screenSize(), m_format);
m_surface = eglCreateWindowSurface(display, 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", eglGetError());
+ qFatal("EGL Error : Could not create the egl surface: error = 0x%x\n", error);
}
}
diff --git a/src/plugins/platforms/kms/kms.pro b/src/plugins/platforms/kms/kms.pro
index 2e8af5ba9d..57191d8d97 100644
--- a/src/plugins/platforms/kms/kms.pro
+++ b/src/plugins/platforms/kms/kms.pro
@@ -1,8 +1,9 @@
TARGET = qkms
+
+PLUGIN_TYPE = platforms
load(qt_plugin)
QT += core-private gui-private platformsupport-private opengl-private
-DESTDIR = $$QT.gui.plugins/platforms
DEFINES += MESA_EGL_NO_X11_HEADERS
@@ -36,8 +37,5 @@ HEADERS = qkmsintegration.h \
qkmsudevdrmhandler.h \
qkmsvthandler.h
-target.path += $$[QT_INSTALL_PLUGINS]/platforms
-INSTALLS += target
-
OTHER_FILES += \
kms.json
diff --git a/src/plugins/platforms/linuxfb/linuxfb.pro b/src/plugins/platforms/linuxfb/linuxfb.pro
index 9834dea7d5..2482a64469 100644
--- a/src/plugins/platforms/linuxfb/linuxfb.pro
+++ b/src/plugins/platforms/linuxfb/linuxfb.pro
@@ -1,7 +1,7 @@
TARGET = qlinuxfb
-load(qt_plugin)
-DESTDIR = $$QT.gui.plugins/platforms
+PLUGIN_TYPE = platforms
+load(qt_plugin)
QT += core-private gui-private platformsupport-private
@@ -10,7 +10,4 @@ HEADERS = qlinuxfbintegration.h qlinuxfbscreen.h
CONFIG += qpa/genericunixfontdatabase
-target.path += $$[QT_INSTALL_PLUGINS]/platforms
-INSTALLS += target
-
OTHER_FILES += linuxfb.json
diff --git a/src/plugins/platforms/minimal/minimal.pro b/src/plugins/platforms/minimal/minimal.pro
index 6430ccde75..9c3d37269c 100644
--- a/src/plugins/platforms/minimal/minimal.pro
+++ b/src/plugins/platforms/minimal/minimal.pro
@@ -1,8 +1,9 @@
TARGET = qminimal
+
+PLUGIN_TYPE = platforms
load(qt_plugin)
QT += core-private gui-private platformsupport-private
-DESTDIR = $$QT.gui.plugins/platforms
SOURCES = main.cpp \
qminimalintegration.cpp \
@@ -11,6 +12,3 @@ HEADERS = qminimalintegration.h \
qminimalbackingstore.h
OTHER_FILES += minimal.json
-
-target.path += $$[QT_INSTALL_PLUGINS]/platforms
-INSTALLS += target
diff --git a/src/plugins/platforms/minimal/qminimalintegration.cpp b/src/plugins/platforms/minimal/qminimalintegration.cpp
index 6a2db91e34..e9fab6d87c 100644
--- a/src/plugins/platforms/minimal/qminimalintegration.cpp
+++ b/src/plugins/platforms/minimal/qminimalintegration.cpp
@@ -74,6 +74,7 @@ bool QMinimalIntegration::hasCapability(QPlatformIntegration::Capability cap) co
{
switch (cap) {
case ThreadedPixmaps: return true;
+ case MultipleWindows: return true;
default: return QPlatformIntegration::hasCapability(cap);
}
}
diff --git a/src/plugins/platforms/minimalegl/minimalegl.pro b/src/plugins/platforms/minimalegl/minimalegl.pro
index 22e3729ed7..23a6ad9708 100644
--- a/src/plugins/platforms/minimalegl/minimalegl.pro
+++ b/src/plugins/platforms/minimalegl/minimalegl.pro
@@ -1,10 +1,10 @@
TARGET = qminimalegl
+
+PLUGIN_TYPE = platforms
load(qt_plugin)
QT += core-private gui-private platformsupport-private
-DESTDIR = $$QT.gui.plugins/platforms
-
#DEFINES += QEGL_EXTRA_DEBUG
#DEFINES += Q_OPENKODE
@@ -25,8 +25,5 @@ HEADERS = qminimaleglintegration.h \
CONFIG += egl qpa/genericunixfontdatabase
-target.path += $$[QT_INSTALL_PLUGINS]/platforms
-INSTALLS += target
-
OTHER_FILES += \
minimalegl.json
diff --git a/src/plugins/platforms/openwfd/openwf.pro b/src/plugins/platforms/openwfd/openwf.pro
index d913a84411..1b177cba04 100644
--- a/src/plugins/platforms/openwfd/openwf.pro
+++ b/src/plugins/platforms/openwfd/openwf.pro
@@ -1,7 +1,7 @@
TARGET = qopenwf
+PLUGIN_TYPE = platforms
load(qt_plugin)
-QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms
QT += core-private gui-private platformsupport-private
@@ -36,6 +36,3 @@ SOURCES += \
LIBS += -lWFD -lgbm -lGLESv2 -lEGL
-target.path += $$[QT_INSTALL_PLUGINS]/platforms
-INSTALLS += target
-
diff --git a/src/plugins/platforms/qnx/qnx.pro b/src/plugins/platforms/qnx/qnx.pro
index dc16016af3..30c95b1620 100644
--- a/src/plugins/platforms/qnx/qnx.pro
+++ b/src/plugins/platforms/qnx/qnx.pro
@@ -1,7 +1,5 @@
TARGET = qnx
-include(../../qpluginbase.pri)
-QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms
QT += platformsupport platformsupport-private
# Uncomment this to build with support for IMF once it becomes available in the BBNDK
@@ -138,5 +136,5 @@ QMAKE_CXXFLAGS += -I./private
include (../../../platformsupport/eglconvenience/eglconvenience.pri)
include (../../../platformsupport/fontdatabases/fontdatabases.pri)
-target.path += $$[QT_INSTALL_PLUGINS]/platforms
-INSTALLS += target
+PLUGIN_TYPE = platforms
+load(qt_plugin)
diff --git a/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp b/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp
index b8ec91d488..11babe3aaa 100644
--- a/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp
+++ b/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp
@@ -71,7 +71,10 @@ QQnxRasterBackingStore::~QQnxRasterBackingStore()
QPaintDevice *QQnxRasterBackingStore::paintDevice()
{
- return m_platformWindow->renderBuffer().image();
+ if (m_platformWindow->hasBuffers())
+ return m_platformWindow->renderBuffer().image();
+
+ return 0;
}
void QQnxRasterBackingStore::flush(QWindow *window, const QRegion &region, const QPoint &offset)
diff --git a/src/plugins/platforms/qnx/qqnxwindow.cpp b/src/plugins/platforms/qnx/qqnxwindow.cpp
index 097b5788f6..c668a8867d 100644
--- a/src/plugins/platforms/qnx/qqnxwindow.cpp
+++ b/src/plugins/platforms/qnx/qqnxwindow.cpp
@@ -374,10 +374,22 @@ QQnxBuffer &QQnxWindow::renderBuffer()
// Check if render buffer is invalid
if (m_currentBufferIndex == -1) {
+ // check if there are any buffers available
+ int bufferCount = 0;
+ int result = screen_get_window_property_iv(m_window, SCREEN_PROPERTY_RENDER_BUFFER_COUNT, &bufferCount);
+
+ if (result != 0) {
+ qFatal("QQnxWindow: failed to query window buffer count, errno=%d", errno);
+ }
+
+ if (bufferCount != MAX_BUFFER_COUNT) {
+ qFatal("QQnxWindow: invalid buffer count. Expected = %d, got = %d", MAX_BUFFER_COUNT, bufferCount);
+ }
+
// Get all buffers available for rendering
errno = 0;
screen_buffer_t buffers[MAX_BUFFER_COUNT];
- int result = screen_get_window_property_pv(m_window, SCREEN_PROPERTY_RENDER_BUFFERS, (void **)buffers);
+ result = screen_get_window_property_pv(m_window, SCREEN_PROPERTY_RENDER_BUFFERS, (void **)buffers);
if (result != 0) {
qFatal("QQnxWindow: failed to query window buffers, errno=%d", errno);
}
diff --git a/src/plugins/platforms/windows/accessible/iaccessible2.cpp b/src/plugins/platforms/windows/accessible/iaccessible2.cpp
index 6acfd6e602..03bb94db8f 100644
--- a/src/plugins/platforms/windows/accessible/iaccessible2.cpp
+++ b/src/plugins/platforms/windows/accessible/iaccessible2.cpp
@@ -1493,13 +1493,26 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::QueryService(REFGUID guidServic
*iface = 0;
accessibleDebug("QWindowsIA2Accessible::QS(): %s", IIDToString(riid).constData());
- if (guidService == IID_IAccessible && riid == IID_IAccessible2) {
- // The conditions for entering here should be ok (from _dicoveringInterfaces in IAccessible2.idl)
- *iface = static_cast<IAccessible2*>(this);
- } else if (guidService == IID_IAccessible && (riid == IID_IAccessible || riid == IID_IUnknown || riid == IID_IDispatch)) {
- // The above conditions works with AccProbe and NVDA.
- *iface = static_cast<IAccessible*>(this);
- } else if (riid == IID_IAccessibleApplication) {
+
+ if (guidService == IID_IAccessible) {
+ if (riid == IID_IServiceProvider) {
+ // do not end up calling QueryInterface for IID_IServiceProvider
+ *iface = 0;
+ } else if (riid == IID_IAccessible || riid == IID_IUnknown || riid == IID_IDispatch) {
+ // The above conditions works with AccProbe and NVDA.
+ *iface = static_cast<IAccessible*>(this);
+ } else {
+ // According to _dicoveringInterfaces Discovery of Interfaces, we should really only
+ // enter here if riid == IID_IAccessible2, but some screen readers does not like that,
+ // and other servers seems to have realized that. (Chrome and Mozilla for instance,
+ // calls QueryInterface more or less in the same way)
+
+ // For instance, accProbe discovers IID_IAccessibleTable2 by a QueryService only.
+ return QueryInterface(riid, iface);
+ }
+ }
+
+ if (riid == IID_IAccessibleApplication) {
*iface = new AccessibleApplication;
return S_OK;
}
diff --git a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
index 87cb224d49..9e5578d35d 100644
--- a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
+++ b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
@@ -43,12 +43,9 @@
#include "qwindowscontext.h"
#include "qwindowswindow.h"
+#include "qwindowsintegration.h"
#include "qwindowstheme.h" // Color conversion helpers
-#include <QtWidgets/QColorDialog>
-#include <QtWidgets/QFontDialog>
-#include <QtWidgets/QFileDialog>
-
#include <QtGui/QGuiApplication>
#include <QtGui/QColor>
@@ -60,6 +57,7 @@
#include <QtCore/QSharedPointer>
#include <QtCore/QObject>
#include <QtCore/QThread>
+#include <QtCore/QSysInfo>
#include <QtCore/private/qsystemlibrary_p.h>
#include "qtwindows_additional.h"
@@ -384,9 +382,10 @@ void eatMouseMove()
\class QWindowsNativeDialogBase
\brief Base class for Windows native dialogs.
- Base clases for native dialogs that mimick the
- behaviour of their QDialog counterparts as close as
- possible.
+ Base classes for native dialogs (using the CLSID-based
+ dialog interfaces "IFileDialog", etc. available from Windows
+ Vista on) that mimick the behaviour of their QDialog
+ counterparts as close as possible.
A major difference is that there is only an exec(), which
is a modal, blocking call; there is no non-blocking show().
@@ -862,12 +861,45 @@ int QWindowsNativeFileDialogBase::itemPaths(IShellItemArray *items,
return itemCount;
}
-// Copy a string to an Utf16 buffer.
-static inline void toBuffer(const QString &what, WCHAR **ptr)
+// Split a list of name filters into description and actual filters
+struct FilterSpec
+{
+ QString description;
+ QString filter;
+};
+
+static QList<FilterSpec> filterSpecs(const QStringList &filters,
+ bool hideFilterDetails,
+ int *totalStringLength)
{
- const int length = 1 + what.size();
- memcpy(*ptr, what.utf16(), length * sizeof(WCHAR));
- *ptr += length;
+ QList<FilterSpec> result;
+ result.reserve(filters.size());
+ *totalStringLength = 0;
+
+ const QRegExp filterSeparatorRE(QStringLiteral("[;\\s]+"));
+ const QString separator = QStringLiteral(";");
+ Q_ASSERT(filterSeparatorRE.isValid());
+ // Split filter specification as 'Texts (*.txt[;] *.doc)'
+ // into description and filters specification as '*.txt;*.doc'
+ foreach (const QString &filterString, filters) {
+ const int openingParenPos = filterString.lastIndexOf(QLatin1Char('('));
+ const int closingParenPos = openingParenPos != -1 ?
+ filterString.indexOf(QLatin1Char(')'), openingParenPos + 1) : -1;
+ FilterSpec filterSpec;
+ filterSpec.filter = closingParenPos == -1 ?
+ QString(QLatin1Char('*')) :
+ filterString.mid(openingParenPos + 1, closingParenPos - openingParenPos - 1).trimmed();
+ filterSpec.filter.replace(filterSeparatorRE, separator);
+ filterSpec.description = filterString;
+ if (hideFilterDetails && openingParenPos != -1) { // Do not show pattern in description
+ filterSpec.description.truncate(openingParenPos);
+ while (filterSpec.description.endsWith(QLatin1Char(' ')))
+ filterSpec.description.truncate(filterSpec.description.size() - 1);
+ }
+ *totalStringLength += filterSpec.filter.size() + filterSpec.description.size();
+ result.push_back(filterSpec);
+ }
+ return result;
}
void QWindowsNativeFileDialogBase::setNameFilters(const QStringList &filters)
@@ -875,48 +907,30 @@ void QWindowsNativeFileDialogBase::setNameFilters(const QStringList &filters)
/* Populates an array of COMDLG_FILTERSPEC from list of filters,
* store the strings in a flat, contiguous buffer. */
m_nameFilters = filters;
- const int size = filters.size();
int totalStringLength = 0;
- for (int i = 0; i < size; ++i)
- totalStringLength += filters.at(i).size();
+ const QList<FilterSpec> specs = filterSpecs(filters, m_hideFiltersDetails, &totalStringLength);
+ const int size = specs.size();
- QScopedArrayPointer<WCHAR> buffer(new WCHAR[totalStringLength * 2 + 2 * size]);
+ QScopedArrayPointer<WCHAR> buffer(new WCHAR[totalStringLength + 2 * size]);
QScopedArrayPointer<COMDLG_FILTERSPEC> comFilterSpec(new COMDLG_FILTERSPEC[size]);
const QString matchesAll = QStringLiteral(" (*)");
- const QRegExp filterSeparatorRE(QStringLiteral("[;\\s]+"));
- const QString separator = QStringLiteral(";");
- Q_ASSERT(filterSeparatorRE.isValid());
-
WCHAR *ptr = buffer.data();
// Split filter specification as 'Texts (*.txt[;] *.doc)'
// into description and filters specification as '*.txt;*.doc'
+
for (int i = 0; i < size; ++i) {
- QString filterString = filters.at(i);
- const int openingParenPos = filterString.lastIndexOf(QLatin1Char('('));
- const int closingParenPos = openingParenPos != -1 ?
- filterString.indexOf(QLatin1Char(')'), openingParenPos + 1) : -1;
- QString filterSpec = closingParenPos == -1 ?
- QString(QLatin1Char('*')) :
- filterString.mid(openingParenPos + 1, closingParenPos - openingParenPos - 1).trimmed();
- filterSpec.replace(filterSeparatorRE, separator);
- if (m_hideFiltersDetails) {
- // Do not show pattern in description
- if (openingParenPos != -1) {
- filterString.truncate(openingParenPos);
- while (filterString.endsWith(QLatin1Char(' ')))
- filterString.truncate(filterString.size() - 1);
- }
- } else {
- // Display glitch: 'All files (*)' shows up as 'All files (*) (*)'
- if (filterString.endsWith(matchesAll))
- filterString.truncate(filterString.size() - matchesAll.size());
- }
+ // Display glitch (CLSID only): 'All files (*)' shows up as 'All files (*) (*)'
+ QString description = specs[i].description;
+ if (!m_hideFiltersDetails && description.endsWith(matchesAll))
+ description.truncate(description.size() - matchesAll.size());
// Add to buffer.
comFilterSpec[i].pszName = ptr;
- toBuffer(filterString, &ptr);
+ ptr += description.toWCharArray(ptr);
+ *ptr++ = 0;
comFilterSpec[i].pszSpec = ptr;
- toBuffer(filterSpec, &ptr);
+ ptr += specs[i].filter.toWCharArray(ptr);
+ *ptr++ = 0;
}
m_fileDialog->SetFileTypes(size, comFilterSpec.data());
@@ -947,9 +961,23 @@ void QWindowsNativeFileDialogBase::setLabelText(QFileDialogOptions::DialogLabel
}
}
+// Return the index of the selected filter, accounting for QFileDialog
+// sometimes stripping the filter specification depending on the
+// hideFilterDetails setting.
+static int indexOfNameFilter(const QStringList &filters, const QString &needle)
+{
+ const int index = filters.indexOf(needle);
+ if (index >= 0)
+ return index;
+ for (int i = 0; i < filters.size(); ++i)
+ if (filters.at(i).startsWith(needle))
+ return i;
+ return -1;
+}
+
void QWindowsNativeFileDialogBase::selectNameFilter(const QString &filter)
{
- const int index = m_nameFilters.indexOf(filter);
+ const int index = indexOfNameFilter(m_nameFilters, filter);
if (index >= 0) {
m_fileDialog->SetFileTypeIndex(index + 1); // one-based.
} else {
@@ -1270,6 +1298,380 @@ QString QWindowsFileDialogHelper::selectedNameFilter() const
return QString();
}
+#ifndef Q_OS_WINCE
+
+/*!
+ \class QWindowsXpNativeFileDialog
+ \brief Native Windows directory dialog for Windows XP using SHlib-functions.
+
+ Uses the synchronous GetOpenFileNameW(), GetSaveFileNameW() from ComDlg32
+ or SHBrowseForFolder() for directories.
+
+ \internal
+ \sa QWindowsXpFileDialogHelper
+
+ \ingroup qt-lighthouse-win
+*/
+
+class QWindowsXpNativeFileDialog : public QWindowsNativeDialogBase
+{
+ Q_OBJECT
+public:
+ typedef QSharedPointer<QFileDialogOptions> OptionsPtr;
+
+ static QWindowsXpNativeFileDialog *create(const OptionsPtr &options);
+
+ virtual void setWindowTitle(const QString &t) { m_title = t; }
+ virtual void exec(HWND owner = 0);
+ virtual QPlatformDialogHelper::DialogCode result() const { return m_result; }
+
+ void setDirectory(const QString &d) { m_directory = d; }
+ QString directory() const { return m_directory; }
+ void selectFile(const QString &f) { m_initialFile = f; }
+ QStringList selectedFiles() const { return m_selectedFiles; }
+ void setNameFilters(const QStringList &n) { m_nameFilters = n; }
+ void selectNameFilter(const QString &f);
+ QString selectedNameFilter() const { return m_selectedNameFilter; }
+
+ int existingDirCallback(HWND hwnd, UINT uMsg, LPARAM lParam);
+
+public slots:
+ virtual void close() {}
+
+private:
+ typedef BOOL (APIENTRY *PtrGetOpenFileNameW)(LPOPENFILENAMEW);
+ typedef BOOL (APIENTRY *PtrGetSaveFileNameW)(LPOPENFILENAMEW);
+
+ explicit QWindowsXpNativeFileDialog(const OptionsPtr &options);
+ void populateOpenFileName(OPENFILENAME *ofn, HWND owner) const;
+ QStringList execExistingDir(HWND owner);
+ QStringList execFileNames(HWND owner, int *selectedFilterIndex) const;
+
+ const OptionsPtr m_options;
+ QString m_title;
+ QString m_directory;
+ QString m_initialFile;
+ QStringList m_selectedFiles;
+ QString m_selectedNameFilter;
+ QStringList m_nameFilters;
+ QPlatformDialogHelper::DialogCode m_result;
+
+ static PtrGetOpenFileNameW m_getOpenFileNameW;
+ static PtrGetSaveFileNameW m_getSaveFileNameW;
+};
+
+QWindowsXpNativeFileDialog::PtrGetOpenFileNameW QWindowsXpNativeFileDialog::m_getOpenFileNameW = 0;
+QWindowsXpNativeFileDialog::PtrGetSaveFileNameW QWindowsXpNativeFileDialog::m_getSaveFileNameW = 0;
+
+QWindowsXpNativeFileDialog *QWindowsXpNativeFileDialog::create(const OptionsPtr &options)
+{
+ // GetOpenFileNameW() GetSaveFileName() are resolved
+ // dynamically as not to create a dependency on Comdlg32, which
+ // is used on XP only.
+ if (!m_getOpenFileNameW) {
+ QSystemLibrary library(QStringLiteral("Comdlg32"));
+ m_getOpenFileNameW = (PtrGetOpenFileNameW)(library.resolve("GetOpenFileNameW"));
+ m_getSaveFileNameW = (PtrGetSaveFileNameW)(library.resolve("GetSaveFileNameW"));
+ }
+ if (m_getOpenFileNameW && m_getSaveFileNameW)
+ return new QWindowsXpNativeFileDialog(options);
+ return 0;
+}
+
+QWindowsXpNativeFileDialog::QWindowsXpNativeFileDialog(const OptionsPtr &options) :
+ m_options(options), m_result(QPlatformDialogHelper::Rejected)
+{
+ const QStringList nameFilters = m_options->nameFilters();
+ if (!nameFilters.isEmpty())
+ setNameFilters(nameFilters);
+ const QString initialDirectory = m_options->initialDirectory();
+ if (!initialDirectory.isEmpty())
+ setDirectory(initialDirectory);
+ const QString initialNameFilter = m_options->initiallySelectedNameFilter();
+ if (!initialNameFilter.isEmpty())
+ selectNameFilter(initialNameFilter);
+ const QStringList selectedFiles = m_options->initiallySelectedFiles();
+ if (!selectedFiles.isEmpty())
+ selectFile(selectedFiles.front());
+ setWindowTitle(m_options->windowTitle());
+}
+
+void QWindowsXpNativeFileDialog::selectNameFilter(const QString &f)
+{
+ const int index = indexOfNameFilter(m_nameFilters, f);
+ if (index >= 0)
+ m_selectedNameFilter = m_nameFilters.at(index);
+}
+
+void QWindowsXpNativeFileDialog::exec(HWND owner)
+{
+ int selectedFilterIndex = -1;
+ m_selectedFiles = m_options->fileMode() == QFileDialogOptions::DirectoryOnly ?
+ execExistingDir(owner) : execFileNames(owner, &selectedFilterIndex);
+ QWindowsDialogs::eatMouseMove();
+ if (m_selectedFiles.isEmpty()) {
+ m_result = QPlatformDialogHelper::Rejected;
+ emit rejected();
+ } else {
+ if (selectedFilterIndex >= 0 && selectedFilterIndex < m_nameFilters.size()) {
+ m_selectedNameFilter = m_nameFilters.at(selectedFilterIndex);
+ } else {
+ m_selectedNameFilter.clear();
+ }
+ m_directory = QFileInfo(m_selectedFiles.front()).absolutePath();
+ m_result = QPlatformDialogHelper::Accepted;
+ emit accepted();
+ }
+}
+
+// Callback for QWindowsNativeXpFileDialog directory dialog.
+// MFC Directory Dialog. Contrib: Steve Williams (minor parts from Scott Powers)
+
+static int CALLBACK xpFileDialogGetExistingDirCallbackProc(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData)
+{
+ QWindowsXpNativeFileDialog *dialog = reinterpret_cast<QWindowsXpNativeFileDialog *>(lpData);
+ return dialog->existingDirCallback(hwnd, uMsg, lParam);
+}
+
+#ifdef Q_CC_MINGW
+typedef ITEMIDLIST *qt_LpItemIdList;
+#else
+typedef PIDLIST_ABSOLUTE qt_LpItemIdList;
+#endif
+
+int QWindowsXpNativeFileDialog::existingDirCallback(HWND hwnd, UINT uMsg, LPARAM lParam)
+{
+ switch (uMsg) {
+ case BFFM_INITIALIZED:
+ if (!m_initialFile.isEmpty())
+ SendMessage(hwnd, BFFM_SETSELECTION, TRUE, LPARAM(m_initialFile.utf16()));
+ break;
+ case BFFM_SELCHANGED: {
+ wchar_t path[MAX_PATH];
+ const bool ok = SHGetPathFromIDList(reinterpret_cast<qt_LpItemIdList>(lParam), path)
+ && path[0];
+ SendMessage(hwnd, BFFM_ENABLEOK, ok ? 1 : 0, 1);
+ }
+ break;
+ }
+ return 0;
+}
+
+QStringList QWindowsXpNativeFileDialog::execExistingDir(HWND owner)
+{
+ BROWSEINFO bi;
+ wchar_t initPath[MAX_PATH];
+ initPath[0] = 0;
+ bi.hwndOwner = owner;
+ bi.pidlRoot = NULL;
+ //### This does not seem to be respected? - the dialog always displays "Browse for folder"
+ bi.lpszTitle = (wchar_t*)m_title.utf16();
+ bi.pszDisplayName = initPath;
+ bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_STATUSTEXT | BIF_NEWDIALOGSTYLE;
+ bi.lpfn = xpFileDialogGetExistingDirCallbackProc;
+ bi.lParam = LPARAM(this);
+ QStringList selectedFiles;
+ if (qt_LpItemIdList pItemIDList = SHBrowseForFolder(&bi)) {
+ wchar_t path[MAX_PATH];
+ path[0] = 0;
+ if (SHGetPathFromIDList(pItemIDList, path) && path[0])
+ selectedFiles.push_back(QDir::cleanPath(QString::fromWCharArray(path)));
+ IMalloc *pMalloc;
+ if (SHGetMalloc(&pMalloc) == NOERROR) {
+ pMalloc->Free(pItemIDList);
+ pMalloc->Release();
+ }
+ }
+ return selectedFiles;
+}
+
+// Return an allocated wchar_t array from a QString, reserve more memory if desired.
+static wchar_t *qStringToWCharArray(const QString &s, size_t reserveSize = 0)
+{
+ const size_t stringSize = s.size();
+ wchar_t *result = new wchar_t[qMax(stringSize + 1, reserveSize)];
+ s.toWCharArray(result);
+ result[stringSize] = 0;
+ return result;
+}
+
+// Open/Save files
+void QWindowsXpNativeFileDialog::populateOpenFileName(OPENFILENAME *ofn, HWND owner) const
+{
+ ZeroMemory(ofn, sizeof(OPENFILENAME));
+ ofn->lStructSize = sizeof(OPENFILENAME);
+ ofn->hwndOwner = owner;
+
+ // Create a buffer with the filter strings.
+ int totalStringLength = 0;
+ QList<FilterSpec> specs =
+ filterSpecs(m_options->nameFilters(), m_options->options() & QFileDialogOptions::HideNameFilterDetails, &totalStringLength);
+ const int size = specs.size();
+ wchar_t *ptr = new wchar_t[totalStringLength + 2 * size + 1];
+ ofn->lpstrFilter = ptr;
+ foreach (const FilterSpec &spec, specs) {
+ ptr += spec.description.toWCharArray(ptr);
+ *ptr++ = 0;
+ ptr += spec.filter.toWCharArray(ptr);
+ *ptr++ = 0;
+ }
+ *ptr = 0;
+ const int nameFilterIndex = indexOfNameFilter(m_nameFilters, m_selectedNameFilter);
+ if (nameFilterIndex >= 0)
+ ofn->nFilterIndex = nameFilterIndex + 1; // 1..n based.
+ // lpstrFile receives the initial selection and is the buffer
+ // for the target. If it contains any invalid character, the dialog
+ // will not show.
+ ofn->nMaxFile = 65535;
+ const QString initiallySelectedFile =
+ QDir::toNativeSeparators(m_initialFile).remove(QLatin1Char('<')).
+ remove(QLatin1Char('>')).remove(QLatin1Char('"')).remove(QLatin1Char('|'));
+ ofn->lpstrFile = qStringToWCharArray(initiallySelectedFile, ofn->nMaxFile);
+ ofn->lpstrInitialDir = qStringToWCharArray(QDir::toNativeSeparators(m_directory));
+ ofn->lpstrTitle = (wchar_t*)m_title.utf16();
+ // Determine lpstrDefExt. Note that the current MSDN docs document this
+ // member wrong. It should rather be documented as "the default extension
+ // if no extension was given and if the current filter does not have an
+ // extension (e.g (*)). If the current filter has an extension, use
+ // the extension of the current filter".
+ if (m_options->acceptMode() == QFileDialogOptions::AcceptSave) {
+ QString defaultSuffix = m_options->defaultSuffix();
+ if (defaultSuffix.startsWith(QLatin1Char('.')))
+ defaultSuffix.remove(0, 1);
+ if (!defaultSuffix.isEmpty())
+ ofn->lpstrDefExt = qStringToWCharArray(defaultSuffix);
+ }
+ // Flags.
+ ofn->Flags = (OFN_NOCHANGEDIR | OFN_HIDEREADONLY | OFN_EXPLORER | OFN_PATHMUSTEXIST);
+ if (m_options->fileMode() == QFileDialogOptions::ExistingFile
+ || m_options->fileMode() == QFileDialogOptions::ExistingFiles)
+ ofn->Flags |= (OFN_FILEMUSTEXIST);
+ if (m_options->fileMode() == QFileDialogOptions::ExistingFiles)
+ ofn->Flags |= (OFN_ALLOWMULTISELECT);
+ if (!(m_options->options() & QFileDialogOptions::DontConfirmOverwrite))
+ ofn->Flags |= OFN_OVERWRITEPROMPT;
+}
+
+QStringList QWindowsXpNativeFileDialog::execFileNames(HWND owner, int *selectedFilterIndex) const
+{
+ *selectedFilterIndex = -1;
+ OPENFILENAME ofn;
+ populateOpenFileName(&ofn, owner);
+ QStringList result;
+ const bool isSave = m_options->acceptMode() == QFileDialogOptions::AcceptSave;
+ if (isSave ? m_getSaveFileNameW(&ofn) : m_getOpenFileNameW(&ofn)) {
+ *selectedFilterIndex = ofn.nFilterIndex - 1;
+ result.push_back(QDir::cleanPath(QString::fromWCharArray(ofn.lpstrFile)));
+ // For multiselection, the first item is the path followed
+ // by "\0<file1>\0<file2>\0\0".
+ if (ofn.Flags & (OFN_ALLOWMULTISELECT)) {
+ wchar_t *ptr = ofn.lpstrFile + result.front().size() + 1;
+ if (*ptr) {
+ const QString path = result.takeAt(0) + QLatin1Char('/');
+ while (*ptr) {
+ const QString fileName = QString::fromWCharArray(ptr);
+ result.push_back(path + fileName);
+ ptr += fileName.size() + 1;
+ } // extract multiple files
+ } // has multiple files
+ } // multiple flag set
+ }
+ delete [] ofn.lpstrFile;
+ delete [] ofn.lpstrInitialDir;
+ delete [] ofn.lpstrFilter;
+ delete [] ofn.lpstrDefExt;
+ return result;
+}
+
+/*!
+ \class QWindowsXpFileDialogHelper
+ \brief Dialog helper using QWindowsXpNativeFileDialog
+
+ \sa QWindowsXpNativeFileDialog
+ \internal
+ \ingroup qt-lighthouse-win
+*/
+
+class QWindowsXpFileDialogHelper : public QWindowsDialogHelperBase<QPlatformFileDialogHelper>
+{
+public:
+ QWindowsXpFileDialogHelper() {}
+ virtual bool supportsNonModalDialog() const { return false; }
+
+ virtual bool defaultNameFilterDisables() const
+ { return true; }
+ virtual void setDirectory(const QString &directory);
+ virtual QString directory() const;
+ virtual void selectFile(const QString &filename);
+ virtual QStringList selectedFiles() const;
+ virtual void setFilter() {}
+ virtual void setNameFilters(const QStringList &);
+ virtual void selectNameFilter(const QString &);
+ virtual QString selectedNameFilter() const;
+
+private:
+ virtual QWindowsNativeDialogBase *createNativeDialog();
+ inline QWindowsXpNativeFileDialog *nativeFileDialog() const
+ { return static_cast<QWindowsXpNativeFileDialog *>(nativeDialog()); }
+};
+
+QWindowsNativeDialogBase *QWindowsXpFileDialogHelper::createNativeDialog()
+{
+ if (QWindowsNativeDialogBase *result = QWindowsXpNativeFileDialog::create(options())) {
+ QObject::connect(result, SIGNAL(accepted()), this, SIGNAL(accept()));
+ QObject::connect(result, SIGNAL(rejected()), this, SIGNAL(reject()));
+ return result;
+ }
+ return 0;
+}
+
+void QWindowsXpFileDialogHelper::setDirectory(const QString &directory)
+{
+ if (QWindowsXpNativeFileDialog *nfd = nativeFileDialog())
+ nfd->setDirectory(directory);
+}
+
+QString QWindowsXpFileDialogHelper::directory() const
+{
+ if (const QWindowsXpNativeFileDialog *nfd = nativeFileDialog())
+ return nfd->directory();
+ return QString();
+}
+
+void QWindowsXpFileDialogHelper::selectFile(const QString &filename)
+{
+ if (QWindowsXpNativeFileDialog *nfd = nativeFileDialog())
+ nfd->selectFile(filename);
+}
+
+QStringList QWindowsXpFileDialogHelper::selectedFiles() const
+{
+ if (const QWindowsXpNativeFileDialog *nfd = nativeFileDialog())
+ return nfd->selectedFiles();
+ return QStringList();
+}
+
+void QWindowsXpFileDialogHelper::setNameFilters(const QStringList &n)
+{
+ if (QWindowsXpNativeFileDialog *nfd = nativeFileDialog())
+ nfd->setNameFilters(n);
+}
+
+void QWindowsXpFileDialogHelper::selectNameFilter(const QString &f)
+{
+ if (QWindowsXpNativeFileDialog *nfd = nativeFileDialog())
+ nfd->selectNameFilter(f);
+}
+
+QString QWindowsXpFileDialogHelper::selectedNameFilter() const
+{
+ if (const QWindowsXpNativeFileDialog *nfd = nativeFileDialog())
+ return nfd->selectedNameFilter();
+ return QString();
+}
+
+#endif // Q_OS_WINCE
+
/*!
\class QWindowsNativeColorDialog
\brief Native Windows color dialog.
@@ -1399,10 +1801,11 @@ namespace QWindowsDialogs {
// QWindowsDialogHelperBase creation functions
bool useHelper(QPlatformTheme::DialogType type)
{
+ if (QWindowsIntegration::instance()->options() & QWindowsIntegration::NoNativeDialogs)
+ return false;
switch (type) {
case QPlatformTheme::FileDialog:
- return true;
- break;
+ return QSysInfo::windowsVersion() >= QSysInfo::WV_XP;
case QPlatformTheme::ColorDialog:
#ifdef USE_NATIVE_COLOR_DIALOG
return true;
@@ -1417,9 +1820,20 @@ bool useHelper(QPlatformTheme::DialogType type)
QPlatformDialogHelper *createHelper(QPlatformTheme::DialogType type)
{
+ if (QWindowsIntegration::instance()->options() & QWindowsIntegration::NoNativeDialogs)
+ return 0;
switch (type) {
case QPlatformTheme::FileDialog:
+#ifndef Q_OS_WINCE
+ if (QWindowsIntegration::instance()->options() & QWindowsIntegration::XpNativeDialogs
+ || QSysInfo::windowsVersion() == QSysInfo::WV_XP) {
+ return new QWindowsXpFileDialogHelper();
+ }
+ if (QSysInfo::windowsVersion() > QSysInfo::WV_XP)
+ return new QWindowsFileDialogHelper();
+#else
return new QWindowsFileDialogHelper();
+#endif // Q_OS_WINCE
case QPlatformTheme::ColorDialog:
#ifdef USE_NATIVE_COLOR_DIALOG
return new QWindowsColorDialogHelper();
diff --git a/src/plugins/platforms/windows/qwindowsdrag.cpp b/src/plugins/platforms/windows/qwindowsdrag.cpp
index f74b2140f6..805046c715 100644
--- a/src/plugins/platforms/windows/qwindowsdrag.cpp
+++ b/src/plugins/platforms/windows/qwindowsdrag.cpp
@@ -301,9 +301,15 @@ public:
STDMETHOD(GiveFeedback)(DWORD dwEffect);
private:
- typedef QMap <Qt::DropAction, HCURSOR> ActionCursorMap;
-
- inline void clearCursors();
+ class DragCursorHandle {
+ Q_DISABLE_COPY(DragCursorHandle)
+ public:
+ DragCursorHandle(HCURSOR c, quint64 k) : cursor(c), cacheKey(k) {}
+ ~DragCursorHandle() { DestroyCursor(cursor); }
+ HCURSOR cursor;
+ quint64 cacheKey;
+ };
+ typedef QMap <Qt::DropAction, QSharedPointer<DragCursorHandle> > ActionCursorMap;
QWindowsDrag *m_drag;
Qt::MouseButtons m_currentButtons;
@@ -322,7 +328,7 @@ QWindowsOleDropSource::QWindowsOleDropSource(QWindowsDrag *drag) :
QWindowsOleDropSource::~QWindowsOleDropSource()
{
- clearCursors();
+ m_cursors.clear();
if (QWindowsContext::verboseOLE)
qDebug("%s", __FUNCTION__);
}
@@ -347,10 +353,14 @@ void QWindowsOleDropSource::createCursors()
QPixmap cpm = drag->dragCursor(action);
if (cpm.isNull())
cpm = m_drag->defaultCursor(action);
+ QSharedPointer<DragCursorHandle> cursorHandler = m_cursors.value(action);
+ if (!cursorHandler.isNull() && cpm.cacheKey() == cursorHandler->cacheKey)
+ continue;
if (cpm.isNull()) {
qWarning("%s: Unable to obtain drag cursor for %d.", __FUNCTION__, action);
continue;
}
+
int w = cpm.width();
int h = cpm.height();
@@ -380,23 +390,14 @@ void QWindowsOleDropSource::createCursors()
const int hotX = hasPixmap ? qMax(0,newHotSpot.x()) : 0;
const int hotY = hasPixmap ? qMax(0,newHotSpot.y()) : 0;
- if (const HCURSOR sysCursor = QWindowsCursor::createPixmapCursor(newCursor, hotX, hotY))
- m_cursors.insert(actions.at(cnum), sysCursor);
+ if (const HCURSOR sysCursor = QWindowsCursor::createPixmapCursor(newCursor, hotX, hotY)) {
+ m_cursors.insert(action, QSharedPointer<DragCursorHandle>(new DragCursorHandle(sysCursor, cpm.cacheKey())));
+ }
}
if (QWindowsContext::verboseOLE)
qDebug("%s %d cursors", __FUNCTION__, m_cursors.size());
}
-void QWindowsOleDropSource::clearCursors()
-{
- if (!m_cursors.isEmpty()) {
- const ActionCursorMap::const_iterator cend = m_cursors.constEnd();
- for (ActionCursorMap::const_iterator it = m_cursors.constBegin(); it != cend; ++it)
- DestroyCursor(it.value());
- m_cursors.clear();
- }
-}
-
//---------------------------------------------------------------------
// IUnknown Methods
//---------------------------------------------------------------------
@@ -488,9 +489,14 @@ QWindowsOleDropSource::GiveFeedback(DWORD dwEffect)
if (QWindowsContext::verboseOLE > 2)
qDebug("%s dwEffect=%lu, action=%d", __FUNCTION__, dwEffect, action);
+ QSharedPointer<DragCursorHandle> cursorHandler = m_cursors.value(action);
+ quint64 currentCacheKey = m_drag->currentDrag()->dragCursor(action).cacheKey();
+ if (cursorHandler.isNull() || currentCacheKey != cursorHandler->cacheKey)
+ createCursors();
+
const ActionCursorMap::const_iterator it = m_cursors.constFind(action);
if (it != m_cursors.constEnd()) {
- SetCursor(it.value());
+ SetCursor(it.value()->cursor);
return ResultFromScode(S_OK);
}
@@ -595,6 +601,9 @@ QT_ENSURE_STACK_ALIGNED_FOR_SSE STDMETHODIMP
QWindowsOleDropTarget::DragEnter(LPDATAOBJECT pDataObj, DWORD grfKeyState,
POINTL pt, LPDWORD pdwEffect)
{
+ if (IDropTargetHelper* dh = QWindowsDrag::instance()->dropHelper())
+ dh->DragEnter(reinterpret_cast<HWND>(m_window->winId()), pDataObj, reinterpret_cast<POINT*>(&pt), *pdwEffect);
+
if (QWindowsContext::verboseOLE)
qDebug("%s widget=%p key=%lu, pt=%ld,%ld", __FUNCTION__, m_window, grfKeyState, pt.x, pt.y);
@@ -608,6 +617,9 @@ QWindowsOleDropTarget::DragEnter(LPDATAOBJECT pDataObj, DWORD grfKeyState,
QT_ENSURE_STACK_ALIGNED_FOR_SSE STDMETHODIMP
QWindowsOleDropTarget::DragOver(DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect)
{
+ if (IDropTargetHelper* dh = QWindowsDrag::instance()->dropHelper())
+ dh->DragOver(reinterpret_cast<POINT*>(&pt), *pdwEffect);
+
QWindow *dragOverWindow = findDragOverWindow(pt);
if (QWindowsContext::verboseOLE)
qDebug("%s widget=%p key=%lu, pt=%ld,%ld", __FUNCTION__, dragOverWindow, grfKeyState, pt.x, pt.y);
@@ -628,6 +640,9 @@ QWindowsOleDropTarget::DragOver(DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect)
QT_ENSURE_STACK_ALIGNED_FOR_SSE STDMETHODIMP
QWindowsOleDropTarget::DragLeave()
{
+ if (IDropTargetHelper* dh = QWindowsDrag::instance()->dropHelper())
+ dh->DragLeave();
+
if (QWindowsContext::verboseOLE)
qDebug().nospace() <<__FUNCTION__ << ' ' << m_window;
@@ -640,9 +655,12 @@ QWindowsOleDropTarget::DragLeave()
#define KEY_STATE_BUTTON_MASK (MK_LBUTTON | MK_MBUTTON | MK_RBUTTON)
QT_ENSURE_STACK_ALIGNED_FOR_SSE STDMETHODIMP
-QWindowsOleDropTarget::Drop(LPDATAOBJECT /*pDataObj*/, DWORD grfKeyState,
+QWindowsOleDropTarget::Drop(LPDATAOBJECT pDataObj, DWORD grfKeyState,
POINTL pt, LPDWORD pdwEffect)
{
+ if (IDropTargetHelper* dh = QWindowsDrag::instance()->dropHelper())
+ dh->Drop(pDataObj, reinterpret_cast<POINT*>(&pt), *pdwEffect);
+
QWindow *dropWindow = findDragOverWindow(pt);
if (QWindowsContext::verboseOLE)
@@ -700,6 +718,7 @@ QWindowsOleDropTarget::Drop(LPDATAOBJECT /*pDataObj*/, DWORD grfKeyState,
return NOERROR;
}
+
/*!
\class QWindowsDrag
\brief Windows drag implementation.
@@ -707,12 +726,15 @@ QWindowsOleDropTarget::Drop(LPDATAOBJECT /*pDataObj*/, DWORD grfKeyState,
\ingroup qt-lighthouse-win
*/
-QWindowsDrag::QWindowsDrag() : m_dropDataObject(0)
+QWindowsDrag::QWindowsDrag() :
+ m_dropDataObject(0), m_cachedDropTargetHelper(0)
{
}
QWindowsDrag::~QWindowsDrag()
{
+ if (m_cachedDropTargetHelper)
+ m_cachedDropTargetHelper->Release();
}
/*!
@@ -726,6 +748,18 @@ QMimeData *QWindowsDrag::dropData()
return &m_dropData;
}
+/*!
+ \brief May be used to handle extended cursors functionality for drags from outside the app.
+*/
+IDropTargetHelper* QWindowsDrag::dropHelper() {
+ if (!m_cachedDropTargetHelper) {
+ CoCreateInstance(CLSID_DragDropHelper, 0, CLSCTX_INPROC_SERVER,
+ IID_IDropTargetHelper,
+ reinterpret_cast<void**>(&m_cachedDropTargetHelper));
+ }
+ return m_cachedDropTargetHelper;
+}
+
QPixmap QWindowsDrag::defaultCursor(Qt::DropAction action) const
{
switch (action) {
diff --git a/src/plugins/platforms/windows/qwindowsdrag.h b/src/plugins/platforms/windows/qwindowsdrag.h
index ab06545884..d3bfd36955 100644
--- a/src/plugins/platforms/windows/qwindowsdrag.h
+++ b/src/plugins/platforms/windows/qwindowsdrag.h
@@ -47,6 +47,8 @@
#include <qpa/qplatformdrag.h>
#include <QtGui/QPixmap>
+struct IDropTargetHelper;
+
QT_BEGIN_NAMESPACE
class QWindowsDropMimeData : public QWindowsInternalMimeData {
public:
@@ -100,12 +102,16 @@ public:
void releaseDropDataObject();
QMimeData *dropData();
+ IDropTargetHelper* dropHelper();
+
QPixmap defaultCursor(Qt::DropAction action) const;
private:
QWindowsDropMimeData m_dropData;
IDataObject *m_dropDataObject;
+ IDropTargetHelper* m_cachedDropTargetHelper;
+
mutable QPixmap m_copyDragCursor;
mutable QPixmap m_moveDragCursor;
mutable QPixmap m_linkDragCursor;
diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp
index b7309c3f7c..a02f0cd494 100644
--- a/src/plugins/platforms/windows/qwindowsintegration.cpp
+++ b/src/plugins/platforms/windows/qwindowsintegration.cpp
@@ -279,6 +279,12 @@ static inline unsigned parseOptions(const QStringList &paramList)
} else if (param.endsWith(QLatin1String("native"))) {
options |= QWindowsIntegration::FontDatabaseNative;
}
+ } else if (param.startsWith(QLatin1String("dialogs="))) {
+ if (param.endsWith(QLatin1String("xp"))) {
+ options |= QWindowsIntegration::XpNativeDialogs;
+ } else if (param.endsWith(QLatin1String("none"))) {
+ options |= QWindowsIntegration::NoNativeDialogs;
+ }
} else if (param == QLatin1String("gl=gdi")) {
options |= QWindowsIntegration::DisableArb;
}
@@ -332,6 +338,8 @@ bool QWindowsIntegration::hasCapability(QPlatformIntegration::Capability cap) co
#endif // !QT_NO_OPENGL
case WindowMasks:
return true;
+ case MultipleWindows:
+ return true;
default:
return QPlatformIntegration::hasCapability(cap);
}
diff --git a/src/plugins/platforms/windows/qwindowsintegration.h b/src/plugins/platforms/windows/qwindowsintegration.h
index ca47dabb4b..abf663c052 100644
--- a/src/plugins/platforms/windows/qwindowsintegration.h
+++ b/src/plugins/platforms/windows/qwindowsintegration.h
@@ -56,7 +56,9 @@ public:
enum Options { // Options to be passed on command line.
FontDatabaseFreeType = 0x1,
FontDatabaseNative = 0x2,
- DisableArb = 0x4
+ DisableArb = 0x4,
+ NoNativeDialogs = 0x8,
+ XpNativeDialogs = 0x10
};
explicit QWindowsIntegration(const QStringList &paramList);
diff --git a/src/plugins/platforms/windows/qwindowstheme.cpp b/src/plugins/platforms/windows/qwindowstheme.cpp
index d9de911914..2fb905d23b 100644
--- a/src/plugins/platforms/windows/qwindowstheme.cpp
+++ b/src/plugins/platforms/windows/qwindowstheme.cpp
@@ -509,6 +509,7 @@ QPixmap QWindowsTheme::standardPixmap(StandardPixmap sp, const QSizeF &size) con
case TrashIcon:
resourceId = 191;
break;
+#ifndef Q_OS_WINCE
case MessageBoxInformation:
iconName = IDI_INFORMATION;
break;
@@ -538,6 +539,7 @@ QPixmap QWindowsTheme::standardPixmap(StandardPixmap sp, const QSizeF &size) con
}
}
break;
+#endif
default:
break;
}
diff --git a/src/plugins/platforms/windows/windows.pro b/src/plugins/platforms/windows/windows.pro
index 1527f0e496..ca356e1276 100644
--- a/src/plugins/platforms/windows/windows.pro
+++ b/src/plugins/platforms/windows/windows.pro
@@ -1,4 +1,6 @@
TARGET = windows
+
+PLUGIN_TYPE = platforms
load(qt_plugin)
QT *= core-private
@@ -6,7 +8,6 @@ QT *= gui-private
QT *= platformsupport-private
INCLUDEPATH += ../../../3rdparty/harfbuzz/src
-QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms
# Note: OpenGL32 must precede Gdi32 as it overwrites some functions.
LIBS *= -lole32
@@ -172,6 +173,3 @@ contains(QT_CONFIG, freetype) {
OTHER_FILES += windows.json
contains(QT_CONFIG, accessibility):include(accessible/accessible.pri)
-
-target.path += $$[QT_INSTALL_PLUGINS]/platforms
-INSTALLS += target
diff --git a/src/plugins/platforms/xcb/qxcbcursor.cpp b/src/plugins/platforms/xcb/qxcbcursor.cpp
index 0510c1db5b..c1cfbd02d6 100644
--- a/src/plugins/platforms/xcb/qxcbcursor.cpp
+++ b/src/plugins/platforms/xcb/qxcbcursor.cpp
@@ -508,16 +508,16 @@ xcb_cursor_t QXcbCursor::createBitmapCursor(QCursor *cursor)
return c;
}
-void QXcbCursor::queryPointer(xcb_connection_t *conn, xcb_window_t *rootWin, QPoint *pos, int *keybMask)
+void QXcbCursor::queryPointer(QXcbConnection *c, xcb_window_t *rootWin, QPoint *pos, int *keybMask)
{
if (pos)
*pos = QPoint();
- xcb_screen_iterator_t it = xcb_setup_roots_iterator(xcb_get_setup(conn));
+ 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(conn, 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(conn, cookie, &err);
+ 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);
@@ -537,17 +537,16 @@ void QXcbCursor::queryPointer(xcb_connection_t *conn, xcb_window_t *rootWin, QPo
QPoint QXcbCursor::pos() const
{
QPoint p;
- queryPointer(xcb_connection(), 0, &p);
+ queryPointer(connection(), 0, &p);
return p;
}
void QXcbCursor::setPos(const QPoint &pos)
{
- xcb_connection_t *conn = xcb_connection();
xcb_window_t root;
- queryPointer(conn, &root, 0);
- xcb_warp_pointer(conn, XCB_NONE, root, 0, 0, 0, 0, pos.x(), pos.y());
- xcb_flush(conn);
+ queryPointer(connection(), &root, 0);
+ xcb_warp_pointer(xcb_connection(), XCB_NONE, root, 0, 0, 0, 0, pos.x(), pos.y());
+ xcb_flush(xcb_connection());
}
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/xcb/qxcbcursor.h b/src/plugins/platforms/xcb/qxcbcursor.h
index 9726c5955a..4c74034988 100644
--- a/src/plugins/platforms/xcb/qxcbcursor.h
+++ b/src/plugins/platforms/xcb/qxcbcursor.h
@@ -56,7 +56,7 @@ public:
QPoint pos() const;
void setPos(const QPoint &pos);
- static void queryPointer(xcb_connection_t *conn, xcb_window_t *rootWin, QPoint *pos, int *keybMask = 0);
+ static void queryPointer(QXcbConnection *c, xcb_window_t *rootWin, QPoint *pos, int *keybMask = 0);
private:
xcb_cursor_t createFontCursor(int cshape);
diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp
index 5170ff9e10..2ffe53c04b 100644
--- a/src/plugins/platforms/xcb/qxcbintegration.cpp
+++ b/src/plugins/platforms/xcb/qxcbintegration.cpp
@@ -216,6 +216,7 @@ bool QXcbIntegration::hasCapability(QPlatformIntegration::Capability cap) const
#endif
case ThreadedOpenGL: return false;
case WindowMasks: return true;
+ case MultipleWindows: return true;
default: return QPlatformIntegration::hasCapability(cap);
}
}
@@ -275,8 +276,8 @@ QPlatformServices *QXcbIntegration::services() const
Qt::KeyboardModifiers QXcbIntegration::queryKeyboardModifiers() const
{
int keybMask = 0;
- QXcbConnection* conn = m_connections.at(0);
- QXcbCursor::queryPointer(conn->xcb_connection(), 0, 0, &keybMask);
+ QXcbConnection *conn = m_connections.at(0);
+ QXcbCursor::queryPointer(conn, 0, 0, &keybMask);
return conn->keyboard()->translateModifiers(keybMask);
}
diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp
index 2a36fb7369..fa5f5f43d0 100644
--- a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp
+++ b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp
@@ -53,6 +53,8 @@
#if defined(XCB_USE_EGL)
#include "QtPlatformSupport/private/qeglplatformcontext_p.h"
+#elif defined (XCB_USE_GLX)
+#include "qglxintegration.h"
#endif
QT_BEGIN_NAMESPACE
@@ -68,6 +70,7 @@ public:
insert("connection",QXcbNativeInterface::Connection);
insert("screen",QXcbNativeInterface::Screen);
insert("eglcontext",QXcbNativeInterface::EglContext);
+ insert("glxcontext",QXcbNativeInterface::GLXContext);
}
};
@@ -91,6 +94,9 @@ void *QXcbNativeInterface::nativeResourceForContext(const QByteArray &resourceSt
case EglContext:
result = eglContextForContext(context);
break;
+ case GLXContext:
+ result = glxContextForContext(context);
+ break;
default:
break;
}
@@ -191,4 +197,17 @@ void * QXcbNativeInterface::eglContextForContext(QOpenGLContext *context)
#endif
}
+void *QXcbNativeInterface::glxContextForContext(QOpenGLContext *context)
+{
+ Q_ASSERT(context);
+#if defined(XCB_USE_GLX)
+ QGLXContext *glxPlatformContext = static_cast<QGLXContext *>(context->handle());
+ return glxPlatformContext->glxContext();
+#else
+ Q_UNUSED(context);
+ return 0;
+#endif
+
+}
+
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.h b/src/plugins/platforms/xcb/qxcbnativeinterface.h
index 1223fdc39c..c15d00255a 100644
--- a/src/plugins/platforms/xcb/qxcbnativeinterface.h
+++ b/src/plugins/platforms/xcb/qxcbnativeinterface.h
@@ -58,7 +58,8 @@ public:
Connection,
Screen,
GraphicsDevice,
- EglContext
+ EglContext,
+ GLXContext
};
QXcbNativeInterface();
@@ -76,6 +77,7 @@ public:
void *screenForWindow(QWindow *window);
void *graphicsDeviceForWindow(QWindow *window);
static void *eglContextForContext(QOpenGLContext *context);
+ static void *glxContextForContext(QOpenGLContext *context);
private:
const QByteArray m_genericEventFilterType;
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index 48754b0a60..eab18e2435 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -542,16 +542,18 @@ void QXcbWindow::show()
propagateSizeHints();
// update WM_TRANSIENT_FOR
- if (window()->transientParent() && isTransient(window())) {
- QXcbWindow *transientXcbParent = static_cast<QXcbWindow *>(window()->transientParent()->handle());
- if (transientXcbParent) {
- // ICCCM 4.1.2.6
- xcb_window_t parentWindow = transientXcbParent->xcb_window();
-
- // todo: set transient for group (wm_client_leader) if no parent, a la qwidget_x11.cpp
+ if (isTransient(window())) {
+ xcb_window_t transientXcbParent = 0;
+ if (const QWindow *tp = window()->transientParent())
+ transientXcbParent = static_cast<const QXcbWindow *>(tp->handle())->winId();
+ // Default to client leader if there is no transient parent, else modal dialogs can
+ // be hidden by their parents.
+ if (!transientXcbParent)
+ transientXcbParent = static_cast<QXcbScreen *>(screen())->clientLeader();
+ if (transientXcbParent) { // ICCCM 4.1.2.6
Q_XCB_CALL(xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, m_window,
XCB_ATOM_WM_TRANSIENT_FOR, XCB_ATOM_WINDOW, 32,
- 1, &parentWindow));
+ 1, &transientXcbParent));
}
}
diff --git a/src/plugins/platforms/xcb/xcb.pro b/src/plugins/platforms/xcb/xcb.pro
index 58521686aa..34f7c74675 100644
--- a/src/plugins/platforms/xcb/xcb.pro
+++ b/src/plugins/platforms/xcb/xcb.pro
@@ -1,7 +1,7 @@
TARGET = xcb
+PLUGIN_TYPE = platforms
load(qt_plugin)
-QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms
QT += core-private gui-private platformsupport-private
@@ -110,6 +110,3 @@ LIBS += -ldbus-1
}
OTHER_FILES += xcb.json
-
-target.path += $$[QT_INSTALL_PLUGINS]/platforms
-INSTALLS += target
diff --git a/src/plugins/printsupport/cocoa/cocoa.pro b/src/plugins/printsupport/cocoa/cocoa.pro
index 477715a8e2..4e99b4a8f5 100644
--- a/src/plugins/printsupport/cocoa/cocoa.pro
+++ b/src/plugins/printsupport/cocoa/cocoa.pro
@@ -1,6 +1,7 @@
TARGET = cocoaprintersupport
+
+PLUGIN_TYPE = printsupport
load(qt_plugin)
-DESTDIR = $$QT.gui.plugins/printsupport
QT += gui-private printsupport-private
LIBS += -framework Cocoa
@@ -8,6 +9,3 @@ LIBS += -framework Cocoa
SOURCES += main.cpp
OTHER_FILES += cocoa.json
-
-target.path += $$[QT_INSTALL_PLUGINS]/printsupport
-INSTALLS += target
diff --git a/src/plugins/printsupport/cups/cups.pro b/src/plugins/printsupport/cups/cups.pro
index f23ad3fb5e..bd0b6af114 100644
--- a/src/plugins/printsupport/cups/cups.pro
+++ b/src/plugins/printsupport/cups/cups.pro
@@ -1,6 +1,7 @@
TARGET = cupsprintersupport
+
+PLUGIN_TYPE = printsupport
load(qt_plugin)
-DESTDIR = $$QT.gui.plugins/printsupport
QT += core-private gui-private printsupport printsupport-private
@@ -14,6 +15,3 @@ HEADERS += qcupsprintersupport_p.h \
qcupsprintengine_p.h
OTHER_FILES += cups.json
-
-target.path += $$[QT_INSTALL_PLUGINS]/printsupport
-INSTALLS += target
diff --git a/src/plugins/printsupport/windows/windows.pro b/src/plugins/printsupport/windows/windows.pro
index 3c5f22d411..5e8738554c 100644
--- a/src/plugins/printsupport/windows/windows.pro
+++ b/src/plugins/printsupport/windows/windows.pro
@@ -1,11 +1,12 @@
-TARGET = windows
+TARGET = windowsprintersupport
+
+PLUGIN_TYPE = printsupport
load(qt_plugin)
QT *= core-private
QT *= gui-private
QT *= printsupport-private
-QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/printsupport
INCLUDEPATH *= $$QT_SOURCE_TREE/src/printsupport/kernel
SOURCES += \
@@ -17,6 +18,4 @@ HEADERS += \
OTHER_FILES += windows.json
-target.path += $$[QT_INSTALL_PLUGINS]/printsupport
-INSTALLS += target
LIBS += -lwinspool -lcomdlg32
diff --git a/src/plugins/qpluginbase.pri b/src/plugins/qpluginbase.pri
deleted file mode 100644
index b22a527761..0000000000
--- a/src/plugins/qpluginbase.pri
+++ /dev/null
@@ -1 +0,0 @@
-load(qt_plugin)
diff --git a/src/plugins/sqldrivers/qsqldriverbase.pri b/src/plugins/sqldrivers/qsqldriverbase.pri
index 45638fcd4f..17424f6764 100644
--- a/src/plugins/sqldrivers/qsqldriverbase.pri
+++ b/src/plugins/sqldrivers/qsqldriverbase.pri
@@ -1,8 +1,6 @@
-load(qt_plugin)
QT = core sql-private
-DESTDIR = $$QT.sql.plugins/sqldrivers
-target.path += $$[QT_INSTALL_PLUGINS]/sqldrivers
-INSTALLS += target
+PLUGIN_TYPE = sqldrivers
+load(qt_plugin)
DEFINES += QT_NO_CAST_TO_ASCII QT_NO_CAST_FROM_ASCII
diff --git a/src/printsupport/kernel/qprintengine_pdf.cpp b/src/printsupport/kernel/qprintengine_pdf.cpp
index 3e343176ba..c4bcb697f5 100644
--- a/src/printsupport/kernel/qprintengine_pdf.cpp
+++ b/src/printsupport/kernel/qprintengine_pdf.cpp
@@ -213,6 +213,7 @@ void QPdfPrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &va
d->topMargin = margins.at(1).toReal();
d->rightMargin = margins.at(2).toReal();
d->bottomMargin = margins.at(3).toReal();
+ d->pageMarginsSet = true;
break;
}
default:
@@ -298,8 +299,11 @@ QVariant QPdfPrintEngine::property(PrintEnginePropertyKey key) const
case PPK_PageMargins:
{
QList<QVariant> margins;
- margins << d->leftMargin << d->topMargin
- << d->rightMargin << d->bottomMargin;
+ if (d->printerPaperSize == QPrinter::Custom && !d->pageMarginsSet)
+ margins << 0 << 0 << 0 << 0;
+ else
+ margins << d->leftMargin << d->topMargin
+ << d->rightMargin << d->bottomMargin;
ret = margins;
break;
}
@@ -353,6 +357,7 @@ QPdfPrintEnginePrivate::QPdfPrintEnginePrivate(QPrinter::PrinterMode m)
pageOrder(QPrinter::FirstPageFirst),
paperSource(QPrinter::Auto),
printerPaperSize(QPrinter::A4),
+ pageMarginsSet(false),
fd(-1)
{
resolution = 72;
diff --git a/src/printsupport/kernel/qprintengine_pdf_p.h b/src/printsupport/kernel/qprintengine_pdf_p.h
index 36df233f72..2d70c4619e 100644
--- a/src/printsupport/kernel/qprintengine_pdf_p.h
+++ b/src/printsupport/kernel/qprintengine_pdf_p.h
@@ -151,7 +151,7 @@ private:
QPrinter::PaperSize printerPaperSize;
QSizeF customPaperSize; // in postscript points
-
+ bool pageMarginsSet;
int fd;
};
diff --git a/src/printsupport/kernel/qprintengine_win.cpp b/src/printsupport/kernel/qprintengine_win.cpp
index 28e0363d6e..200b5fd102 100644
--- a/src/printsupport/kernel/qprintengine_win.cpp
+++ b/src/printsupport/kernel/qprintengine_win.cpp
@@ -1540,13 +1540,17 @@ QVariant QWin32PrintEngine::property(PrintEnginePropertyKey key) const
case PPK_PageMargins:
{
QList<QVariant> margins;
- QRect pageMargins(d->getPageMargins());
+ if (d->has_custom_paper_size && !d->pageMarginsSet) {
+ margins << 0 << 0 << 0 << 0;
+ } else {
+ QRect pageMargins(d->getPageMargins());
- // specified in 1/100 mm
- margins << (mmToInches(pageMargins.left()/100.0) * 72)
- << (mmToInches(pageMargins.top()/100.0) * 72)
- << (mmToInches(pageMargins.width()/100.0) * 72)
- << (mmToInches(pageMargins.height()/100.0) * 72);
+ // specified in 1/100 mm
+ margins << (mmToInches(pageMargins.left()/100.0) * 72)
+ << (mmToInches(pageMargins.top()/100.0) * 72)
+ << (mmToInches(pageMargins.width()/100.0) * 72)
+ << (mmToInches(pageMargins.height()/100.0) * 72);
+ }
value = margins;
break;
}
diff --git a/src/sql/kernel/qsql.qdoc b/src/sql/kernel/qsql.qdoc
index 3b0e848af1..b3afe82245 100644
--- a/src/sql/kernel/qsql.qdoc
+++ b/src/sql/kernel/qsql.qdoc
@@ -31,7 +31,6 @@
\brief The QSql namespace contains miscellaneous identifiers used throughout
the Qt SQL library.
- \inheaderfile QtSql
\ingroup database
diff --git a/src/sql/models/qsqlrelationaldelegate.h b/src/sql/models/qsqlrelationaldelegate.h
index 439dde2662..52a19dbb0a 100644
--- a/src/sql/models/qsqlrelationaldelegate.h
+++ b/src/sql/models/qsqlrelationaldelegate.h
@@ -82,17 +82,6 @@ QWidget *createEditor(QWidget *aParent,
return combo;
}
-void setEditorData(QWidget *editor, const QModelIndex &index) const
-{
- const QSqlRelationalTableModel *sqlModel = qobject_cast<const QSqlRelationalTableModel *>(index.model());
- QComboBox *combo = qobject_cast<QComboBox *>(editor);
- if (!sqlModel || !combo) {
- QItemDelegate::setEditorData(editor, index);
- return;
- }
- combo->setCurrentIndex(combo->findText(sqlModel->data(index).toString()));
-}
-
void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
{
if (!index.isValid())
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp
index 729ae49aaf..55e6f9b622 100644
--- a/src/testlib/qtestcase.cpp
+++ b/src/testlib/qtestcase.cpp
@@ -1202,12 +1202,15 @@ Q_TESTLIB_EXPORT bool printAvailableFunctions = false;
Q_TESTLIB_EXPORT QStringList testFunctions;
Q_TESTLIB_EXPORT QStringList testTags;
-static void qPrintTestSlots(FILE *stream)
+static void qPrintTestSlots(FILE *stream, const char *filter = 0)
{
for (int i = 0; i < QTest::currentTestObject->metaObject()->methodCount(); ++i) {
QMetaMethod sl = QTest::currentTestObject->metaObject()->method(i);
- if (isValidSlot(sl))
- fprintf(stream, "%s\n", sl.methodSignature().constData());
+ if (isValidSlot(sl)) {
+ const QByteArray signature = sl.methodSignature();
+ if (!filter || QString::fromLatin1(signature).contains(QLatin1String(filter), Qt::CaseInsensitive))
+ fprintf(stream, "%s\n", signature.constData());
+ }
}
}
@@ -1569,9 +1572,10 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, char *argv[], bool qml)
qsnprintf(buf + off, qMin(512 - off, 3), "()"); // append "()"
int idx = QTest::currentTestObject->metaObject()->indexOfMethod(buf);
if (idx < 0 || !isValidSlot(QTest::currentTestObject->metaObject()->method(idx))) {
- fprintf(stderr, "Unknown testfunction: '%s'\n", buf);
- fprintf(stderr, "Available testfunctions:\n");
- qPrintTestSlots(stderr);
+ fprintf(stderr, "Unknown test function: '%s'. Possible matches:\n", buf);
+ buf[off] = 0;
+ qPrintTestSlots(stderr, buf);
+ fprintf(stderr, "\n%s -functions\nlists all available test functions.\n", argv[0]);
exit(1);
}
testFuncs[testFuncCount].set(idx, data);
diff --git a/src/testlib/qtestlog.cpp b/src/testlib/qtestlog.cpp
index c56a00237b..a337a81959 100644
--- a/src/testlib/qtestlog.cpp
+++ b/src/testlib/qtestlog.cpp
@@ -238,6 +238,12 @@ namespace QTest {
return false;
}
+// don't warn about qInstallMsgHandler
+#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 406) && !defined(Q_CC_INTEL)
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
+
static void messageHandler(QtMsgType type, const char *msg)
{
static QBasicAtomicInt counter = Q_BASIC_ATOMIC_INITIALIZER(QTest::maxWarnings);
@@ -287,6 +293,10 @@ namespace QTest {
break;
}
}
+
+#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 406) && !defined(Q_CC_INTEL)
+# pragma GCC diagnostic pop
+#endif
}
void QTestLog::enterTestFunction(const char* function)
diff --git a/src/testlib/qtestsystem.h b/src/testlib/qtestsystem.h
index 2f3f499d47..094570bb8c 100644
--- a/src/testlib/qtestsystem.h
+++ b/src/testlib/qtestsystem.h
@@ -45,7 +45,9 @@
#include <QtTest/qtestcase.h>
#include <QtCore/qcoreapplication.h>
#include <QtCore/qelapsedtimer.h>
-#include <QtGui/QWindow>
+#ifdef QT_GUI_LIB
+# include <QtGui/QWindow>
+#endif
#ifdef QT_WIDGETS_LIB
# include <QtWidgets/QWidget>
#endif
@@ -69,6 +71,7 @@ namespace QTest
} while (timer.elapsed() < ms);
}
+#ifdef QT_GUI_LIB
inline static bool qWaitForWindowActive(QWindow *window, int timeout = 1000)
{
QElapsedTimer timer;
@@ -112,6 +115,7 @@ namespace QTest
}
return window->isExposed();
}
+#endif
#ifdef QT_WIDGETS_LIB
inline static bool qWaitForWindowActive(QWidget *widget, int timeout = 1000)
diff --git a/src/tools/bootstrap/bootstrap.pri b/src/tools/bootstrap/bootstrap.pri
index 7d3b9969fe..2b64b291b9 100644
--- a/src/tools/bootstrap/bootstrap.pri
+++ b/src/tools/bootstrap/bootstrap.pri
@@ -7,7 +7,6 @@ CONFIG += exceptions_off
DEFINES += \
QT_BOOTSTRAPPED \
QT_LITE_UNICODE \
- QT_TEXTCODEC \
QT_NO_CAST_FROM_ASCII \
QT_NO_CAST_TO_ASCII \
QT_NO_CODECS \
diff --git a/src/tools/bootstrap/bootstrap.pro b/src/tools/bootstrap/bootstrap.pro
index 19c0005bcc..07c4a10573 100644
--- a/src/tools/bootstrap/bootstrap.pro
+++ b/src/tools/bootstrap/bootstrap.pro
@@ -114,6 +114,7 @@ macx: {
../../corelib/kernel/qcore_mac.cpp
LIBS += -framework CoreServices
}
+*-g++*: QMAKE_CXXFLAGS += -ffunction-sections
if(contains(QT_CONFIG, zlib)|cross_compile):include(../../3rdparty/zlib.pri)
else:include(../../3rdparty/zlib_dependency.pri)
diff --git a/src/tools/rcc/rcc.cpp b/src/tools/rcc/rcc.cpp
index 10d7c093fc..969b644d84 100644
--- a/src/tools/rcc/rcc.cpp
+++ b/src/tools/rcc/rcc.cpp
@@ -535,7 +535,7 @@ bool RCCResourceLibrary::interpretResourceFile(QIODevice *inputDevice,
child,
language,
country,
- RCCFileInfo::NoFlags,
+ child.isDir() ? RCCFileInfo::Directory : RCCFileInfo::NoFlags,
compressLevel,
compressThreshold)
);
diff --git a/src/widgets/dialogs/qdialog.cpp b/src/widgets/dialogs/qdialog.cpp
index 261039009c..7b47f4e135 100644
--- a/src/widgets/dialogs/qdialog.cpp
+++ b/src/widgets/dialogs/qdialog.cpp
@@ -516,11 +516,6 @@ int QDialog::exec()
setAttribute(Qt::WA_ShowModal, true);
setResult(0);
- bool showSystemDialogFullScreen = false;
- if (showSystemDialogFullScreen) {
- setWindowFlags(windowFlags() | Qt::WindowSoftkeysVisibleHint);
- setWindowState(Qt::WindowFullScreen);
- }
show();
QPointer<QDialog> guard = this;
diff --git a/src/widgets/dialogs/qerrormessage.cpp b/src/widgets/dialogs/qerrormessage.cpp
index a7c257b300..fa240ccaf3 100644
--- a/src/widgets/dialogs/qerrormessage.cpp
+++ b/src/widgets/dialogs/qerrormessage.cpp
@@ -66,10 +66,6 @@ extern bool qt_wince_is_mobile(); //defined in qguifunctions_wince.cpp
extern bool qt_wince_is_high_dpi(); //defined in qguifunctions_wince.cpp
#endif
-#if defined(QT_SOFTKEYS_ENABLED)
-#include <qaction.h>
-#endif
-
QT_BEGIN_NAMESPACE
class QErrorMessagePrivate : public QDialogPrivate
@@ -80,9 +76,6 @@ public:
QCheckBox * again;
QTextEdit * errors;
QLabel * icon;
-#ifdef QT_SOFTKEYS_ENABLED
- QAction *okAction;
-#endif
QQueue<QPair<QString, QString> > pending;
QSet<QString> doNotShow;
QSet<QString> doNotShowType;
@@ -245,12 +238,6 @@ QErrorMessage::QErrorMessage(QWidget * parent)
d->again->setChecked(true);
grid->addWidget(d->again, 1, 1, Qt::AlignTop);
d->ok = new QPushButton(this);
-#ifdef QT_SOFTKEYS_ENABLED
- d->okAction = new QAction(d->ok);
- d->okAction->setSoftKeyRole(QAction::PositiveSoftKey);
- connect(d->okAction, SIGNAL(triggered()), this, SLOT(accept()));
- addAction(d->okAction);
-#endif
#if defined(Q_OS_WINCE)
@@ -402,9 +389,6 @@ void QErrorMessagePrivate::retranslateStrings()
{
again->setText(QErrorMessage::tr("&Show this message again"));
ok->setText(QErrorMessage::tr("&OK"));
-#ifdef QT_SOFTKEYS_ENABLED
- okAction->setText(ok->text());
-#endif
}
QT_END_NAMESPACE
diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp
index d9d318765d..9a2e32b631 100644
--- a/src/widgets/dialogs/qfiledialog.cpp
+++ b/src/widgets/dialogs/qfiledialog.cpp
@@ -552,7 +552,7 @@ void QFileDialogPrivate::helperPrepareShow(QPlatformDialogHelper *)
directory.absolutePath() :
QString());
options->setInitiallySelectedNameFilter(q->selectedNameFilter());
- options->setInitiallySelectedFiles(q->selectedFiles());
+ options->setInitiallySelectedFiles(userSelectedFiles());
}
void QFileDialogPrivate::helperDone(QDialog::DialogCode code, QPlatformDialogHelper *)
@@ -1009,6 +1009,24 @@ QStringList QFileDialogPrivate::typedFiles() const
return addDefaultSuffixToFiles(files);
}
+// Return selected files without defaulting to the root of the file system model
+// used for initializing QFileDialogOptions for native dialogs. The default is
+// not suitable for native dialogs since it mostly equals directory().
+QStringList QFileDialogPrivate::userSelectedFiles() const
+{
+ if (nativeDialogInUse)
+ return addDefaultSuffixToFiles(selectedFiles_sys());
+
+ QStringList files;
+ foreach (const QModelIndex &index, qFileDialogUi->listView->selectionModel()->selectedRows())
+ files.append(index.data(QFileSystemModel::FilePathRole).toString());
+
+ if (files.isEmpty() && !lineEdit()->text().isEmpty())
+ files = typedFiles();
+
+ return files;
+}
+
QStringList QFileDialogPrivate::addDefaultSuffixToFiles(const QStringList filesToFix) const
{
QStringList files;
@@ -1046,19 +1064,13 @@ QStringList QFileDialogPrivate::addDefaultSuffixToFiles(const QStringList filesT
QStringList QFileDialog::selectedFiles() const
{
Q_D(const QFileDialog);
- if (d->nativeDialogInUse)
- return d->addDefaultSuffixToFiles(d->selectedFiles_sys());
- QModelIndexList indexes = d->qFileDialogUi->listView->selectionModel()->selectedRows();
- QStringList files;
- for (int i = 0; i < indexes.count(); ++i)
- files.append(indexes.at(i).data(QFileSystemModel::FilePathRole).toString());
-
- if (files.isEmpty() && !d->lineEdit()->text().isEmpty())
- files = d->typedFiles();
- const FileMode fm = fileMode();
- if (files.isEmpty() && !(fm == ExistingFile || fm == ExistingFiles))
- files.append(d->rootIndex().data(QFileSystemModel::FilePathRole).toString());
+ QStringList files = d->userSelectedFiles();
+ if (files.isEmpty()) {
+ const FileMode fm = fileMode();
+ if (fm != ExistingFile && fm != ExistingFiles)
+ files.append(d->rootIndex().data(QFileSystemModel::FilePathRole).toString());
+ }
return files;
}
@@ -1201,9 +1213,11 @@ void QFileDialog::selectNameFilter(const QString &filter)
d->selectNameFilter_sys(filter);
return;
}
- int i;
+ int i = -1;
if (testOption(HideNameFilterDetails)) {
- i = d->qFileDialogUi->fileTypeCombo->findText(qt_strip_filters(qt_make_filter_list(filter)).first());
+ const QStringList filters = qt_strip_filters(qt_make_filter_list(filter));
+ if (!filters.isEmpty())
+ i = d->qFileDialogUi->fileTypeCombo->findText(filters.first());
} else {
i = d->qFileDialogUi->fileTypeCombo->findText(filter);
}
@@ -1770,7 +1784,7 @@ QString QFileDialog::getOpenFileName(QWidget *parent,
// create a qt dialog
QFileDialog dialog(args);
- if (selectedFilter)
+ if (selectedFilter && !selectedFilter->isEmpty())
dialog.selectNameFilter(*selectedFilter);
if (dialog.exec() == QDialog::Accepted) {
if (selectedFilter)
@@ -1855,7 +1869,7 @@ QStringList QFileDialog::getOpenFileNames(QWidget *parent,
// create a qt dialog
QFileDialog dialog(args);
- if (selectedFilter)
+ if (selectedFilter && !selectedFilter->isEmpty())
dialog.selectNameFilter(*selectedFilter);
if (dialog.exec() == QDialog::Accepted) {
if (selectedFilter)
@@ -1942,7 +1956,7 @@ QString QFileDialog::getSaveFileName(QWidget *parent,
// create a qt dialog
QFileDialog dialog(args);
dialog.setAcceptMode(AcceptSave);
- if (selectedFilter)
+ if (selectedFilter && !selectedFilter->isEmpty())
dialog.selectNameFilter(*selectedFilter);
if (dialog.exec() == QDialog::Accepted) {
if (selectedFilter)
diff --git a/src/widgets/dialogs/qfiledialog_p.h b/src/widgets/dialogs/qfiledialog_p.h
index b13f36a4d6..592c4a0ac6 100644
--- a/src/widgets/dialogs/qfiledialog_p.h
+++ b/src/widgets/dialogs/qfiledialog_p.h
@@ -128,6 +128,7 @@ public:
static QString workingDirectory(const QString &path);
static QString initialSelection(const QString &path);
QStringList typedFiles() const;
+ QStringList userSelectedFiles() const;
QStringList addDefaultSuffixToFiles(const QStringList filesToFix) const;
bool removeDirectory(const QString &path);
void setLabelTextControl(QFileDialog::DialogLabel label, const QString &text);
diff --git a/src/widgets/dialogs/qprogressdialog.cpp b/src/widgets/dialogs/qprogressdialog.cpp
index fe7aeae558..fbbc4191bc 100644
--- a/src/widgets/dialogs/qprogressdialog.cpp
+++ b/src/widgets/dialogs/qprogressdialog.cpp
@@ -57,10 +57,6 @@
#include <private/qdialog_p.h>
#include <limits.h>
-#if defined(QT_SOFTKEYS_ENABLED)
-#include <qaction.h>
-#endif
-
QT_BEGIN_NAMESPACE
// If the operation is expected to take this long (as predicted by
@@ -81,9 +77,6 @@ public:
#ifndef QT_NO_SHORTCUT
escapeShortcut(0),
#endif
-#ifdef QT_SOFTKEYS_ENABLED
- cancelAction(0),
-#endif
useDefaultCancelText(false)
{
}
@@ -110,9 +103,6 @@ public:
#ifndef QT_NO_SHORTCUT
QShortcut *escapeShortcut;
#endif
-#ifdef QT_SOFTKEYS_ENABLED
- QAction *cancelAction;
-#endif
bool useDefaultCancelText;
QPointer<QObject> receiverToDisconnectOnClose;
QByteArray memberToDisconnectOnClose;
@@ -443,16 +433,7 @@ void QProgressDialog::setCancelButton(QPushButton *cancelButton)
int h = qMax(isVisible() ? height() : 0, sizeHint().height());
resize(w, h);
if (cancelButton)
-#if !defined(QT_SOFTKEYS_ENABLED)
cancelButton->show();
-#else
- {
- d->cancelAction = new QAction(cancelButton->text(), cancelButton);
- d->cancelAction->setSoftKeyRole(QAction::NegativeSoftKey);
- connect(d->cancelAction, SIGNAL(triggered()), this, SIGNAL(canceled()));
- addAction(d->cancelAction);
- }
-#endif
}
/*!
@@ -471,9 +452,6 @@ void QProgressDialog::setCancelButtonText(const QString &cancelButtonText)
if (!cancelButtonText.isNull()) {
if (d->cancel) {
d->cancel->setText(cancelButtonText);
-#ifdef QT_SOFTKEYS_ENABLED
- d->cancelAction->setText(cancelButtonText);
-#endif
} else {
setCancelButton(new QPushButton(cancelButtonText, this));
}
diff --git a/src/widgets/dialogs/qwizard.cpp b/src/widgets/dialogs/qwizard.cpp
index 58aa474368..7f1cb09225 100644
--- a/src/widgets/dialogs/qwizard.cpp
+++ b/src/widgets/dialogs/qwizard.cpp
@@ -75,10 +75,6 @@ extern bool qt_wince_is_mobile(); //defined in qguifunctions_wce.cpp
#include <string.h> // for memset()
-#ifdef QT_SOFTKEYS_ENABLED
-#include "qaction.h"
-#endif
-
QT_BEGIN_NAMESPACE
// These fudge terms were needed a few places to obtain pixel-perfect results
@@ -565,12 +561,9 @@ public:
, maximumWidth(QWIDGETSIZE_MAX)
, maximumHeight(QWIDGETSIZE_MAX)
{
- for (int i = 0; i < QWizard::NButtons; ++i) {
+ for (int i = 0; i < QWizard::NButtons; ++i)
btns[i] = 0;
-#ifdef QT_SOFTKEYS_ENABLED
- softKeys[i] = 0;
-#endif
- }
+
#if !defined(QT_NO_STYLE_WINDOWSVISTA)
if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA
&& (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based))
@@ -657,9 +650,6 @@ public:
QLabel *titleLabel;
QLabel *subTitleLabel;
QWizardRuler *bottomRuler;
-#ifdef QT_SOFTKEYS_ENABLED
- mutable QAction *softKeys[QWizard::NButtons];
-#endif
QVBoxLayout *pageVBoxLayout;
QHBoxLayout *buttonLayout;
@@ -1387,28 +1377,6 @@ bool QWizardPrivate::ensureButton(QWizard::WizardButton which) const
if (which < QWizard::NStandardButtons)
pushButton->setText(buttonDefaultText(wizStyle, which, this));
-#ifdef QT_SOFTKEYS_ENABLED
- QAction *softKey = new QAction(pushButton->text(), pushButton);
- QAction::SoftKeyRole softKeyRole;
- switch(which) {
- case QWizard::NextButton:
- case QWizard::FinishButton:
- case QWizard::CancelButton:
- softKeyRole = QAction::NegativeSoftKey;
- break;
- case QWizard::BackButton:
- case QWizard::CommitButton:
- case QWizard::HelpButton:
- case QWizard::CustomButton1:
- case QWizard::CustomButton2:
- case QWizard::CustomButton3:
- default:
- softKeyRole = QAction::PositiveSoftKey;
- break;
- }
- softKey->setSoftKeyRole(softKeyRole);
- softKeys[which] = softKey;
-#endif
connectButton(which);
}
return true;
@@ -1422,10 +1390,6 @@ void QWizardPrivate::connectButton(QWizard::WizardButton which) const
} else {
QObject::connect(btns[which], SIGNAL(clicked()), q, SLOT(_q_emitCustomButtonClicked()));
}
-
-#ifdef QT_SOFTKEYS_ENABLED
- QObject::connect(softKeys[which], SIGNAL(triggered()), btns[which], SIGNAL(clicked()));
-#endif
}
void QWizardPrivate::updateButtonTexts()
@@ -1439,9 +1403,6 @@ void QWizardPrivate::updateButtonTexts()
btns[i]->setText(buttonCustomTexts.value(i));
else if (i < QWizard::NStandardButtons)
btns[i]->setText(buttonDefaultText(wizStyle, i, this));
-#ifdef QT_SOFTKEYS_ENABLED
- softKeys[i]->setText(btns[i]->text());
-#endif
}
}
}
@@ -1686,19 +1647,6 @@ void QWizardPrivate::_q_updateButtonStates()
}
#endif
-#ifdef QT_SOFTKEYS_ENABLED
- QAbstractButton *wizardButton;
- for (int i = 0; i < QWizard::NButtons; ++i) {
- wizardButton = btns[i];
- if (wizardButton && !wizardButton->testAttribute(Qt::WA_WState_Hidden)) {
- wizardButton->hide();
- q->addAction(softKeys[i]);
- } else {
- q->removeAction(softKeys[i]);
- }
- }
-#endif
-
enableUpdates();
}
diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp
index 8cb6d70d15..0308fb44a9 100644
--- a/src/widgets/itemviews/qabstractitemview.cpp
+++ b/src/widgets/itemviews/qabstractitemview.cpp
@@ -62,7 +62,6 @@
#include <qaccessible.h>
#include <qaccessible2.h>
#endif
-#include <private/qsoftkeymanager_p.h>
#ifndef QT_NO_GESTURE
# include <qscroller.h>
#endif
@@ -95,9 +94,6 @@ QAbstractItemViewPrivate::QAbstractItemViewPrivate()
dropIndicatorPosition(QAbstractItemView::OnItem),
defaultDropAction(Qt::IgnoreAction),
#endif
-#ifdef QT_SOFTKEYS_ENABLED
- doneSoftKey(0),
-#endif
autoScroll(true),
autoScrollMargin(16),
autoScrollCount(0),
@@ -139,10 +135,6 @@ void QAbstractItemViewPrivate::init()
viewport->setBackgroundRole(QPalette::Base);
q->setAttribute(Qt::WA_InputMethodEnabled);
-
-#ifdef QT_SOFTKEYS_ENABLED
- doneSoftKey = QSoftKeyManager::createKeyedAction(QSoftKeyManager::DoneSoftKey, Qt::Key_Back, q);
-#endif
}
void QAbstractItemViewPrivate::setHoverIndex(const QPersistentModelIndex &index)
@@ -1611,11 +1603,6 @@ bool QAbstractItemView::event(QEvent *event)
case QEvent::FontChange:
d->doDelayedItemsLayout(); // the size of the items will change
break;
-#ifdef QT_SOFTKEYS_ENABLED
- case QEvent::LanguageChange:
- d->doneSoftKey->setText(QSoftKeyManager::standardSoftKeyText(QSoftKeyManager::DoneSoftKey));
- break;
-#endif
default:
break;
}
@@ -2197,11 +2184,6 @@ void QAbstractItemView::focusOutEvent(QFocusEvent *event)
Q_D(QAbstractItemView);
QAbstractScrollArea::focusOutEvent(event);
d->viewport->update();
-
-#ifdef QT_SOFTKEYS_ENABLED
- if(!hasEditFocus())
- removeAction(d->doneSoftKey);
-#endif
}
/*!
@@ -2226,23 +2208,12 @@ void QAbstractItemView::keyPressEvent(QKeyEvent *event)
if (QApplication::keypadNavigationEnabled()) {
if (!hasEditFocus()) {
setEditFocus(true);
-#ifdef QT_SOFTKEYS_ENABLED
- // If we can't keypad navigate to any direction, there is no sense to add
- // "Done" softkey, since it basically does nothing when there is
- // only one widget in screen
- if(QWidgetPrivate::canKeypadNavigate(Qt::Horizontal)
- || QWidgetPrivate::canKeypadNavigate(Qt::Vertical))
- addAction(d->doneSoftKey);
-#endif
return;
}
}
break;
case Qt::Key_Back:
if (QApplication::keypadNavigationEnabled() && hasEditFocus()) {
-#ifdef QT_SOFTKEYS_ENABLED
- removeAction(d->doneSoftKey);
-#endif
setEditFocus(false);
} else {
event->ignore();
diff --git a/src/widgets/itemviews/qabstractitemview_p.h b/src/widgets/itemviews/qabstractitemview_p.h
index 5fa658d4b0..99d064ddba 100644
--- a/src/widgets/itemviews/qabstractitemview_p.h
+++ b/src/widgets/itemviews/qabstractitemview_p.h
@@ -402,10 +402,6 @@ public:
Qt::DropAction defaultDropAction;
#endif
-#ifdef QT_SOFTKEYS_ENABLED
- QAction *doneSoftKey;
-#endif
-
QString keyboardInput;
QElapsedTimer keyboardInputTime;
diff --git a/src/widgets/itemviews/qcolumnview.cpp b/src/widgets/itemviews/qcolumnview.cpp
index ec5f2d5655..a320e6134a 100644
--- a/src/widgets/itemviews/qcolumnview.cpp
+++ b/src/widgets/itemviews/qcolumnview.cpp
@@ -365,14 +365,12 @@ QModelIndex QColumnView::moveCursor(CursorAction cursorAction, Qt::KeyboardModif
return (current.parent());
else
return current;
- break;
case MoveRight:
if (model()->hasChildren(current))
return model()->index(0, 0, current);
else
return current.sibling(current.row() + 1, current.column());
- break;
default:
break;
diff --git a/src/widgets/itemviews/qfileiconprovider.cpp b/src/widgets/itemviews/qfileiconprovider.cpp
index 70750c6006..43cf8afb79 100644
--- a/src/widgets/itemviews/qfileiconprovider.cpp
+++ b/src/widgets/itemviews/qfileiconprovider.cpp
@@ -53,10 +53,6 @@
#include <qpa/qplatformtheme.h>
#if defined(Q_OS_WIN)
-#if defined(_WIN32_IE)
-# undef _WIN32_IE
-#endif
-# define _WIN32_IE 0x0500
# include <qt_windows.h>
# include <commctrl.h>
# include <objbase.h>
@@ -72,7 +68,7 @@ QT_BEGIN_NAMESPACE
\class QFileIconProvider
\inmodule QtWidgets
-
+
\brief The QFileIconProvider class provides file icons for the QDirModel and the QFileSystemModel classes.
*/
diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp
index 08f10defb8..e7e3a58670 100644
--- a/src/widgets/itemviews/qheaderview.cpp
+++ b/src/widgets/itemviews/qheaderview.cpp
@@ -1349,6 +1349,8 @@ void QHeaderView::setSortIndicator(int logicalIndex, Qt::SortOrder order)
// This is so that people can set the position of the sort indicator before the fill the model
int old = d->sortIndicatorSection;
+ if (old == logicalIndex && order == d->sortIndicatorOrder)
+ return;
d->sortIndicatorSection = logicalIndex;
d->sortIndicatorOrder = order;
diff --git a/src/widgets/itemviews/qitemeditorfactory.cpp b/src/widgets/itemviews/qitemeditorfactory.cpp
index 5f24c3ea1b..09e59579b8 100644
--- a/src/widgets/itemviews/qitemeditorfactory.cpp
+++ b/src/widgets/itemviews/qitemeditorfactory.cpp
@@ -560,7 +560,7 @@ void QExpandingLineEdit::updateMinimumWidth()
QStyleOptionFrameV2 opt;
initStyleOption(&opt);
-
+
int minWidth = style()->sizeFromContents(QStyle::CT_LineEdit, &opt, QSize(width, 0).
expandedTo(QApplication::globalStrut()), this).width();
setMinimumWidth(minWidth);
diff --git a/src/widgets/itemviews/qstyleditemdelegate.cpp b/src/widgets/itemviews/qstyleditemdelegate.cpp
index fa5a62805f..6a330fc7cb 100644
--- a/src/widgets/itemviews/qstyleditemdelegate.cpp
+++ b/src/widgets/itemviews/qstyleditemdelegate.cpp
@@ -538,9 +538,9 @@ void QStyledItemDelegate::updateEditorGeometry(QWidget *editor,
QStyleOptionViewItem opt = option;
initStyleOption(&opt, index);
- // let the editor take up all available space
+ // let the editor take up all available space
//if the editor is not a QLineEdit
- //or it is in a QTableView
+ //or it is in a QTableView
#if !defined(QT_NO_TABLEVIEW) && !defined(QT_NO_LINEEDIT)
if (qobject_cast<QExpandingLineEdit*>(editor) && !qobject_cast<const QTableView*>(widget))
opt.showDecorationSelected = editor->style()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected, 0, editor);
diff --git a/src/widgets/itemviews/qtableview.cpp b/src/widgets/itemviews/qtableview.cpp
index 80abb050ee..d84dc608b9 100644
--- a/src/widgets/itemviews/qtableview.cpp
+++ b/src/widgets/itemviews/qtableview.cpp
@@ -2198,7 +2198,7 @@ int QTableView::sizeHintForRow(int row) const
option.rect.setX(columnViewportPosition(index.column()));
option.rect.setWidth(columnWidth(index.column()));
}
-
+
QWidget *editor = d->editorForIndex(index).widget.data();
if (editor && d->persistent.contains(editor)) {
hint = qMax(hint, editor->sizeHint().height());
@@ -2206,7 +2206,7 @@ int QTableView::sizeHintForRow(int row) const
int max = editor->maximumSize().height();
hint = qBound(min, hint, max);
}
-
+
hint = qMax(hint, itemDelegate(index)->sizeHint(option, index).height());
}
@@ -2251,7 +2251,7 @@ int QTableView::sizeHintForColumn(int column) const
if (d->verticalHeader->isSectionHidden(logicalRow))
continue;
index = d->model->index(logicalRow, column, d->root);
-
+
QWidget *editor = d->editorForIndex(index).widget.data();
if (editor && d->persistent.contains(editor)) {
hint = qMax(hint, editor->sizeHint().width());
@@ -2259,7 +2259,7 @@ int QTableView::sizeHintForColumn(int column) const
int max = editor->maximumSize().width();
hint = qBound(min, hint, max);
}
-
+
hint = qMax(hint, itemDelegate(index)->sizeHint(option, index).width());
}
diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp
index ece5b21ae2..bcaf8dc2c3 100644
--- a/src/widgets/itemviews/qtreeview.cpp
+++ b/src/widgets/itemviews/qtreeview.cpp
@@ -1716,7 +1716,7 @@ void QTreeView::drawRow(QPainter *painter, const QStyleOptionViewItem &option,
// we have to split the focus rect into two rects
if (allColumnsShowFocus && !option.showDecorationSelected
&& header->sectionsMoved() && (header->visualIndex(0) != 0)) {
- QRect sectionRect(0, y, header->sectionPosition(0), height);
+ QRect sectionRect(0, y, header->sectionPosition(0), height);
o.rect = style()->visualRect(layoutDirection(), d->viewport->rect(), sectionRect);
style()->drawPrimitive(QStyle::PE_FrameFocusRect, &o, painter);
}
diff --git a/src/widgets/itemviews/qtreewidget.cpp b/src/widgets/itemviews/qtreewidget.cpp
index 5305f64cc9..f689e87f8d 100644
--- a/src/widgets/itemviews/qtreewidget.cpp
+++ b/src/widgets/itemviews/qtreewidget.cpp
@@ -1477,7 +1477,7 @@ QTreeWidgetItem::QTreeWidgetItem(QTreeWidgetItem *parent, QTreeWidgetItem *after
/*!
Destroys this tree widget item.
-
+
The item will be removed from \l{QTreeWidget}s to which it has
been added. This makes it safe to delete an item at any time.
diff --git a/src/widgets/itemviews/qtreewidgetitemiterator.cpp b/src/widgets/itemviews/qtreewidgetitemiterator.cpp
index 0108b80dcf..c1e2bd8b77 100644
--- a/src/widgets/itemviews/qtreewidgetitemiterator.cpp
+++ b/src/widgets/itemviews/qtreewidgetitemiterator.cpp
@@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE
\class QTreeWidgetItemIterator
\ingroup model-view
\inmodule QtWidgets
-
+
\brief The QTreeWidgetItemIterator class provides a way to iterate over the
items in a QTreeWidget instance.
diff --git a/src/widgets/kernel/kernel.pri b/src/widgets/kernel/kernel.pri
index b2f05e3cab..4d3d7c4e0a 100644
--- a/src/widgets/kernel/kernel.pri
+++ b/src/widgets/kernel/kernel.pri
@@ -33,8 +33,6 @@ HEADERS += \
kernel/qstandardgestures_p.h \
kernel/qgesturerecognizer.h \
kernel/qgesturemanager_p.h \
- kernel/qsoftkeymanager_p.h \
- kernel/qsoftkeymanager_common_p.h \
kernel/qdesktopwidget_qpa_p.h \
kernel/qwidgetwindow_qpa_p.h
@@ -59,7 +57,6 @@ SOURCES += \
kernel/qstandardgestures.cpp \
kernel/qgesturerecognizer.cpp \
kernel/qgesturemanager.cpp \
- kernel/qsoftkeymanager.cpp \
kernel/qdesktopwidget.cpp \
kernel/qwidgetsvariant.cpp \
kernel/qapplication_qpa.cpp \
diff --git a/src/widgets/kernel/qaction.cpp b/src/widgets/kernel/qaction.cpp
index e835f927d0..64b856ea96 100644
--- a/src/widgets/kernel/qaction.cpp
+++ b/src/widgets/kernel/qaction.cpp
@@ -81,9 +81,8 @@ static QString qt_strippedText(QString s)
QActionPrivate::QActionPrivate() : group(0), enabled(1), forceDisabled(0),
visible(1), forceInvisible(0), checkable(0), checked(0), separator(0), fontSet(false),
- forceEnabledInSoftkeys(false), menuActionSoftkeys(false),
iconVisibleInMenu(-1),
- menuRole(QAction::TextHeuristicRole), softKeyRole(QAction::NoSoftKey),
+ menuRole(QAction::TextHeuristicRole),
priority(QAction::NormalPriority)
{
#ifndef QT_NO_SHORTCUT
@@ -280,27 +279,7 @@ void QActionPrivate::setShortcutEnabled(bool enable, QShortcutMap &map)
File menu in your menubar and the File menu has a submenu, setting the
MenuRole for the actions in that submenu have no effect. They will never be moved.
*/
-#ifndef qdoc
-/*! \since 4.6
- \enum QAction::SoftKeyRole
-
- This enum describes how an action should be placed in the softkey bar. Currently this enum only
- has an effect on the Symbian platform.
-
- \value NoSoftKey This action should not be used as a softkey
- \value PositiveSoftKey This action is used to describe a softkey with a positive or non-destructive
- role such as Ok, Select, or Options.
- \value NegativeSoftKey This action is used to describe a soft ey with a negative or destructive role
- role such as Cancel, Discard, or Close.
- \value SelectSoftKey This action is used to describe a role that selects a particular item or widget
- in the application.
-
- Actions with a softkey role defined are only visible in the softkey bar when the widget containing
- the action has focus. If no widget currently has focus, the softkey framework will traverse up the
- widget parent hierarchy looking for a widget containing softkey actions.
- */
-#endif
/*!
Constructs an action with \a parent. If \a parent is an action
group the action will be automatically inserted into the group.
@@ -1287,34 +1266,6 @@ QAction::MenuRole QAction::menuRole() const
return d->menuRole;
}
-#ifndef qdoc
-/*!
- \property QAction::softKeyRole
- \brief the action's softkey role
- \since 4.6
-
- This indicates what type of role this action describes in the softkey framework
- on platforms where such a framework is supported. Currently this is only
- supported on the Symbian platform.
-
- The softkey role can be changed any time.
-*/
-void QAction::setSoftKeyRole(SoftKeyRole softKeyRole)
-{
- Q_D(QAction);
- if (d->softKeyRole == softKeyRole)
- return;
-
- d->softKeyRole = softKeyRole;
- d->sendDataChanged();
-}
-
-QAction::SoftKeyRole QAction::softKeyRole() const
-{
- Q_D(const QAction);
- return d->softKeyRole;
-}
-#endif
/*!
\property QAction::iconVisibleInMenu
\brief Whether or not an action should show an icon in a menu
diff --git a/src/widgets/kernel/qaction.h b/src/widgets/kernel/qaction.h
index e149975de7..6a3c0bee68 100644
--- a/src/widgets/kernel/qaction.h
+++ b/src/widgets/kernel/qaction.h
@@ -66,9 +66,6 @@ class Q_WIDGETS_EXPORT QAction : public QObject
Q_DECLARE_PRIVATE(QAction)
Q_ENUMS(MenuRole)
-#ifndef qdoc
- Q_ENUMS(SoftKeyRole)
-#endif
Q_ENUMS(Priority)
Q_PROPERTY(bool checkable READ isCheckable WRITE setCheckable NOTIFY changed)
Q_PROPERTY(bool checked READ isChecked WRITE setChecked DESIGNABLE isCheckable NOTIFY toggled)
@@ -87,9 +84,6 @@ class Q_WIDGETS_EXPORT QAction : public QObject
#endif
Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY changed)
Q_PROPERTY(MenuRole menuRole READ menuRole WRITE setMenuRole NOTIFY changed)
-#ifndef qdoc
- Q_PROPERTY(SoftKeyRole softKeyRole READ softKeyRole WRITE setSoftKeyRole NOTIFY changed)
-#endif
Q_PROPERTY(bool iconVisibleInMenu READ isIconVisibleInMenu WRITE setIconVisibleInMenu NOTIFY changed)
Q_PROPERTY(Priority priority READ priority WRITE setPriority)
@@ -97,10 +91,6 @@ public:
// note this is copied into qplatformmenu.h, which must stay in sync
enum MenuRole { NoRole = 0, TextHeuristicRole, ApplicationSpecificRole, AboutQtRole,
AboutRole, PreferencesRole, QuitRole };
-#ifndef qdoc
- enum SoftKeyRole {
- NoSoftKey, PositiveSoftKey, NegativeSoftKey, SelectSoftKey };
-#endif
enum Priority { LowPriority = 0,
NormalPriority = 128,
HighPriority = 256};
@@ -178,10 +168,6 @@ public:
void setMenuRole(MenuRole menuRole);
MenuRole menuRole() const;
-#ifndef qdoc
- void setSoftKeyRole(SoftKeyRole softKeyRole);
- SoftKeyRole softKeyRole() const;
-#endif
void setIconVisibleInMenu(bool visible);
bool isIconVisibleInMenu() const;
diff --git a/src/widgets/kernel/qaction_p.h b/src/widgets/kernel/qaction_p.h
index 6e25427b31..32c55e6de2 100644
--- a/src/widgets/kernel/qaction_p.h
+++ b/src/widgets/kernel/qaction_p.h
@@ -106,13 +106,9 @@ public:
uint separator : 1;
uint fontSet : 1;
- //for soft keys management
- uint forceEnabledInSoftkeys : 1;
- uint menuActionSoftkeys : 1;
int iconVisibleInMenu : 3; // Only has values -1, 0, and 1
QAction::MenuRole menuRole;
- QAction::SoftKeyRole softKeyRole;
QAction::Priority priority;
QList<QWidget *> widgets;
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index 3e0f803f5d..efa52456e8 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -902,7 +902,6 @@ bool QApplication::compressEvent(QEvent *event, QObject *receiver, QPostEventLis
|| event->type() == QEvent::Resize
|| event->type() == QEvent::Move
|| event->type() == QEvent::LanguageChange
- || event->type() == QEvent::UpdateSoftKeys
|| event->type() == QEvent::InputMethod)) {
for (QPostEventList::const_iterator it = postedEvents->constBegin(); it != postedEvents->constEnd(); ++it) {
const QPostEvent &cur = *it;
@@ -917,8 +916,6 @@ bool QApplication::compressEvent(QEvent *event, QObject *receiver, QPostEventLis
((QMoveEvent *)(cur.event))->p = ((QMoveEvent *)event)->p;
} else if (cur.event->type() == QEvent::LanguageChange) {
;
- } else if (cur.event->type() == QEvent::UpdateSoftKeys) {
- ;
} else if ( cur.event->type() == QEvent::InputMethod ) {
*(QInputMethodEvent *)(cur.event) = *(QInputMethodEvent *)event;
} else {
diff --git a/src/widgets/kernel/qsoftkeymanager.cpp b/src/widgets/kernel/qsoftkeymanager.cpp
deleted file mode 100644
index 64ee6b0f2e..0000000000
--- a/src/widgets/kernel/qsoftkeymanager.cpp
+++ /dev/null
@@ -1,270 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qapplication.h"
-#include "qevent.h"
-#include "qbitmap.h"
-#include "private/qsoftkeymanager_p.h"
-#include "private/qaction_p.h"
-#include "private/qsoftkeymanager_common_p.h"
-
-#ifndef QT_NO_SOFTKEYMANAGER
-QT_BEGIN_NAMESPACE
-
-QSoftKeyManager *QSoftKeyManagerPrivate::self = 0;
-
-QString QSoftKeyManager::standardSoftKeyText(StandardSoftKey standardKey)
-{
- QString softKeyText;
- switch (standardKey) {
- case OkSoftKey:
- softKeyText = QSoftKeyManager::tr("Ok");
- break;
- case SelectSoftKey:
- softKeyText = QSoftKeyManager::tr("Select");
- break;
- case DoneSoftKey:
- softKeyText = QSoftKeyManager::tr("Done");
- break;
- case MenuSoftKey:
- softKeyText = QSoftKeyManager::tr("Options");
- break;
- case CancelSoftKey:
- softKeyText = QSoftKeyManager::tr("Cancel");
- break;
- default:
- break;
- };
-
- return softKeyText;
-}
-
-QSoftKeyManager *QSoftKeyManager::instance()
-{
- if (!QSoftKeyManagerPrivate::self)
- QSoftKeyManagerPrivate::self = new QSoftKeyManager;
-
- return QSoftKeyManagerPrivate::self;
-}
-
-QSoftKeyManager::QSoftKeyManager() :
- QObject(*(new QSoftKeyManagerPrivate), 0)
-{
-}
-
-QAction *QSoftKeyManager::createAction(StandardSoftKey standardKey, QWidget *actionWidget)
-{
- QAction *action = new QAction(standardSoftKeyText(standardKey), actionWidget);
- QAction::SoftKeyRole softKeyRole = QAction::NoSoftKey;
- switch (standardKey) {
- case MenuSoftKey: // FALL-THROUGH
- QActionPrivate::get(action)->menuActionSoftkeys = true;
- case OkSoftKey:
- case SelectSoftKey:
- case DoneSoftKey:
- softKeyRole = QAction::PositiveSoftKey;
- break;
- case CancelSoftKey:
- softKeyRole = QAction::NegativeSoftKey;
- break;
- }
- action->setSoftKeyRole(softKeyRole);
- action->setVisible(false);
- setForceEnabledInSoftkeys(action);
- return action;
-}
-
-/*! \internal
-
- Creates a QAction and registers the 'triggered' signal to send the given key event to
- \a actionWidget as a convenience.
-
-*/
-QAction *QSoftKeyManager::createKeyedAction(StandardSoftKey standardKey, Qt::Key key, QWidget *actionWidget)
-{
-#ifndef QT_NO_ACTION
- QScopedPointer<QAction> action(createAction(standardKey, actionWidget));
-
- connect(action.data(), SIGNAL(triggered()), QSoftKeyManager::instance(), SLOT(sendKeyEvent()));
- connect(action.data(), SIGNAL(destroyed(QObject*)), QSoftKeyManager::instance(), SLOT(cleanupHash(QObject*)));
- QSoftKeyManager::instance()->d_func()->keyedActions.insert(action.data(), key);
- return action.take();
-#endif //QT_NO_ACTION
-}
-
-void QSoftKeyManager::cleanupHash(QObject *obj)
-{
- Q_D(QSoftKeyManager);
- QAction *action = qobject_cast<QAction*>(obj);
- d->keyedActions.remove(action);
-}
-
-void QSoftKeyManager::sendKeyEvent()
-{
- Q_D(QSoftKeyManager);
- QAction *action = qobject_cast<QAction*>(sender());
-
- if (!action)
- return;
-
- Qt::Key keyToSend = d->keyedActions.value(action, Qt::Key_unknown);
-
- if (keyToSend != Qt::Key_unknown)
- QApplication::postEvent(action->parentWidget(),
- new QKeyEvent(QEvent::KeyPress, keyToSend, Qt::NoModifier));
-}
-
-void QSoftKeyManager::updateSoftKeys()
-{
- QSoftKeyManager::instance()->d_func()->pendingUpdate = true;
- QEvent *event = new QEvent(QEvent::UpdateSoftKeys);
- QApplication::postEvent(QSoftKeyManager::instance(), event);
-}
-
-bool QSoftKeyManager::appendSoftkeys(const QWidget &source, int level)
-{
- Q_D(QSoftKeyManager);
- bool ret = false;
- foreach(QAction *action, source.actions()) {
- if (action->softKeyRole() != QAction::NoSoftKey
- && (action->isVisible() || isForceEnabledInSofkeys(action))) {
- d->requestedSoftKeyActions.insert(level, action);
- ret = true;
- }
- }
- return ret;
-}
-
-
-static bool isChildOf(const QWidget *c, const QWidget *p)
-{
- while (c) {
- if (c == p)
- return true;
- c = c->parentWidget();
- }
- return false;
-}
-
-QWidget *QSoftKeyManager::softkeySource(QWidget *previousSource, bool& recursiveMerging)
-{
- Q_D(QSoftKeyManager);
- QWidget *source = NULL;
- if (!previousSource) {
- // Initial source is primarily focuswidget and secondarily activeWindow
- QWidget *focus = QApplication::focusWidget();
- QWidget *popup = QApplication::activePopupWidget();
- if (popup) {
- if (isChildOf(focus, popup))
- source = focus;
- else
- source = popup;
- }
- if (!source) {
- QWidget *modal = QApplication::activeModalWidget();
- if (modal) {
- if (isChildOf(focus, modal))
- source = focus;
- else
- source = modal;
- }
- }
- if (!source) {
- source = focus;
- if (!source)
- source = QApplication::activeWindow();
- }
- } else {
- // Softkey merging is based on four criterias
- // 1. Implicit merging is used whenever focus widget does not specify any softkeys
- bool implicitMerging = d->requestedSoftKeyActions.isEmpty();
- // 2. Explicit merging with parent is used whenever WA_MergeSoftkeys widget attribute is set
- bool explicitMerging = previousSource->testAttribute(Qt::WA_MergeSoftkeys);
- // 3. Explicit merging with all parents
- recursiveMerging |= previousSource->testAttribute(Qt::WA_MergeSoftkeysRecursively);
- // 4. Implicit and explicit merging always stops at window boundary
- bool merging = (implicitMerging || explicitMerging || recursiveMerging) && !previousSource->isWindow();
-
- source = merging ? previousSource->parentWidget() : NULL;
- }
- return source;
-}
-
-bool QSoftKeyManager::handleUpdateSoftKeys()
-{
- Q_D(QSoftKeyManager);
- int level = 0;
- d->requestedSoftKeyActions.clear();
- bool recursiveMerging = false;
- QWidget *source = softkeySource(NULL, recursiveMerging);
- d->initialSoftKeySource = source;
- while (source) {
- if (appendSoftkeys(*source, level))
- ++level;
- source = softkeySource(source, recursiveMerging);
- }
-
- d->updateSoftKeys_sys();
- d->pendingUpdate = false;
- return true;
-}
-
-void QSoftKeyManager::setForceEnabledInSoftkeys(QAction *action)
-{
- QActionPrivate::get(action)->forceEnabledInSoftkeys = true;
-}
-
-bool QSoftKeyManager::isForceEnabledInSofkeys(QAction *action)
-{
- return QActionPrivate::get(action)->forceEnabledInSoftkeys;
-}
-
-bool QSoftKeyManager::event(QEvent *e)
-{
-#ifndef QT_NO_ACTION
- if (e->type() == QEvent::UpdateSoftKeys)
- return handleUpdateSoftKeys();
-#endif //QT_NO_ACTION
- return false;
-}
-
-QT_END_NAMESPACE
-#endif //QT_NO_SOFTKEYMANAGER
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index 07dab9e784..2feb797985 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -77,7 +77,6 @@
#include "private/qstylesheetstyle_p.h"
#include "private/qstyle_p.h"
#include "qfileinfo.h"
-#include "private/qsoftkeymanager_p.h"
#include <QtGui/qinputmethod.h>
#include <private/qgraphicseffect_p.h>
@@ -906,30 +905,6 @@ void QWidget::setAutoFillBackground(bool enabled)
\sa QEvent, QPainter, QGridLayout, QBoxLayout
- \section1 Softkeys
-
- Since Qt 4.6, Softkeys are usually physical keys on a device that have a corresponding label or
- other visual representation on the screen that is generally located next to its
- physical counterpart. They are most often found on mobile phone platforms. In
- modern touch based user interfaces it is also possible to have softkeys that do
- not correspond to any physical keys. Softkeys differ from other onscreen labels
- in that they are contextual.
-
- In Qt, contextual softkeys are added to a widget by calling addAction() and
- passing a \c QAction with a softkey role set on it. When the widget
- containing the softkey actions has focus, its softkeys should appear in
- the user interface. Softkeys are discovered by traversing the widget
- hierarchy so it is possible to define a single set of softkeys that are
- present at all times by calling addAction() for a given top level widget.
-
- On some platforms, this concept overlaps with \c QMenuBar such that if no
- other softkeys are found and the top level widget is a QMainWindow containing
- a QMenuBar, the menubar actions may appear on one of the softkeys.
-
- Note: Currently softkeys are only supported on the Symbian Platform.
-
- \sa addAction(), QAction, QMenuBar
-
*/
QWidgetMapper *QWidgetPrivate::mapper = 0; // widget with wid
@@ -7956,9 +7931,6 @@ bool QWidget::event(QEvent *event)
}
break;
case QEvent::FocusIn:
-#ifdef QT_SOFTKEYS_ENABLED
- QSoftKeyManager::updateSoftKeys();
-#endif
focusInEvent((QFocusEvent*)event);
d->updateWidgetTransform();
break;
@@ -8109,12 +8081,6 @@ bool QWidget::event(QEvent *event)
if (w && w->isVisible() && !w->isWindow())
QApplication::sendEvent(w, event);
}
-
-#ifdef QT_SOFTKEYS_ENABLED
- if (isWindow())
- QSoftKeyManager::updateSoftKeys();
-#endif
-
break; }
case QEvent::LanguageChange:
@@ -8199,9 +8165,6 @@ bool QWidget::event(QEvent *event)
case QEvent::ActionAdded:
case QEvent::ActionRemoved:
case QEvent::ActionChanged:
-#ifdef QT_SOFTKEYS_ENABLED
- QSoftKeyManager::updateSoftKeys();
-#endif
actionEvent((QActionEvent*)event);
break;
#endif
diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp
index 900818d5c6..b49441beba 100644
--- a/src/widgets/kernel/qwidgetwindow.cpp
+++ b/src/widgets/kernel/qwidgetwindow.cpp
@@ -234,14 +234,20 @@ void QWidgetWindow::handleEnterLeaveEvent(QEvent *event)
while (enterParent->parent())
enterParent = enterParent->parent();
if (thisParent == enterParent) {
+ QGuiApplicationPrivate::currentMouseWindow = enterWindow;
enter = enterWindow->widget();
QWindowSystemInterfacePrivate::removeWindowSystemEvent(systemEvent);
}
}
}
- QWidget *leave = qt_last_mouse_receiver ? qt_last_mouse_receiver.data() : m_widget;
- QApplicationPrivate::dispatchEnterLeave(enter, leave);
- qt_last_mouse_receiver = enter;
+ // Enter-leave between sibling widgets is ignored when there is a mousegrabber - this makes
+ // both native and non-native widgets work similarly.
+ // When mousegrabbing, leaves are only generated if leaving the parent window.
+ if (!enter || !QWidget::mouseGrabber()) {
+ QWidget *leave = qt_last_mouse_receiver ? qt_last_mouse_receiver.data() : m_widget;
+ QApplicationPrivate::dispatchEnterLeave(enter, leave);
+ qt_last_mouse_receiver = enter;
+ }
} else {
QApplicationPrivate::dispatchEnterLeave(m_widget, 0);
qt_last_mouse_receiver = m_widget;
diff --git a/src/widgets/statemachine/qguistatemachine.cpp b/src/widgets/statemachine/qguistatemachine.cpp
index 98d4098634..8c66ec4051 100644
--- a/src/widgets/statemachine/qguistatemachine.cpp
+++ b/src/widgets/statemachine/qguistatemachine.cpp
@@ -69,7 +69,6 @@ static QEvent *cloneEvent(QEvent *e)
return new QEvent(*e);
case QEvent::Leave:
return new QEvent(*e);
- break;
case QEvent::Paint:
Q_ASSERT_X(false, "cloneEvent()", "not implemented");
break;
@@ -443,9 +442,6 @@ static QEvent *cloneEvent(QEvent *e)
break;
#endif
- case QEvent::UpdateSoftKeys:
- return new QEvent(*e);
-
case QEvent::User:
case QEvent::MaxUser:
Q_ASSERT_X(false, "cloneEvent()", "not implemented");
diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp
index 990245a113..2b6d843723 100644
--- a/src/widgets/styles/qcommonstyle.cpp
+++ b/src/widgets/styles/qcommonstyle.cpp
@@ -1081,13 +1081,9 @@ void QCommonStylePrivate::startAnimation(QStyleAnimation *animation) const
/*! \internal */
void QCommonStylePrivate::stopAnimation(const QObject *target) const
{
- QStyleAnimation *animation = animations.value(target);
- if (animation) {
- if (animation->state() == QAbstractAnimation::Stopped)
- animations.take(target)->deleteLater();
- else
- animation->stop();
- }
+ QStyleAnimation *animation = animations.take(target);
+ if (animation && animation->state() != QAbstractAnimation::Stopped)
+ animation->stop();
}
/*! \internal */
@@ -2777,7 +2773,6 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt,
return widget->style()->subElementRect(QStyle::SE_FrameContents, opt, widget);
else
return subElementRect(QStyle::SE_FrameContents, opt, widget);
- break;
case QFrame::WinPanel:
frameWidth = 2;
diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm
index f1d513bc23..83895b64b0 100644
--- a/src/widgets/styles/qmacstyle_mac.mm
+++ b/src/widgets/styles/qmacstyle_mac.mm
@@ -5399,7 +5399,7 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
QStyleOptionGroupBox groupBox(*gb);
groupBox.state |= QStyle::State_Mini; // Force mini-sized checkbox to go with small-sized label
bool didModifySubControls = false;
- if ((widget && !widget->testAttribute(Qt::WA_SetFont))
+ if ((!widget || !widget->testAttribute(Qt::WA_SetFont))
&& QApplication::desktopSettingsAware()) {
groupBox.subControls = groupBox.subControls & ~SC_GroupBoxLabel;
didModifySubControls = true;
@@ -5434,7 +5434,8 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
case CC_ToolButton:
if (const QStyleOptionToolButton *tb
= qstyleoption_cast<const QStyleOptionToolButton *>(opt)) {
- if (widget && qobject_cast<QToolBar *>(widget->parentWidget())) {
+
+ if (QStyleHelper::hasAncestor(opt->styleObject, QAccessible::ToolBar)) {
if (tb->subControls & SC_ToolButtonMenu) {
QStyleOption arrowOpt(0);
arrowOpt.rect = proxy()->subControlRect(cc, tb, SC_ToolButtonMenu, widget);
@@ -6030,7 +6031,7 @@ QRect QMacStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *op
break;
case CC_ToolButton:
ret = QCommonStyle::subControlRect(cc, opt, sc, widget);
- if (sc == SC_ToolButtonMenu && widget && !qobject_cast<QToolBar*>(widget->parentWidget())) {
+ if (sc == SC_ToolButtonMenu && !QStyleHelper::hasAncestor(opt->styleObject, QAccessible::ToolBar)) {
ret.adjust(-1, 0, 0, 0);
}
break;
@@ -6176,7 +6177,7 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
// Do this by add enough space around the contents so that rounded
// borders (including highlighting when active) will show.
sz.rwidth() += QMacStylePrivate::PushButtonLeftOffset + QMacStylePrivate::PushButtonRightOffset + 12;
- sz.rheight() += QMacStylePrivate::PushButtonTopOffset + QMacStylePrivate::PushButtonBottomOffset;
+ sz.rheight() += 4;
break;
case QStyle::CT_MenuItem:
if (const QStyleOptionMenuItem *mi = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) {
diff --git a/src/widgets/styles/qstyleanimation.cpp b/src/widgets/styles/qstyleanimation.cpp
index d81532f8a5..0138996e33 100644
--- a/src/widgets/styles/qstyleanimation.cpp
+++ b/src/widgets/styles/qstyleanimation.cpp
@@ -163,4 +163,49 @@ bool QProgressStyleAnimation::isUpdateNeeded() const
return false;
}
+QNumberStyleAnimation::QNumberStyleAnimation(QObject *target) :
+ QStyleAnimation(target), _start(0.0), _end(1.0), _prev(0.0)
+{
+ setDuration(250);
+}
+
+qreal QNumberStyleAnimation::startValue() const
+{
+ return _start;
+}
+
+void QNumberStyleAnimation::setStartValue(qreal value)
+{
+ _start = value;
+}
+
+qreal QNumberStyleAnimation::endValue() const
+{
+ return _end;
+}
+
+void QNumberStyleAnimation::setEndValue(qreal value)
+{
+ _end = value;
+}
+
+qreal QNumberStyleAnimation::currentValue() const
+{
+ qreal step = qreal(currentTime() - delay()) / (duration() - delay());
+ return _start + qMax(qreal(0), step) * (_end - _start);
+}
+
+bool QNumberStyleAnimation::isUpdateNeeded() const
+{
+ if (QStyleAnimation::isUpdateNeeded()) {
+ qreal current = currentValue();
+ if (!qFuzzyCompare(_prev, current))
+ {
+ _prev = current;
+ return true;
+ }
+ }
+ return false;
+}
+
QT_END_NAMESPACE
diff --git a/src/widgets/styles/qstyleanimation_p.h b/src/widgets/styles/qstyleanimation_p.h
index 3188eebebc..d9869533ef 100644
--- a/src/widgets/styles/qstyleanimation_p.h
+++ b/src/widgets/styles/qstyleanimation_p.h
@@ -110,6 +110,30 @@ private:
mutable int _step;
};
+class QNumberStyleAnimation : public QStyleAnimation
+{
+ Q_OBJECT
+
+public:
+ QNumberStyleAnimation(QObject *target);
+
+ qreal startValue() const;
+ void setStartValue(qreal value);
+
+ qreal endValue() const;
+ void setEndValue(qreal value);
+
+ qreal currentValue() const;
+
+protected:
+ bool isUpdateNeeded() const;
+
+private:
+ qreal _start;
+ qreal _end;
+ mutable qreal _prev;
+};
+
QT_END_NAMESPACE
#endif // QSTYLEANIMATION_P_H
diff --git a/src/widgets/styles/qstylehelper.cpp b/src/widgets/styles/qstylehelper.cpp
index e23db2b637..8d67683eae 100644
--- a/src/widgets/styles/qstylehelper.cpp
+++ b/src/widgets/styles/qstylehelper.cpp
@@ -86,6 +86,23 @@ qreal dpiScaled(qreal value)
#endif
}
+// Searches for an ancestor of a particular accessible role
+bool hasAncestor(QObject *obj, QAccessible::Role role)
+{
+ bool found = false;
+#ifndef QT_NO_ACCESSIBILITY
+ QObject *parent = obj ? obj->parent() : 0;
+ while (parent && !found) {
+ QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(parent);
+ if (iface && iface->role() == role)
+ found = true;
+ delete iface;
+ parent = parent->parent();
+ }
+#endif // QT_NO_ACCESSIBILITY
+ return found;
+}
+
#ifndef QT_NO_DIAL
diff --git a/src/widgets/styles/qstylehelper_p.h b/src/widgets/styles/qstylehelper_p.h
index e47722bd9f..ab6a97e59a 100644
--- a/src/widgets/styles/qstylehelper_p.h
+++ b/src/widgets/styles/qstylehelper_p.h
@@ -44,6 +44,7 @@
#include <QtCore/qstring.h>
#include <QtGui/qpolygon.h>
#include <QtCore/qstringbuilder.h>
+#include <QtGui/qaccessible.h>
#ifndef QSTYLEHELPER_P_H
#define QSTYLEHELPER_P_H
@@ -81,6 +82,7 @@ namespace QStyleHelper
void drawBorderPixmap(const QPixmap &pixmap, QPainter *painter, const QRect &rect,
int left = 0, int top = 0, int right = 0,
int bottom = 0);
+ bool hasAncestor(QObject *obj, QAccessible::Role role);
}
diff --git a/src/widgets/styles/qwindowsvistastyle.cpp b/src/widgets/styles/qwindowsvistastyle.cpp
index 87c67dc84b..b20e6f5ea5 100644
--- a/src/widgets/styles/qwindowsvistastyle.cpp
+++ b/src/widgets/styles/qwindowsvistastyle.cpp
@@ -151,12 +151,36 @@ inline QObject *styleObject(const QStyleOption *option) {
return option ? option->styleObject : 0;
}
+/* \internal
+ Checks if we can animate on a style option
+*/
bool canAnimate(const QStyleOption *option) {
return option
&& option->styleObject
&& !option->styleObject->property("_q_no_animation").toBool();
}
+/* \internal
+ Used by animations to clone a styleoption and shift its offset
+*/
+QStyleOption *clonedAnimationStyleOption(const QStyleOption*option) {
+ QStyleOption *styleOption = 0;
+ if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider*>(option))
+ styleOption = new QStyleOptionSlider(*slider);
+ else if (const QStyleOptionSpinBox *spinbox = qstyleoption_cast<const QStyleOptionSpinBox*>(option))
+ styleOption = new QStyleOptionSpinBox(*spinbox);
+ else if (const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox*>(option))
+ styleOption = new QStyleOptionGroupBox(*groupBox);
+ else if (const QStyleOptionComboBox *combo = qstyleoption_cast<const QStyleOptionComboBox*>(option))
+ styleOption = new QStyleOptionComboBox(*combo);
+ else if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton*>(option))
+ styleOption = new QStyleOptionButton(*button);
+ else
+ styleOption = new QStyleOption(*option);
+ styleOption->rect = QRect(QPoint(0,0), option->rect.size());
+ return styleOption;
+}
+
/*!
\class QWindowsVistaStyle
@@ -402,14 +426,8 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt
doTransition = false;
if (doTransition) {
- QStyleOption *styleOption = 0;
- if (const QStyleOptionGroupBox *combo = qstyleoption_cast<const QStyleOptionGroupBox*>(option))
- styleOption = new QStyleOptionGroupBox(*combo);
- else
- styleOption = new QStyleOption(*option);
-
+ QStyleOption *styleOption = clonedAnimationStyleOption(option);
styleOption->state = (QStyle::State)oldState;
- styleOption->rect = QRect(QPoint(0,0), newRect.size());
QWindowsVistaAnimation *anim = qobject_cast<QWindowsVistaAnimation *>(d->animation(styleObject));
QWindowsVistaTransition *t = new QWindowsVistaTransition(styleObject);
@@ -975,16 +993,8 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption
QWindowsVistaTransition *t = new QWindowsVistaTransition(styleObject);
QWindowsVistaAnimation *anim = qobject_cast<QWindowsVistaAnimation *>(d->animation(styleObject));
- QStyleOption *styleOption = 0;
- if (const QStyleOptionComboBox *combo = qstyleoption_cast<const QStyleOptionComboBox*>(option))
- styleOption = new QStyleOptionComboBox(*combo);
- else if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton*>(option))
- styleOption = new QStyleOptionButton(*button);
- else
- styleOption = new QStyleOption(*option);
-
+ QStyleOption *styleOption = clonedAnimationStyleOption(option);
styleOption->state = (QStyle::State)oldState;
- styleOption->rect = QRect(QPoint(0,0), newRect.size());
QImage startImage(option->rect.size(), QImage::Format_ARGB32_Premultiplied);
startImage.fill(0);
@@ -1664,6 +1674,7 @@ void QWindowsVistaStyle::drawComplexControl(ComplexControl control, const QStyle
}
if (doTransition) {
+
QImage startImage(option->rect.size(), QImage::Format_ARGB32_Premultiplied);
startImage.fill(0);
QPainter startPainter(&startImage);
@@ -1676,15 +1687,7 @@ void QWindowsVistaStyle::drawComplexControl(ComplexControl control, const QStyle
QWindowsVistaTransition *t = new QWindowsVistaTransition(styleObject);
// Draw the image that ends the animation by using the current styleoption
- QStyleOptionComplex *styleOption = 0;
- if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider*>(option))
- styleOption = new QStyleOptionSlider(*slider);
- else if (const QStyleOptionSpinBox *spinbox = qstyleoption_cast<const QStyleOptionSpinBox*>(option))
- styleOption = new QStyleOptionSpinBox(*spinbox);
- else
- styleOption = new QStyleOptionComplex(*option);
-
- styleOption->rect = QRect(QPoint(0,0), option->rect.size());
+ QStyleOptionComplex *styleOption = qstyleoption_cast<QStyleOptionComplex*>(clonedAnimationStyleOption(option));
styleObject->setProperty("_q_no_animation", true);
diff --git a/src/widgets/util/qsystemtrayicon_win.cpp b/src/widgets/util/qsystemtrayicon_win.cpp
index 108e65a2d1..896d5c2213 100644
--- a/src/widgets/util/qsystemtrayicon_win.cpp
+++ b/src/widgets/util/qsystemtrayicon_win.cpp
@@ -42,12 +42,18 @@
#include "qsystemtrayicon_p.h"
#ifndef QT_NO_SYSTEMTRAYICON
-#ifndef _WIN32_WINNT
-#define _WIN32_WINNT 0x0600
+#if defined(_WIN32_WINNT) && _WIN32_WINNT < 0x0600
+# undef _WIN32_WINNT
+#endif
+#if !defined(_WIN32_WINNT)
+# define _WIN32_WINNT 0x0600
#endif
-#ifndef _WIN32_IE
-#define _WIN32_IE 0x600
+#if defined(_WIN32_IE) && _WIN32_IE < 0x0600
+# undef _WIN32_IE
+#endif
+#if !defined(_WIN32_IE)
+# define _WIN32_IE 0x0600 //required for NOTIFYICONDATA_V2_SIZE
#endif
#include <private/qsystemlibrary_p.h>
diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp
index 74b3dc77d3..f22fc196a2 100644
--- a/src/widgets/widgets/qcombobox.cpp
+++ b/src/widgets/widgets/qcombobox.cpp
@@ -64,7 +64,6 @@
#include <private/qcombobox_p.h>
#include <private/qabstractitemmodel_p.h>
#include <private/qabstractscrollarea_p.h>
-#include <private/qsoftkeymanager_p.h>
#include <qdebug.h>
#if defined(Q_WS_MAC) && !defined(QT_NO_EFFECTS) && !defined(QT_NO_STYLE_MAC)
#include <private/qcore_mac_p.h>
@@ -561,13 +560,6 @@ void QComboBoxPrivateContainer::setItemView(QAbstractItemView *itemView)
#endif
connect(view, SIGNAL(destroyed()),
this, SLOT(viewDestroyed()));
-
-#ifdef QT_SOFTKEYS_ENABLED
- selectAction = QSoftKeyManager::createKeyedAction(QSoftKeyManager::SelectSoftKey, Qt::Key_Select, itemView);
- cancelAction = QSoftKeyManager::createKeyedAction(QSoftKeyManager::CancelSoftKey, Qt::Key_Escape, itemView);
- addAction(selectAction);
- addAction(cancelAction);
-#endif
}
/*!
@@ -617,11 +609,6 @@ void QComboBoxPrivateContainer::changeEvent(QEvent *e)
view->setMouseTracking(combo->style()->styleHint(QStyle::SH_ComboBox_ListMouseTracking, &opt, combo) ||
combo->style()->styleHint(QStyle::SH_ComboBox_Popup, &opt, combo));
setFrameStyle(combo->style()->styleHint(QStyle::SH_ComboBox_PopupFrameStyle, &opt, combo));
-#ifdef QT_SOFTKEYS_ENABLED
- } else if (e->type() == QEvent::LanguageChange) {
- selectAction->setText(QSoftKeyManager::standardSoftKeyText(QSoftKeyManager::SelectSoftKey));
- cancelAction->setText(QSoftKeyManager::standardSoftKeyText(QSoftKeyManager::CancelSoftKey));
-#endif
}
QWidget::changeEvent(e);
@@ -822,6 +809,14 @@ QStyleOptionComboBox QComboBoxPrivateContainer::comboStyleOption() const
*/
/*!
+ \fn void QComboBox::currentTextChanged(const QString &text)
+ \since 5.0
+
+ This signal is sent whenever currentText changes. The new value
+ is passed as \a text.
+*/
+
+/*!
Constructs a combobox with the given \a parent, using the default
model QStandardItemModel.
*/
@@ -980,9 +975,12 @@ void QComboBoxPrivate::_q_dataChanged(const QModelIndex &topLeft, const QModelIn
}
if (currentIndex.row() >= topLeft.row() && currentIndex.row() <= bottomRight.row()) {
+ const QString text = q->itemText(currentIndex.row());
if (lineEdit) {
- lineEdit->setText(q->itemText(currentIndex.row()));
+ lineEdit->setText(text);
updateLineEditGeometry();
+ } else {
+ emit q->currentTextChanged(text);
}
q->update();
}
@@ -1242,7 +1240,11 @@ void QComboBoxPrivate::_q_emitCurrentIndexChanged(const QModelIndex &index)
{
Q_Q(QComboBox);
emit q->currentIndexChanged(index.row());
- emit q->currentIndexChanged(itemText(index));
+ const QString text = itemText(index);
+ emit q->currentIndexChanged(text);
+ // signal lineEdit.textChanged already connected to signal currentTextChanged, so don't emit double here
+ if (!lineEdit)
+ emit q->currentTextChanged(text);
#ifndef QT_NO_ACCESSIBILITY
QAccessibleEvent event(q, QAccessible::NameChanged);
QAccessible::updateAccessibility(&event);
@@ -1714,6 +1716,7 @@ void QComboBox::setLineEdit(QLineEdit *edit)
connect(d->lineEdit, SIGNAL(returnPressed()), this, SLOT(_q_returnPressed()));
connect(d->lineEdit, SIGNAL(editingFinished()), this, SLOT(_q_editingFinished()));
connect(d->lineEdit, SIGNAL(textChanged(QString)), this, SIGNAL(editTextChanged(QString)));
+ connect(d->lineEdit, SIGNAL(textChanged(QString)), this, SIGNAL(currentTextChanged(QString)));
d->lineEdit->setFrame(false);
d->lineEdit->setContextMenuPolicy(Qt::NoContextMenu);
d->lineEdit->setFocusProxy(this);
@@ -2001,6 +2004,17 @@ void QComboBox::setCurrentIndex(int index)
d->setCurrentIndex(mi);
}
+void QComboBox::setCurrentText(const QString &text)
+{
+ if (isEditable()) {
+ setEditText(text);
+ } else {
+ const int i = findText(text);
+ if (i > -1)
+ setCurrentIndex(i);
+ }
+}
+
void QComboBoxPrivate::setCurrentIndex(const QModelIndex &mi)
{
Q_Q(QComboBox);
@@ -2034,7 +2048,11 @@ void QComboBoxPrivate::setCurrentIndex(const QModelIndex &mi)
by the line edit. Otherwise, it is the value of the current item or
an empty string if the combo box is empty or no current item is set.
- \sa editable
+ The setter setCurrentText() simply calls setEditText() if the combo box is editable.
+ Otherwise, if there is a matching text in the list, currentIndex is set to the
+ corresponding index.
+
+ \sa editable, setEditText()
*/
QString QComboBox::currentText() const
{
diff --git a/src/widgets/widgets/qcombobox.h b/src/widgets/widgets/qcombobox.h
index f1f1b133cb..bce6c98f2c 100644
--- a/src/widgets/widgets/qcombobox.h
+++ b/src/widgets/widgets/qcombobox.h
@@ -66,7 +66,7 @@ class Q_WIDGETS_EXPORT QComboBox : public QWidget
Q_ENUMS(SizeAdjustPolicy)
Q_PROPERTY(bool editable READ isEditable WRITE setEditable)
Q_PROPERTY(int count READ count)
- Q_PROPERTY(QString currentText READ currentText USER true)
+ Q_PROPERTY(QString currentText READ currentText WRITE setCurrentText NOTIFY currentTextChanged USER true)
Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged)
Q_PROPERTY(int maxVisibleItems READ maxVisibleItems WRITE setMaxVisibleItems)
Q_PROPERTY(int maxCount READ maxCount WRITE setMaxCount)
@@ -211,6 +211,7 @@ public Q_SLOTS:
void clearEditText();
void setEditText(const QString &text);
void setCurrentIndex(int index);
+ void setCurrentText(const QString &text);
Q_SIGNALS:
void editTextChanged(const QString &);
@@ -220,6 +221,7 @@ Q_SIGNALS:
void highlighted(const QString &);
void currentIndexChanged(int index);
void currentIndexChanged(const QString &);
+ void currentTextChanged(const QString &);
protected:
void focusInEvent(QFocusEvent *e);
diff --git a/src/widgets/widgets/qcombobox_p.h b/src/widgets/widgets/qcombobox_p.h
index eaf218283d..c51e6bb388 100644
--- a/src/widgets/widgets/qcombobox_p.h
+++ b/src/widgets/widgets/qcombobox_p.h
@@ -254,10 +254,6 @@ private:
QAbstractItemView *view;
QComboBoxPrivateScroller *top;
QComboBoxPrivateScroller *bottom;
-#ifdef QT_SOFTKEYS_ENABLED
- QAction *selectAction;
- QAction *cancelAction;
-#endif
};
class QComboMenuDelegate : public QAbstractItemDelegate
diff --git a/src/widgets/widgets/qdialogbuttonbox.cpp b/src/widgets/widgets/qdialogbuttonbox.cpp
index d25332a077..f20fc522ba 100644
--- a/src/widgets/widgets/qdialogbuttonbox.cpp
+++ b/src/widgets/widgets/qdialogbuttonbox.cpp
@@ -255,31 +255,6 @@ static const uint layouts[2][5][14] =
}
};
-#if defined(QT_SOFTKEYS_ENABLED) && !defined(QT_NO_ACTION)
-class QDialogButtonEnabledProxy : public QObject
-{
-public:
- QDialogButtonEnabledProxy(QObject *parent, QWidget *src, QAction *trg) : QObject(parent), source(src), target(trg)
- {
- source->installEventFilter(this);
- target->setEnabled(source->isEnabled());
- }
- ~QDialogButtonEnabledProxy()
- {
- source->removeEventFilter(this);
- }
- bool eventFilter(QObject *object, QEvent *event)
- {
- if (object == source && event->type() == QEvent::EnabledChange) {
- target->setEnabled(source->isEnabled());
- }
- return false;
- };
-private:
- QWidget *source;
- QAction *target;
-};
-#endif
class QDialogButtonBoxPrivate : public QWidgetPrivate
{
@@ -290,9 +265,6 @@ public:
QList<QAbstractButton *> buttonLists[QDialogButtonBox::NRoles];
QHash<QPushButton *, QDialogButtonBox::StandardButton> standardButtonHash;
-#ifdef QT_SOFTKEYS_ENABLED
- QHash<QAbstractButton *, QAction *> softKeyActions;
-#endif
Qt::Orientation orientation;
QDialogButtonBox::ButtonLayout layoutPolicy;
@@ -312,9 +284,6 @@ public:
void addButtonsToLayout(const QList<QAbstractButton *> &buttonList, bool reverse);
void retranslateStrings();
const char *standardButtonText(QDialogButtonBox::StandardButton sbutton) const;
-#if defined(QT_SOFTKEYS_ENABLED) && !defined(QT_NO_ACTION)
- QAction *createSoftKey(QAbstractButton *button, QDialogButtonBox::ButtonRole role);
-#endif
};
QDialogButtonBoxPrivate::QDialogButtonBoxPrivate(Qt::Orientation orient)
@@ -577,62 +546,10 @@ void QDialogButtonBoxPrivate::addButton(QAbstractButton *button, QDialogButtonBo
QObject::connect(button, SIGNAL(clicked()), q, SLOT(_q_handleButtonClicked()));
QObject::connect(button, SIGNAL(destroyed()), q, SLOT(_q_handleButtonDestroyed()));
buttonLists[role].append(button);
-#if defined(QT_SOFTKEYS_ENABLED) && !defined(QT_NO_ACTION)
- QAction *action = createSoftKey(button, role);
- softKeyActions.insert(button, action);
- new QDialogButtonEnabledProxy(action, button, action);
-#endif
if (doLayout)
layoutButtons();
}
-#if defined(QT_SOFTKEYS_ENABLED) && !defined(QT_NO_ACTION)
-QAction* QDialogButtonBoxPrivate::createSoftKey(QAbstractButton *button, QDialogButtonBox::ButtonRole role)
-{
- Q_Q(QDialogButtonBox);
- QAction::SoftKeyRole softkeyRole;
-
- QAction *action = new QAction(button->text(), button);
-
- switch (role) {
- case ApplyRole:
- case AcceptRole:
- case YesRole:
- case ActionRole:
- case HelpRole:
- softkeyRole = QAction::PositiveSoftKey;
- break;
- case RejectRole:
- case DestructiveRole:
- case NoRole:
- case ResetRole:
- softkeyRole = QAction::NegativeSoftKey;
- break;
- default:
- break;
- }
- QObject::connect(action, SIGNAL(triggered()), button, SIGNAL(clicked()));
- action->setSoftKeyRole(softkeyRole);
-
-
- QWidget *dialog = 0;
- QWidget *p = q;
- while (p && !p->isWindow()) {
- p = p->parentWidget();
- if ((dialog = qobject_cast<QDialog *>(p)))
- break;
- }
-
- if (dialog) {
- dialog->addAction(action);
- } else {
- q->addAction(action);
- }
-
- return action;
-}
-#endif
-
void QDialogButtonBoxPrivate::createStandardButtons(QDialogButtonBox::StandardButtons buttons)
{
uint i = QDialogButtonBox::FirstButton;
@@ -724,11 +641,6 @@ void QDialogButtonBoxPrivate::retranslateStrings()
if (buttonText) {
QPushButton *button = it.key();
button->setText(QDialogButtonBox::tr(buttonText));
-#if defined(QT_SOFTKEYS_ENABLED) && !defined(QT_NO_ACTION)
- QAction *action = softKeyActions.value(button, 0);
- if (action)
- action->setText(button->text());
-#endif
}
++it;
}
@@ -921,11 +833,6 @@ void QDialogButtonBox::setOrientation(Qt::Orientation orientation)
void QDialogButtonBox::clear()
{
Q_D(QDialogButtonBox);
-#ifdef QT_SOFTKEYS_ENABLED
- // Delete softkey actions as they have the buttons as parents
- qDeleteAll(d->softKeyActions.values());
- d->softKeyActions.clear();
-#endif
// Remove the created standard buttons, they should be in the other lists, which will
// do the deletion
d->standardButtonHash.clear();
@@ -1003,13 +910,6 @@ void QDialogButtonBox::removeButton(QAbstractButton *button)
}
}
}
-#if defined(QT_SOFTKEYS_ENABLED) && !defined(QT_NO_ACTION)
- QAction *action = d->softKeyActions.value(button, 0);
- if (action) {
- d->softKeyActions.remove(button);
- delete action;
- }
-#endif
if (!d->internalRemove)
button->setParent(0);
}
@@ -1080,11 +980,6 @@ QPushButton *QDialogButtonBox::addButton(StandardButton button)
void QDialogButtonBox::setStandardButtons(StandardButtons buttons)
{
Q_D(QDialogButtonBox);
-#ifdef QT_SOFTKEYS_ENABLED
- // Delete softkey actions since they have the buttons as parents
- qDeleteAll(d->softKeyActions.values());
- d->softKeyActions.clear();
-#endif
// Clear out all the old standard buttons, then recreate them.
qDeleteAll(d->standardButtonHash.keys());
d->standardButtonHash.clear();
@@ -1242,38 +1137,9 @@ bool QDialogButtonBox::event(QEvent *event)
}
if (!hasDefault && firstAcceptButton)
firstAcceptButton->setDefault(true);
-#ifdef QT_SOFTKEYS_ENABLED
- if (dialog)
- setFixedSize(0,0);
-#endif
}else if (event->type() == QEvent::LanguageChange) {
d->retranslateStrings();
}
-#if defined(QT_SOFTKEYS_ENABLED) && !defined(QT_NO_ACTION)
- else if (event->type() == QEvent::ParentChange) {
- QWidget *dialog = 0;
- QWidget *p = this;
- while (p && !p->isWindow()) {
- p = p->parentWidget();
- if ((dialog = qobject_cast<QDialog *>(p)))
- break;
- }
-
- // If the parent changes, then move the softkeys
- for (QHash<QAbstractButton *, QAction *>::const_iterator it = d->softKeyActions.constBegin();
- it != d->softKeyActions.constEnd(); ++it) {
- QAction *current = it.value();
- QList<QWidget *> widgets = current->associatedWidgets();
- foreach (QWidget *w, widgets)
- w->removeAction(current);
- if (dialog)
- dialog->addAction(current);
- else
- addAction(current);
- }
- }
-#endif
-
return QWidget::event(event);
}
diff --git a/src/widgets/widgets/qlineedit.h b/src/widgets/widgets/qlineedit.h
index 71ffbf2847..f18fd4a34b 100644
--- a/src/widgets/widgets/qlineedit.h
+++ b/src/widgets/widgets/qlineedit.h
@@ -225,6 +225,7 @@ public:
private:
friend class QAbstractSpinBox;
+ friend class QAccessibleLineEdit;
#ifdef QT_KEYPAD_NAVIGATION
friend class QDateTimeEdit;
#endif
diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp
index ffded7839f..fe7e444e86 100644
--- a/src/widgets/widgets/qmenu.cpp
+++ b/src/widgets/widgets/qmenu.cpp
@@ -69,7 +69,6 @@
#include "qpushbutton.h"
#include <private/qpushbutton_p.h>
#include <private/qaction_p.h>
-#include <private/qsoftkeymanager_p.h>
#include <private/qguiapplication_p.h>
QT_BEGIN_NAMESPACE
@@ -158,15 +157,6 @@ void QMenuPrivate::init()
QObject::connect(platformMenu, SIGNAL(aboutToShow()), q, SIGNAL(aboutToShow()));
QObject::connect(platformMenu, SIGNAL(aboutToHide()), q, SIGNAL(aboutToHide()));
}
-
-#ifdef QT_SOFTKEYS_ENABLED
- selectAction = QSoftKeyManager::createKeyedAction(QSoftKeyManager::SelectSoftKey, Qt::Key_Select, q);
- cancelAction = QSoftKeyManager::createKeyedAction(QSoftKeyManager::CancelSoftKey, Qt::Key_Back, q);
- selectAction->setPriority(QAction::HighPriority);
- cancelAction->setPriority(QAction::HighPriority);
- q->addAction(selectAction);
- q->addAction(cancelAction);
-#endif
}
int QMenuPrivate::scrollerHeight() const
@@ -1674,12 +1664,6 @@ void QMenu::clear()
QList<QAction*> acts = actions();
for(int i = 0; i < acts.size(); i++) {
-#ifdef QT_SOFTKEYS_ENABLED
- Q_D(QMenu);
- // Lets not touch to our internal softkey actions
- if(acts[i] == d->selectAction || acts[i] == d->cancelAction)
- continue;
-#endif
removeAction(acts[i]);
if (acts[i]->parent() == this && acts[i]->d_func()->widgets.isEmpty())
delete acts[i];
@@ -2383,13 +2367,6 @@ QMenu::event(QEvent *e)
}
return true;
#endif
-#ifdef QT_SOFTKEYS_ENABLED
- case QEvent::LanguageChange: {
- d->selectAction->setText(QSoftKeyManager::standardSoftKeyText(QSoftKeyManager::SelectSoftKey));
- d->cancelAction->setText(QSoftKeyManager::standardSoftKeyText(QSoftKeyManager::CancelSoftKey));
- }
- break;
-#endif
default:
break;
}
diff --git a/src/widgets/widgets/qmenubar.cpp b/src/widgets/widgets/qmenubar.cpp
index e53dc2cac2..35c665bb25 100644
--- a/src/widgets/widgets/qmenubar.cpp
+++ b/src/widgets/widgets/qmenubar.cpp
@@ -70,10 +70,6 @@
extern bool qt_wince_is_mobile(); //defined in qguifunctions_wce.cpp
#endif
-#ifdef QT_SOFTKEYS_ENABLED
-#include <private/qsoftkeymanager_p.h>
-#endif
-
QT_BEGIN_NAMESPACE
class QMenuBarExtension : public QToolButton
@@ -719,9 +715,6 @@ void QMenuBarPrivate::init()
#endif
q->setBackgroundRole(QPalette::Button);
oldWindow = oldParent = 0;
-#ifdef QT_SOFTKEYS_ENABLED
- menuBarAction = 0;
-#endif
handleReparent();
q->setMouseTracking(q->style()->styleHint(QStyle::SH_MenuBar_MouseTracking, 0, q));
@@ -1285,6 +1278,8 @@ void QMenuBar::actionEvent(QActionEvent *e)
}
} else if (menu) {
menu->setText(e->action()->text());
+ menu->setVisible(e->action()->isVisible());
+ menu->setEnabled(e->action()->isEnabled());
d->platformMenuBar->syncMenu(menu);
}
}
@@ -1403,11 +1398,6 @@ void QMenuBar::changeEvent(QEvent *e)
|| e->type() == QEvent::ApplicationFontChange) {
d->itemsDirty = true;
d->updateGeometries();
-#ifdef QT_SOFTKEYS_ENABLED
- } else if (e->type() == QEvent::LanguageChange) {
- if (d->menuBarAction)
- d->menuBarAction->setText(QSoftKeyManager::standardSoftKeyText(QSoftKeyManager::MenuSoftKey));
-#endif
}
QWidget::changeEvent(e);
diff --git a/src/widgets/widgets/qmenubar_p.h b/src/widgets/widgets/qmenubar_p.h
index 4960c60f83..0f08a4e414 100644
--- a/src/widgets/widgets/qmenubar_p.h
+++ b/src/widgets/widgets/qmenubar_p.h
@@ -188,9 +188,6 @@ public:
void wceRefresh();
bool wceEmitSignals(QList<QWceMenuAction*> actions, uint command);
#endif
-#ifdef QT_SOFTKEYS_ENABLED
- QAction *menuBarAction;
-#endif
};
#endif // QT_NO_MENUBAR
diff --git a/sync.profile b/sync.profile
index d3994fe314..2c27d33e13 100644
--- a/sync.profile
+++ b/sync.profile
@@ -30,6 +30,7 @@
"qevent.h" => "QtEvents",
"qnamespace.h" => "Qt",
"qnumeric.h" => "QtNumeric",
+ "qsql.h" => "QSql",
"qssl.h" => "QSsl",
"qtest.h" => "QTest",
"qtconcurrentmap.h" => "QtConcurrentMap",
@@ -38,65 +39,6 @@
);
%deprecatedheaders = (
"QtGui" => {
- "qplatformaccessibility_qpa.h" => "qpa/qplatformaccessibility.h",
- "QPlatformAccessibility" => "qpa/qplatformaccessibility.h",
- "qplatformbackingstore_qpa.h" => "qpa/qplatformbackingstore.h",
- "QPlatformBackingStore" => "qpa/qplatformbackingstore.h",
- "qplatformclipboard_qpa.h" => "qpa/qplatformclipboard.h",
- "QPlatformClipboard" => "qpa/qplatformclipboard.h",
- "QPlatformColorDialogHelper" => "qpa/qplatformdialoghelper.h",
- "qplatformcursor_qpa.h" => "qpa/qplatformcursor.h",
- "QPlatformCursor" => "qpa/qplatformcursor.h",
- "QPlatformCursorImage" => "qpa/qplatformcursor.h",
- "QPlatformCursorPrivate" => "qpa/qplatformcursor.h",
- "qplatformdrag_qpa.h" => "qpa/qplatformdrag.h",
- "QPlatformDrag" => "qpa/qplatformdrag.h",
- "QPlatformDragQtResponse" => "qpa/qplatformdrag.h",
- "QPlatformDropQtResponse" => "qpa/qplatformdrag.h",
- "qplatformdialoghelper_qpa.h" => "qpa/qplatformdialoghelper.h",
- "QPlatformDialogHelper" => "qpa/qplatformdialoghelper.h",
- "QPlatformFileDialogHelper" => "qpa/qplatformdialoghelper.h",
- "qplatformfontdatabase_qpa.h" => "qpa/qplatformfontdatabase.h",
- "QPlatformFontDatabase" => "qpa/qplatformfontdatabase.h",
- "qplatforminputcontext_qpa.h" => "qpa/qplatforminputcontext.h",
- "QPlatformInputContext" => "qpa/qplatforminputcontext.h",
- "qplatforminputcontext_qpa_p.h" => "qpa/qplatforminputcontext_p.h",
- "qplatformintegration_qpa.h" => "qpa/qplatformintegration.h",
- "QPlatformIntegration" => "qpa/qplatformintegration.h",
- "qplatformintegrationfactory_qpa_p.h" => "qpa/qplatformintegrationfactory_p.h",
- "QPlatformIntegrationFactory" => "qpa/qplatformintegrationfactory_p.h",
- "qplatformintegrationplugin_qpa.h" => "qpa/qplatformintegrationplugin.h",
- "QPlatformIntegrationPlugin" => "qpa/qplatformintegrationplugin.h",
- "qplatformnativeinterface_qpa.h" => "qpa/qplatformnativeinterface.h",
- "QPlatformNativeInterface" => "qpa/qplatformnativeinterface.h",
- "qplatformopenglcontext_qpa.h" => "qpa/qplatformopenglcontext.h",
- "QPlatformOpenGLContext" => "qpa/qplatformopenglcontext.h",
- "qplatformpixmap_qpa.h" => "qpa/qplatformpixmap.h",
- "QPlatformPixmap" => "qpa/qplatformpixmap.h",
- "qplatformscreen_qpa.h" => "qpa/qplatformscreen.h",
- "QPlatformScreen" => "qpa/qplatformscreen.h",
- "qplatformscreen_qpa_p.h" => "qpa/qplatformscreen_p.h",
- "QPlatformScreenBuffer" => "qpa/qplatformscreenpageflipper.h",
- "qplatformscreenpageflipper_qpa.h" => "qpa/qplatformscreenpageflipper.h",
- "QPlatformScreenPageFlipper" => "qpa/qplatformscreenpageflipper.h",
- "qplatformservices_qpa.h" => "qpa/qplatformservices.h",
- "QPlatformServices" => "qpa/qplatformservices.h",
- "qplatformsharedgraphicscache_qpa.h" => "qpa/qplatformsharedgraphicscache.h",
- "QPlatformSharedGraphicsCache" => "qpa/qplatformsharedgraphicscache.h",
- "qplatformsurface_qpa.h" => "qpa/qplatformsurface.h",
- "QPlatformSurface" => "qpa/qplatformsurface.h",
- "qplatformtheme_qpa.h" => "qpa/qplatformtheme.h",
- "QPlatformTheme" => "qpa/qplatformtheme.h",
- "qplatformthemefactory_qpa_p.h" => "qpa/qplatformthemefactory_p.h",
- "qplatformthemeplugin_qpa.h" => "qpa/qplatformthemeplugin.h",
- "QPlatformThemePlugin" => "qpa/qplatformthemeplugin.h",
- "qplatformwindow_qpa.h" => "qpa/qplatformwindow.h",
- "QPlatformWindow" => "qpa/qplatformwindow.h",
- "qwindowsysteminterface_qpa.h" => "qpa/qwindowsysteminterface.h",
- "QWindowSystemInterface" => "qpa/qwindowsysteminterface.h",
- "qwindowsysteminterface_qpa_p.h" => "qpa/qwindowsysteminterface_p.h",
- "qgenericpluginfactory_qpa.h" => "QtGui/qgenericpluginfactory.h",
- "qgenericplugin_qpa.h" => "QtGui/qgenericplugin.h",
"QGenericPlugin" => "QtGui/QGenericPlugin",
"QGenericPluginFactory" => "QtGui/QGenericPluginFactory"
},
@@ -128,9 +70,10 @@
);
@qpa_headers = ( qr/^qplatform/, qr/^qwindowsystem/ );
-@ignore_for_include_check = ( "qsystemdetection.h", "qcompilerdetection.h", "qprocessordetection.h" );
-@ignore_for_qt_begin_header_check = ( "qiconset.h", "qconfig.h", "qconfig-dist.h", "qconfig-large.h", "qconfig-medium.h", "qconfig-minimal.h", "qconfig-small.h", "qfeatures.h", "qt_windows.h" );
-@ignore_for_qt_begin_namespace_check = ( "qconfig.h", "qconfig-dist.h", "qconfig-large.h", "qconfig-medium.h", "qconfig-minimal.h", "qconfig-small.h", "qfeatures.h", "qatomic_arch.h", "qatomic_windowsce.h", "qt_windows.h", "qatomic_macosx.h" );
+my @angle_headers = ('egl.h', 'eglext.h', 'eglplatform.h', 'gl2.h', 'gl2ext.h', 'gl2platform.h', 'ShaderLang.h', 'khrplatform.h');
+@ignore_for_include_check = ( "qsystemdetection.h", "qcompilerdetection.h", "qprocessordetection.h", @angle_headers);
+@ignore_for_qt_begin_header_check = ( "qiconset.h", "qconfig.h", "qconfig-dist.h", "qconfig-large.h", "qconfig-medium.h", "qconfig-minimal.h", "qconfig-small.h", "qfeatures.h", "qt_windows.h", @angle_headers);
+@ignore_for_qt_begin_namespace_check = ( "qconfig.h", "qconfig-dist.h", "qconfig-large.h", "qconfig-medium.h", "qconfig-minimal.h", "qconfig-small.h", "qfeatures.h", "qatomic_arch.h", "qatomic_windowsce.h", "qt_windows.h", "qatomic_macosx.h", @angle_headers);
@ignore_for_qt_module_check = ( "$modules{QtCore}/arch", "$modules{QtCore}/global", "$modules{QtTest}", "$modules{QtDBus}" );
%inject_headers = ( "$basedir/src/corelib/global" => [ "qconfig.h" ] );
# Module dependencies.
diff --git a/tests/auto/cmake/CMakeLists.txt b/tests/auto/cmake/CMakeLists.txt
index 3217fa3cfd..46dcdcca2b 100644
--- a/tests/auto/cmake/CMakeLists.txt
+++ b/tests/auto/cmake/CMakeLists.txt
@@ -74,7 +74,6 @@ if (NOT WIN32)
expect_pass(test_add_resources_delayed_file)
endif()
expect_pass(test_private_includes)
-expect_pass(test_modules)
expect_pass(test_testlib_definitions)
expect_pass(test_json_plugin_includes)
@@ -89,3 +88,26 @@ execute_process(COMMAND ${CMAKE_COMMAND} -E copy
"${CMAKE_CURRENT_SOURCE_DIR}/test_testlib_definitions/main.cpp"
"${CMAKE_CURRENT_BINARY_DIR}/failbuild/test_testlib_no_link_widgets/test_testlib_no_link_widgets/"
)
+
+set(qt_module_includes
+ Core QObject
+ Gui QImage
+ Widgets QWidget
+ Network QHostInfo
+ OpenGL QGLBuffer
+ Sql QSqlError
+ Test QTestEventList
+ Xml QDomDocument
+ PrintSupport QPrintDialog
+)
+
+if (UNIX AND NOT APPLE AND NOT QNXNTO)
+ list(APPEND qt_module_includes
+ DBus QDBusMessage
+ )
+endif()
+
+test_module_includes(
+ ${qt_module_includes}
+)
+expect_pass(test_concurrent_module)
diff --git a/tests/auto/cmake/test_concurrent_module/CMakeLists.txt b/tests/auto/cmake/test_concurrent_module/CMakeLists.txt
new file mode 100644
index 0000000000..efd7b725ea
--- /dev/null
+++ b/tests/auto/cmake/test_concurrent_module/CMakeLists.txt
@@ -0,0 +1,22 @@
+
+cmake_minimum_required(VERSION 2.8)
+
+project(test_concurrent_module)
+
+find_package(Qt5Concurrent REQUIRED)
+
+include_directories(
+ ${Qt5Concurrent_INCLUDE_DIRS}
+)
+
+add_definitions(
+ ${Qt5Concurrent_DEFINITIONS}
+)
+
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Core_EXECUTABLE_COMPILE_FLAGS}")
+
+add_executable(mainapp main.cpp)
+
+target_link_libraries(mainapp
+ ${Qt5Concurrent_LIBRARIES}
+)
diff --git a/tests/auto/cmake/test_modules/main.cpp b/tests/auto/cmake/test_concurrent_module/main.cpp
index 2bb885dd5c..e5693be9bf 100644
--- a/tests/auto/cmake/test_modules/main.cpp
+++ b/tests/auto/cmake/test_concurrent_module/main.cpp
@@ -39,44 +39,15 @@
**
****************************************************************************/
-#include <QString>
-#include <qtconcurrentiteratekernel.h>
-#include <QImage>
-#include <QHostAddress>
-#include <QGLBuffer>
-#include <QSqlQuery>
-#include <QtTest>
-#include <QWidget>
-#include <QDomDocument>
-#include <QPrintDialog>
-
-#ifdef EXPECT_DBUS_AVAILABLE
-#include <QDBusMessage>
-#endif
+#include <QtConcurrent>
+#include <QtConcurrent/QtConcurrent>
+#include <QtConcurrent/QtConcurrentRun>
+#include <QtConcurrentRun>
int main(int argc, char **argv)
{
- QObject object;
-
- QtConcurrent::BlockSizeManager blockSizeManager(42);
-
- QHostAddress hostAddress;
-
- QGLBuffer glBuffer;
-
- QSqlQuery sqlQuery;
-
- QSignalSpy signalSpy(&object, SIGNAL(destroyed()));
-
- QWidget widget;
-
- QDomDocument domDocument;
-
- QPrintDialog printDialog;
-
-#ifdef EXPECT_DBUS_AVAILABLE
- QDBusMessage dBusMessage;
-#endif
+ QByteArray bytearray = "hello world";
+ QtConcurrent::run(bytearray, &QByteArray::split, ',');
return 0;
}
diff --git a/tests/auto/cmake/test_modules/CMakeLists.txt b/tests/auto/cmake/test_modules/CMakeLists.txt
deleted file mode 100644
index 30a726b10f..0000000000
--- a/tests/auto/cmake/test_modules/CMakeLists.txt
+++ /dev/null
@@ -1,44 +0,0 @@
-
-cmake_minimum_required(VERSION 2.8)
-
-project(test_modules)
-
-set(qtbase_modules
- Core
- Concurrent
- Gui
- Widgets
- Network
- OpenGL
- Sql
- Test
- Xml
- PrintSupport
-)
-
-if (UNIX AND NOT APPLE AND NOT QNXNTO)
- add_definitions(-DEXPECT_DBUS_AVAILABLE)
- list(APPEND qtbase_modules DBus)
-endif()
-
-foreach(_module ${qtbase_modules})
- find_package(Qt5${_module} REQUIRED)
-
- include_directories(
- ${Qt5${_module}_INCLUDE_DIRS}
- )
-
- add_definitions(
- ${Qt5${_module}_DEFINITIONS}
- )
-endforeach()
-
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Core_EXECUTABLE_COMPILE_FLAGS}")
-
-add_executable(mainapp main.cpp)
-
-foreach(_module ${qtbase_modules})
- target_link_libraries(mainapp
- ${Qt5${_module}_LIBRARIES}
- )
-endforeach()
diff --git a/tests/auto/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp b/tests/auto/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp
index c50e3839b5..b6bc5b085b 100644
--- a/tests/auto/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp
+++ b/tests/auto/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp
@@ -43,6 +43,7 @@
#include <qdebug.h>
#include <QThread>
+#include <QMutex>
#include <QtTest/QtTest>
@@ -75,6 +76,7 @@ private slots:
void stlContainers();
void qFutureAssignmentLeak();
void stressTest();
+ void persistentResultTest();
public slots:
void throttling();
};
@@ -2395,5 +2397,46 @@ void tst_QtConcurrentMap::stressTest()
}
}
+struct LockedCounter
+{
+ LockedCounter(QMutex *mutex, QAtomicInt *ai)
+ : mtx(mutex),
+ ref(ai) {}
+
+ typedef int result_type;
+ int operator()(int x)
+ {
+ QMutexLocker locker(mtx);
+ ref->ref();
+ return ++x;
+ }
+
+ QMutex *mtx;
+ QAtomicInt *ref;
+};
+
+// The Thread engine holds the last reference
+// to the QFuture, so this should not leak
+// or fail.
+void tst_QtConcurrentMap::persistentResultTest()
+{
+ QFuture<void> voidFuture;
+ QMutex mtx;
+ QAtomicInt ref;
+ LockedCounter lc(&mtx, &ref);
+ QList<int> list;
+ {
+ list << 1 << 2 << 3;
+ mtx.lock();
+ QFuture<int> future = QtConcurrent::mapped(list
+ ,lc);
+ voidFuture = future;
+ }
+ QCOMPARE(ref.loadAcquire(), 0);
+ mtx.unlock(); // Unblock
+ voidFuture.waitForFinished();
+ QCOMPARE(ref.loadAcquire(), 3);
+}
+
QTEST_MAIN(tst_QtConcurrentMap)
#include "tst_qtconcurrentmap.moc"
diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp
index 1f2d4fe4f5..fe378b2095 100644
--- a/tests/auto/corelib/io/qfile/tst_qfile.cpp
+++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp
@@ -1027,14 +1027,44 @@ void tst_QFile::ungetChar()
QCOMPARE(buf[2], '4');
}
+#ifdef Q_OS_WIN
+QString driveLetters()
+{
+ wchar_t volumeName[MAX_PATH];
+ wchar_t path[MAX_PATH];
+ const HANDLE h = FindFirstVolumeW(volumeName, MAX_PATH);
+ if (h == INVALID_HANDLE_VALUE)
+ return QString();
+ QString result;
+ do {
+ if (GetVolumePathNamesForVolumeNameW(volumeName, path, MAX_PATH, NULL)) {
+ if (path[1] == L':')
+ result.append(QChar(path[0]));
+ }
+ } while (FindNextVolumeW(h, volumeName, MAX_PATH));
+ FindVolumeClose(h);
+ return result;
+}
+
+static inline QChar invalidDriveLetter()
+{
+ const QString drives = driveLetters().toLower();
+ for (char c = 'a'; c <= 'z'; ++c)
+ if (!drives.contains(QLatin1Char(c)))
+ return QLatin1Char(c);
+ Q_ASSERT(false); // All drive letters used?!
+ return QChar();
+}
+
+#endif // Q_OS_WIN
+
void tst_QFile::invalidFile_data()
{
QTest::addColumn<QString>("fileName");
#if !defined(Q_OS_WIN)
QTest::newRow( "x11" ) << QString( "qwe//" );
#else
- QTest::newRow( "colon1" ) << QString( "fail:invalid" );
- QTest::newRow( "colon2" ) << QString( "f:ail:invalid" );
+ QTest::newRow( "colon2" ) << invalidDriveLetter() + QString::fromLatin1(":ail:invalid");
QTest::newRow( "colon3" ) << QString( ":failinvalid" );
QTest::newRow( "forwardslash" ) << QString( "fail/invalid" );
QTest::newRow( "asterisk" ) << QString( "fail*invalid" );
@@ -1050,8 +1080,7 @@ void tst_QFile::invalidFile()
{
QFETCH( QString, fileName );
QFile f( fileName );
- QEXPECT_FAIL("colon1", "QTBUG-27306", Continue);
- QVERIFY( !f.open( QIODevice::ReadWrite ) );
+ QVERIFY2( !f.open( QIODevice::ReadWrite ), qPrintable(fileName) );
}
void tst_QFile::createFile()
diff --git a/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp b/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp
index 76fa6022ba..82eaa64bc2 100644
--- a/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp
+++ b/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp
@@ -183,6 +183,9 @@ void tst_QFileSystemWatcher::basicTest()
// change the permissions, should get a signal from the watcher
testFile.setPermissions(QFile::ReadOwner);
+ // IN_ATTRIB doesn't work on QNX, so skip this test
+#if !defined(Q_OS_QNX)
+
// waiting max 5 seconds for notification for file permission modification to trigger
QTRY_COMPARE(changedSpy.count(), 1);
QCOMPARE(changedSpy.at(0).count(), 1);
@@ -190,6 +193,8 @@ void tst_QFileSystemWatcher::basicTest()
fileName = changedSpy.at(0).at(0).toString();
QCOMPARE(fileName, testFile.fileName());
+#endif
+
changedSpy.clear();
// remove the watch and modify file permissions, should not get a signal from the watcher
diff --git a/tests/auto/corelib/io/qprocess/test/test.pro b/tests/auto/corelib/io/qprocess/test/test.pro
index 458bbca738..79ea53cc6b 100644
--- a/tests/auto/corelib/io/qprocess/test/test.pro
+++ b/tests/auto/corelib/io/qprocess/test/test.pro
@@ -11,7 +11,6 @@ win32:TESTDATA += ../testBatFiles/*
include(../qprocess.pri)
-win32:CONFIG += insignificant_test # QTBUG-25342 - sometimes hangs
mac:CONFIG += insignificant_test # QTBUG-25895 - sometimes hangs
for(file, SUBPROGRAMS): TEST_HELPER_INSTALLS += "../$${file}/$${file}"
diff --git a/tests/auto/corelib/io/qprocess/testForwarding/main.cpp b/tests/auto/corelib/io/qprocess/testForwarding/main.cpp
index ca0dc3986a..126a63c19c 100644
--- a/tests/auto/corelib/io/qprocess/testForwarding/main.cpp
+++ b/tests/auto/corelib/io/qprocess/testForwarding/main.cpp
@@ -43,6 +43,7 @@
int main()
{
+#ifndef QT_NO_PROCESS
QProcess process;
process.setProcessChannelMode(QProcess::ForwardedChannels);
if (process.processChannelMode() != QProcess::ForwardedChannels)
@@ -62,6 +63,6 @@ int main()
process.closeWriteChannel();
process.waitForFinished(5000);
-
+#endif
return 0;
}
diff --git a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp
index 22c88ca1fa..49188c3057 100644
--- a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp
+++ b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp
@@ -75,6 +75,8 @@ class tst_QProcess : public QObject
public slots:
void initTestCase();
+ void cleanupTestCase();
+
#ifndef QT_NO_PROCESS
private slots:
void getSetCheck();
@@ -84,27 +86,23 @@ private slots:
void startDetached();
void crashTest();
void crashTest2();
+#ifndef Q_OS_WINCE
void echoTest_data();
void echoTest();
void echoTest2();
-#if defined Q_OS_WIN
+#ifdef Q_OS_WIN
void echoTestGui();
void batFiles_data();
void batFiles();
#endif
- void exitStatus_data();
- void exitStatus();
void loopBackTest();
void readTimeoutAndThenCrash();
- void waitForFinished();
void deadWhileReading();
void restartProcessDeadlock();
void closeWriteChannel();
void closeReadChannel();
void openModes();
void emitReadyReadOnlyWhenNewDataArrives();
- void hardExit();
- void softExit();
void softExitInSlots_data();
void softExitInSlots();
void mergedChannels();
@@ -112,25 +110,14 @@ private slots:
void forwardedChannelsOutput();
void atEnd();
void atEnd2();
- void processInAThread();
- void processesInMultipleThreads();
void waitForFinishedWithTimeout();
void waitForReadyReadInAReadyReadSlot();
void waitForBytesWrittenInABytesWrittenSlot();
- void spaceArgsTest_data();
- void spaceArgsTest();
-#if defined(Q_OS_WIN)
- void nativeArguments();
-#endif
- void exitCodeTest();
void setEnvironment_data();
void setEnvironment();
void setProcessEnvironment_data();
void setProcessEnvironment();
- void systemEnvironment();
void spaceInName();
- void lockupsInStartDetached();
- void waitForReadyReadForNonexistantProcess();
void setStandardInputFile();
void setStandardOutputFile_data();
void setStandardOutputFile();
@@ -138,9 +125,29 @@ private slots:
void setStandardOutputProcess();
void removeFileWhileProcessIsRunning();
void fileWriterProcess();
- void detachedWorkingDirectoryAndPid();
void switchReadChannels();
+#ifdef Q_OS_WIN
void setWorkingDirectory();
+#endif // Q_OS_WIN
+#endif // not Q_OS_WINCE
+
+ void exitStatus_data();
+ void exitStatus();
+ void waitForFinished();
+ void hardExit();
+ void softExit();
+ void processInAThread();
+ void processesInMultipleThreads();
+ void spaceArgsTest_data();
+ void spaceArgsTest();
+#if defined(Q_OS_WIN)
+ void nativeArguments();
+#endif
+ void exitCodeTest();
+ void systemEnvironment();
+ void lockupsInStartDetached();
+ void waitForReadyReadForNonexistantProcess();
+ void detachedWorkingDirectoryAndPid();
void startFinishStartFinish();
void invalidProgramString_data();
void invalidProgramString();
@@ -155,14 +162,16 @@ private slots:
protected slots:
void readFromProcess();
void exitLoopSlot();
+#ifndef Q_OS_WINCE
void restartProcess();
void waitForReadyReadInAReadyReadSlotSlot();
void waitForBytesWrittenInABytesWrittenSlotSlot();
+#endif
private:
QProcess *process;
qint64 bytesAvailable;
-#endif
+#endif //QT_NO_PROCESS
};
void tst_QProcess::initTestCase()
@@ -176,6 +185,13 @@ void tst_QProcess::initTestCase()
#endif
}
+void tst_QProcess::cleanupTestCase()
+{
+#ifdef QT_NO_PROCESS
+ QSKIP("This test requires QProcess support");
+#endif
+}
+
#ifndef QT_NO_PROCESS
// Testing get/set functions
@@ -299,9 +315,6 @@ void tst_QProcess::readFromProcess()
void tst_QProcess::crashTest()
{
qRegisterMetaType<QProcess::ProcessState>("QProcess::ProcessState");
-#ifdef Q_OS_WIN
- QSKIP("This test opens a crash dialog on Windows");
-#endif
process = new QProcess;
QSignalSpy stateSpy(process, SIGNAL(stateChanged(QProcess::ProcessState)));
QVERIFY(stateSpy.isValid());
@@ -339,9 +352,6 @@ void tst_QProcess::crashTest()
//-----------------------------------------------------------------------------
void tst_QProcess::crashTest2()
{
-#ifdef Q_OS_WIN
- QSKIP("This test opens a crash dialog on Windows");
-#endif
process = new QProcess;
process->start("testProcessCrash/testProcessCrash");
QVERIFY(process->waitForStarted(5000));
@@ -373,6 +383,8 @@ void tst_QProcess::crashTest2()
process = 0;
}
+#ifndef Q_OS_WINCE
+//Reading and writing to a process is not supported on Qt/CE
//-----------------------------------------------------------------------------
void tst_QProcess::echoTest_data()
{
@@ -389,12 +401,9 @@ void tst_QProcess::echoTest_data()
}
//-----------------------------------------------------------------------------
+
void tst_QProcess::echoTest()
{
-#ifdef Q_OS_WINCE
- QSKIP("Reading and writing to a process is not supported on Qt/CE");
-#endif
-
QFETCH(QByteArray, input);
process = new QProcess;
@@ -435,6 +444,7 @@ void tst_QProcess::echoTest()
delete process;
process = 0;
}
+#endif
//-----------------------------------------------------------------------------
void tst_QProcess::exitLoopSlot()
@@ -443,11 +453,11 @@ void tst_QProcess::exitLoopSlot()
}
//-----------------------------------------------------------------------------
+
+#ifndef Q_OS_WINCE
+// Reading and writing to a process is not supported on Qt/CE
void tst_QProcess::echoTest2()
{
-#ifdef Q_OS_WINCE
- QSKIP("Reading and writing to a process is not supported on Qt/CE");
-#endif
process = new QProcess;
connect(process, SIGNAL(readyRead()), this, SLOT(exitLoopSlot()));
@@ -491,15 +501,14 @@ void tst_QProcess::echoTest2()
delete process;
process = 0;
}
+#endif
-#if defined Q_OS_WIN
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+//Batch files are not supported on Winfows CE
+// Reading and writing to a process is not supported on Qt/CE
//-----------------------------------------------------------------------------
void tst_QProcess::echoTestGui()
{
-#ifdef Q_OS_WINCE
- QSKIP("Reading and writing to a process is not supported on Qt/CE");
-#endif
-
QProcess process;
process.start("testProcessEchoGui/testProcessEchoGui");
@@ -513,22 +522,22 @@ void tst_QProcess::echoTestGui()
QCOMPARE(process.readAllStandardOutput(), QByteArray("Hello"));
QCOMPARE(process.readAllStandardError(), QByteArray("Hello"));
}
+#endif // !Q_OS_WINCE && Q_OS_WIN
//-----------------------------------------------------------------------------
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+//Batch files are not supported on Winfows CE
void tst_QProcess::batFiles_data()
{
QTest::addColumn<QString>("batFile");
QTest::addColumn<QByteArray>("output");
- QTest::newRow("simple") << QString::fromLatin1("testBatFiles/simple.bat") << QByteArray("Hello");
- QTest::newRow("with space") << QString::fromLatin1("testBatFiles/with space.bat") << QByteArray("Hello");
+ QTest::newRow("simple") << QFINDTESTDATA("testBatFiles/simple.bat") << QByteArray("Hello");
+ QTest::newRow("with space") << QFINDTESTDATA("testBatFiles/with space.bat") << QByteArray("Hello");
}
void tst_QProcess::batFiles()
{
-#if defined(Q_OS_WINCE)
- QSKIP("Batch files are not supported on Windows CE");
-#endif
QFETCH(QString, batFile);
QFETCH(QByteArray, output);
@@ -542,8 +551,7 @@ void tst_QProcess::batFiles()
QVERIFY(proc.readAll().startsWith(output));
}
-
-#endif
+#endif // !Q_OS_WINCE && Q_OS_WIN
//-----------------------------------------------------------------------------
void tst_QProcess::exitStatus_data()
@@ -576,11 +584,6 @@ void tst_QProcess::exitStatus()
QFETCH(QStringList, processList);
QFETCH(QList<QProcess::ExitStatus>, exitStatus);
-#ifdef Q_OS_WIN
- if (exitStatus.contains(QProcess::CrashExit))
- QSKIP("This test opens a crash dialog on Windows");
-#endif
-
QCOMPARE(exitStatus.count(), processList.count());
for (int i = 0; i < processList.count(); ++i) {
process->start(processList.at(i));
@@ -594,11 +597,10 @@ void tst_QProcess::exitStatus()
process = 0;
}
//-----------------------------------------------------------------------------
+#ifndef Q_OS_WINCE
+// Reading and writing to a process is not supported on Qt/CE
void tst_QProcess::loopBackTest()
{
-#ifdef Q_OS_WINCE
- QSKIP("Reading and writing to a process is not supported on Qt/CE");
-#endif
process = new QProcess;
process->start("testProcessEcho/testProcessEcho");
@@ -618,13 +620,13 @@ void tst_QProcess::loopBackTest()
delete process;
process = 0;
}
+#endif
//-----------------------------------------------------------------------------
+#ifndef Q_OS_WINCE
+// Reading and writing to a process is not supported on Qt/CE
void tst_QProcess::readTimeoutAndThenCrash()
{
-#ifdef Q_OS_WINCE
- QSKIP("Reading and writing to a process is not supported on Qt/CE");
-#endif
process = new QProcess;
process->start("testProcessEcho/testProcessEcho");
@@ -652,6 +654,7 @@ void tst_QProcess::readTimeoutAndThenCrash()
delete process;
process = 0;
}
+#endif
void tst_QProcess::waitForFinished()
{
@@ -677,12 +680,10 @@ void tst_QProcess::waitForFinished()
QCOMPARE(process.error(), QProcess::FailedToStart);
}
+#ifndef Q_OS_WINCE
+// Reading and writing to a process is not supported on Qt/CE
void tst_QProcess::deadWhileReading()
{
-#ifdef Q_OS_WINCE
- QSKIP("Reading and writing to a process is not supported on Qt/CE");
-#endif
-
QProcess process;
process.start("testProcessDeadWhileReading/testProcessDeadWhileReading");
@@ -696,13 +697,13 @@ void tst_QProcess::deadWhileReading()
QCOMPARE(output.count("\n"), 10*1024);
process.waitForFinished();
}
+#endif
//-----------------------------------------------------------------------------
+#ifndef Q_OS_WINCE
+// Reading and writing to a process is not supported on Qt/CE
void tst_QProcess::restartProcessDeadlock()
{
-#ifdef Q_OS_WINCE
- QSKIP("Reading and writing to a process is not supported on Qt/CE");
-#endif
// The purpose of this test is to detect whether restarting a
// process in the finished() connected slot causes a deadlock
@@ -726,14 +727,13 @@ void tst_QProcess::restartProcess()
{
process->start("testProcessEcho/testProcessEcho");
}
+#endif
//-----------------------------------------------------------------------------
+#ifndef Q_OS_WINCE
+// Reading and writing to a process is not supported on Qt/CE
void tst_QProcess::closeWriteChannel()
{
-#ifdef Q_OS_WINCE
- QSKIP("Reading and writing to a process is not supported on Qt/CE");
-#endif
-
QProcess more;
more.start("testProcessEOF/testProcessEOF");
@@ -755,14 +755,13 @@ void tst_QProcess::closeWriteChannel()
more.write("q");
QVERIFY(more.waitForFinished(5000));
}
+#endif
//-----------------------------------------------------------------------------
+#ifndef Q_OS_WINCE
+// Reading and writing to a process is not supported on Qt/CE"
void tst_QProcess::closeReadChannel()
{
-#ifdef Q_OS_WINCE
- QSKIP("Reading and writing to a process is not supported on Qt/CE");
-#endif
-
for (int i = 0; i < 10; ++i) {
QProcess::ProcessChannel channel1 = QProcess::StandardOutput;
QProcess::ProcessChannel channel2 = QProcess::StandardError;
@@ -788,14 +787,13 @@ void tst_QProcess::closeReadChannel()
QVERIFY(proc.waitForFinished(5000));
}
}
+#endif
//-----------------------------------------------------------------------------
+#ifndef Q_OS_WINCE
+// Reading and writing to a process is not supported on Qt/CE
void tst_QProcess::openModes()
{
-#ifdef Q_OS_WINCE
- QSKIP("Reading and writing to a process is not supported on Qt/CE");
-#endif
-
QProcess proc;
QVERIFY(!proc.isOpen());
QVERIFY(proc.openMode() == QProcess::NotOpen);
@@ -834,13 +832,13 @@ void tst_QProcess::openModes()
QVERIFY(!proc.isWritable());
QCOMPARE(proc.state(), QProcess::NotRunning);
}
+#endif
//-----------------------------------------------------------------------------
+#ifndef Q_OS_WINCE
+// Reading and writing to a process is not supported on Qt/CE
void tst_QProcess::emitReadyReadOnlyWhenNewDataArrives()
{
-#ifdef Q_OS_WINCE
- QSKIP("Reading and writing to a process is not supported on Qt/CE");
-#endif
QProcess proc;
connect(&proc, SIGNAL(readyRead()), this, SLOT(exitLoopSlot()));
@@ -870,6 +868,7 @@ void tst_QProcess::emitReadyReadOnlyWhenNewDataArrives()
proc.write("", 1);
QVERIFY(proc.waitForFinished(5000));
}
+#endif
//-----------------------------------------------------------------------------
void tst_QProcess::hardExit()
@@ -914,6 +913,8 @@ void tst_QProcess::softExit()
QCOMPARE(int(proc.error()), int(QProcess::UnknownError));
}
+#ifndef Q_OS_WINCE
+// Reading and writing to a process is not supported on Qt/CE
class SoftExitProcess : public QProcess
{
Q_OBJECT
@@ -1011,14 +1012,10 @@ void tst_QProcess::softExitInSlots_data()
#endif
QTest::newRow("console app") << "testProcessEcho2/testProcessEcho2";
}
-
//-----------------------------------------------------------------------------
+
void tst_QProcess::softExitInSlots()
{
-#ifdef Q_OS_WINCE
- QSKIP("Reading and writing to a process is not supported on Qt/CE");
-#endif
-
QFETCH(QString, appName);
for (int i = 0; i < 5; ++i) {
@@ -1029,14 +1026,13 @@ void tst_QProcess::softExitInSlots()
QCOMPARE(proc.state(), QProcess::NotRunning);
}
}
+#endif
//-----------------------------------------------------------------------------
+#ifndef Q_OS_WINCE
+// Reading and writing to a process is not supported on Qt/CE
void tst_QProcess::mergedChannels()
{
-#ifdef Q_OS_WINCE
- QSKIP("Reading and writing to a process is not supported on Qt/CE");
-#endif
-
QProcess process;
process.setReadChannelMode(QProcess::MergedChannels);
QCOMPARE(process.readChannelMode(), QProcess::MergedChannels);
@@ -1055,14 +1051,13 @@ void tst_QProcess::mergedChannels()
process.closeWriteChannel();
QVERIFY(process.waitForFinished(5000));
}
+#endif
//-----------------------------------------------------------------------------
+#ifndef Q_OS_WINCE
+// Reading and writing to a process is not supported on Qt/CE
void tst_QProcess::forwardedChannels()
{
-#ifdef Q_OS_WINCE
- QSKIP("Reading and writing to a process is not supported on Qt/CE");
-#endif
-
QProcess process;
process.setReadChannelMode(QProcess::ForwardedChannels);
QCOMPARE(process.readChannelMode(), QProcess::ForwardedChannels);
@@ -1077,13 +1072,12 @@ void tst_QProcess::forwardedChannels()
process.closeWriteChannel();
QVERIFY(process.waitForFinished(5000));
}
+#endif
+#ifndef Q_OS_WINCE
+// Reading and writing to a process is not supported on Qt/CE
void tst_QProcess::forwardedChannelsOutput()
{
-#ifdef Q_OS_WINCE
- QSKIP("Reading and writing to a process is not supported on Qt/CE");
-#endif
-
QProcess process;
process.start("testForwarding/testForwarding");
QVERIFY(process.waitForStarted(5000));
@@ -1093,14 +1087,13 @@ void tst_QProcess::forwardedChannelsOutput()
QVERIFY(!data.isEmpty());
QVERIFY(data.contains("forwarded"));
}
+#endif
//-----------------------------------------------------------------------------
+#ifndef Q_OS_WINCE
+// Reading and writing to a process is not supported on Qt/CE
void tst_QProcess::atEnd()
{
-#ifdef Q_OS_WINCE
- QSKIP("Reading and writing to a process is not supported on Qt/CE");
-#endif
-
QProcess process;
process.start("testProcessEcho/testProcessEcho");
@@ -1118,6 +1111,7 @@ void tst_QProcess::atEnd()
process.write("", 1);
QVERIFY(process.waitForFinished(5000));
}
+#endif
class TestThread : public QThread
{
@@ -1190,12 +1184,10 @@ void tst_QProcess::processesInMultipleThreads()
}
//-----------------------------------------------------------------------------
+#ifndef Q_OS_WINCE
+// Reading and writing to a process is not supported on Qt/CE
void tst_QProcess::waitForFinishedWithTimeout()
{
-#ifdef Q_OS_WINCE
- QSKIP("Reading and writing to a process is not supported on Qt/CE");
-#endif
-
process = new QProcess(this);
process->start("testProcessEcho/testProcessEcho");
@@ -1210,14 +1202,13 @@ void tst_QProcess::waitForFinishedWithTimeout()
delete process;
process = 0;
}
+#endif
//-----------------------------------------------------------------------------
+#ifndef Q_OS_WINCE
+// Reading and writing to a process is not supported on Qt/CE
void tst_QProcess::waitForReadyReadInAReadyReadSlot()
{
-#ifdef Q_OS_WINCE
- QSKIP("Reading and writing to a process is not supported on Qt/CE");
-#endif
-
process = new QProcess(this);
connect(process, SIGNAL(readyRead()), this, SLOT(waitForReadyReadInAReadyReadSlotSlot()));
connect(process, SIGNAL(finished(int)), this, SLOT(exitLoopSlot()));
@@ -1240,27 +1231,25 @@ void tst_QProcess::waitForReadyReadInAReadyReadSlot()
delete process;
process = 0;
}
+#endif
//-----------------------------------------------------------------------------
+#ifndef Q_OS_WINCE
+// Reading and writing to a process is not supported on Qt/CE
void tst_QProcess::waitForReadyReadInAReadyReadSlotSlot()
{
-#ifdef Q_OS_WINCE
- QSKIP("Reading and writing to a process is not supported on Qt/CE");
-#endif
-
bytesAvailable = process->bytesAvailable();
process->write("bar", 4);
QVERIFY(process->waitForReadyRead(5000));
QTestEventLoop::instance().exitLoop();
}
+#endif
//-----------------------------------------------------------------------------
+#ifndef Q_OS_WINCE
+// Reading and writing to a process is not supported on Qt/CE
void tst_QProcess::waitForBytesWrittenInABytesWrittenSlot()
{
-#ifdef Q_OS_WINCE
- QSKIP("Reading and writing to a process is not supported on Qt/CE");
-#endif
-
process = new QProcess(this);
connect(process, SIGNAL(bytesWritten(qint64)), this, SLOT(waitForBytesWrittenInABytesWrittenSlotSlot()));
bytesAvailable = 0;
@@ -1282,19 +1271,18 @@ void tst_QProcess::waitForBytesWrittenInABytesWrittenSlot()
delete process;
process = 0;
}
+#endif
//-----------------------------------------------------------------------------
+#ifndef Q_OS_WINCE
+// Reading and writing to a process is not supported on Qt/CE
void tst_QProcess::waitForBytesWrittenInABytesWrittenSlotSlot()
{
-#ifdef Q_OS_WINCE
- QSKIP("Reading and writing to a process is not supported on Qt/CE");
-#endif
-
process->write("b");
QVERIFY(process->waitForBytesWritten(5000));
QTestEventLoop::instance().exitLoop();
}
-
+#endif
//-----------------------------------------------------------------------------
void tst_QProcess::spaceArgsTest_data()
{
@@ -1604,12 +1592,10 @@ void tst_QProcess::failToStartWithEventLoop()
}
//-----------------------------------------------------------------------------
+#ifndef Q_OS_WINCE
+// Reading and writing to a process is not supported on Qt/CE
void tst_QProcess::removeFileWhileProcessIsRunning()
{
-#ifdef Q_OS_WINCE
- QSKIP("Reading and writing to a process is not supported on Qt/CE");
-#endif
-
QFile file("removeFile.txt");
QVERIFY(file.open(QFile::WriteOnly));
@@ -1623,8 +1609,10 @@ void tst_QProcess::removeFileWhileProcessIsRunning()
process.write("", 1);
QVERIFY(process.waitForFinished(5000));
}
-
+#endif
//-----------------------------------------------------------------------------
+#ifndef Q_OS_WINCE
+// OS doesn't support environment variables
void tst_QProcess::setEnvironment_data()
{
QTest::addColumn<QString>("name");
@@ -1644,10 +1632,6 @@ void tst_QProcess::setEnvironment_data()
void tst_QProcess::setEnvironment()
{
-#if defined (Q_OS_WINCE)
- QSKIP("OS doesn't support environment variables");
-#endif
-
// make sure our environment variables are correct
QVERIFY(qgetenv("tst_QProcess").isEmpty());
QVERIFY(!qgetenv("PATH").isEmpty());
@@ -1703,8 +1687,10 @@ void tst_QProcess::setEnvironment()
QCOMPARE(process.readAll(), value.toLocal8Bit());
}
}
-
+#endif
//-----------------------------------------------------------------------------
+#ifndef Q_OS_WINCE
+// OS doesn't support environment variables
void tst_QProcess::setProcessEnvironment_data()
{
setEnvironment_data();
@@ -1712,10 +1698,6 @@ void tst_QProcess::setProcessEnvironment_data()
void tst_QProcess::setProcessEnvironment()
{
-#if defined (Q_OS_WINCE)
- QSKIP("OS doesn't support environment variables");
-#endif
-
// make sure our environment variables are correct
QVERIFY(qgetenv("tst_QProcess").isEmpty());
QVERIFY(!qgetenv("PATH").isEmpty());
@@ -1746,6 +1728,7 @@ void tst_QProcess::setProcessEnvironment()
QCOMPARE(process.readAll(), value.toLocal8Bit());
}
}
+#endif
//-----------------------------------------------------------------------------
void tst_QProcess::systemEnvironment()
{
@@ -1763,17 +1746,17 @@ void tst_QProcess::systemEnvironment()
}
//-----------------------------------------------------------------------------
+#ifndef Q_OS_WINCE
+// Reading and writing to a process is not supported on Qt/CE
void tst_QProcess::spaceInName()
{
-#ifdef Q_OS_WINCE
- QSKIP("Reading and writing to a process is not supported on Qt/CE");
-#endif
QProcess process;
process.start("test Space In Name/testSpaceInName", QStringList());
QVERIFY(process.waitForStarted());
process.write("", 1);
QVERIFY(process.waitForFinished());
}
+#endif
//-----------------------------------------------------------------------------
void tst_QProcess::lockupsInStartDetached()
@@ -1790,12 +1773,10 @@ void tst_QProcess::lockupsInStartDetached()
}
//-----------------------------------------------------------------------------
+#ifndef Q_OS_WINCE
+// Reading and writing to a process is not supported on Qt/CE
void tst_QProcess::atEnd2()
{
-#ifdef Q_OS_WINCE
- QSKIP("Reading and writing to a process is not supported on Qt/CE");
-#endif
-
QProcess process;
process.start("testProcessEcho/testProcessEcho");
@@ -1808,6 +1789,7 @@ void tst_QProcess::atEnd2()
}
QCOMPARE(lines.size(), 7);
}
+#endif
//-----------------------------------------------------------------------------
void tst_QProcess::waitForReadyReadForNonexistantProcess()
@@ -1835,12 +1817,10 @@ void tst_QProcess::waitForReadyReadForNonexistantProcess()
}
//-----------------------------------------------------------------------------
+#ifndef Q_OS_WINCE
+// Reading and writing to a process is not supported on Qt/CE
void tst_QProcess::setStandardInputFile()
{
-#ifdef Q_OS_WINCE
- QSKIP("Reading and writing to a process is not supported on Qt/CE");
-#endif
-
static const char data[] = "A bunch\1of\2data\3\4\5\6\7...";
QProcess process;
QFile file("data");
@@ -1857,8 +1837,11 @@ void tst_QProcess::setStandardInputFile()
QCOMPARE(all.size(), int(sizeof data) - 1); // testProcessEcho drops the ending \0
QVERIFY(all == data);
}
+#endif
//-----------------------------------------------------------------------------
+#ifndef Q_OS_WINCE
+// Reading and writing to a process is not supported on Qt/CE
void tst_QProcess::setStandardOutputFile_data()
{
QTest::addColumn<int>("channelToTest");
@@ -1889,10 +1872,6 @@ void tst_QProcess::setStandardOutputFile_data()
void tst_QProcess::setStandardOutputFile()
{
-#ifdef Q_OS_WINCE
- QSKIP("Reading and writing to a process is not supported on Qt/CE");
-#endif
-
static const char data[] = "Original data. ";
static const char testdata[] = "Test data.";
@@ -1939,8 +1918,11 @@ void tst_QProcess::setStandardOutputFile()
QCOMPARE(all.size(), expectedsize);
}
+#endif
//-----------------------------------------------------------------------------
+#ifndef Q_OS_WINCE
+// Reading and writing to a process is not supported on Qt/CE
void tst_QProcess::setStandardOutputProcess_data()
{
QTest::addColumn<bool>("merged");
@@ -1950,9 +1932,6 @@ void tst_QProcess::setStandardOutputProcess_data()
void tst_QProcess::setStandardOutputProcess()
{
-#ifdef Q_OS_WINCE
- QSKIP("Reading and writing to a process is not supported on Qt/CE");
-#endif
QProcess source;
QProcess sink;
@@ -1976,14 +1955,13 @@ void tst_QProcess::setStandardOutputProcess()
else
QCOMPARE(all, QByteArray("HHeelllloo,, WWoorrlldd"));
}
+#endif
//-----------------------------------------------------------------------------
+#ifndef Q_OS_WINCE
+// Reading and writing to a process is not supported on Qt/CE
void tst_QProcess::fileWriterProcess()
{
-#ifdef Q_OS_WINCE
- QSKIP("Reading and writing to a process is not supported on Qt/CE");
-#endif
-
QString stdinStr;
for (int i = 0; i < 5000; ++i)
stdinStr += QString::fromLatin1("%1 -- testing testing 1 2 3\n").arg(i);
@@ -2005,6 +1983,7 @@ void tst_QProcess::fileWriterProcess()
QCOMPARE(QFile("fileWriterProcess.txt").size(), qint64(stdinStr.size()));
} while (stopWatch.elapsed() < 3000);
}
+#endif
//-----------------------------------------------------------------------------
void tst_QProcess::detachedWorkingDirectoryAndPid()
@@ -2051,11 +2030,10 @@ void tst_QProcess::detachedWorkingDirectoryAndPid()
}
//-----------------------------------------------------------------------------
+#ifndef Q_OS_WINCE
+// Reading and writing to a process is not supported on Qt/CE
void tst_QProcess::switchReadChannels()
{
-#ifdef Q_OS_WINCE
- QSKIP("Reading and writing to a process is not supported on Qt/CE");
-#endif
const char data[] = "ABCD";
QProcess process;
@@ -2080,16 +2058,14 @@ void tst_QProcess::switchReadChannels()
process.setReadChannel(QProcess::StandardOutput);
QCOMPARE(process.read(1), QByteArray("D"));
}
+#endif
//-----------------------------------------------------------------------------
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+// Q_OS_WIN - setWorkingDirectory will chdir before starting the process on unices
+// Windows CE does not support working directory logic
void tst_QProcess::setWorkingDirectory()
{
-#ifdef Q_OS_WINCE
- QSKIP("Windows CE does not support working directory logic");
-#endif
-#ifndef Q_OS_WIN
- QSKIP("setWorkingDirectory will chdir before starting the process on unices");
-#endif
process = new QProcess;
process->setWorkingDirectory("test");
process->start("testSetWorkingDirectory/testSetWorkingDirectory");
@@ -2101,6 +2077,7 @@ void tst_QProcess::setWorkingDirectory()
delete process;
process = 0;
}
+#endif
//-----------------------------------------------------------------------------
void tst_QProcess::startFinishStartFinish()
@@ -2173,7 +2150,7 @@ void tst_QProcess::onlyOneStartedSignal()
QCOMPARE(spyFinished.count(), 1);
}
-#endif
+#endif //QT_NO_PROCESS
QTEST_MAIN(tst_QProcess)
#include "tst_qprocess.moc"
diff --git a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
index 84fbfb4131..1cf15e898f 100644
--- a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
+++ b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
@@ -115,7 +115,7 @@ private slots:
void setPath();
void setDefaultFormat();
void dontCreateNeedlessPaths();
-#if !defined(Q_OS_WIN)
+#if !defined(Q_OS_WIN) && !defined(QT_QSETTINGS_ALWAYS_CASE_SENSITIVE_AND_FORGET_ORIGINAL_KEY_ORDER)
void dontReorderIniKeysNeedlessly();
#endif
#if defined(Q_OS_WIN)
@@ -3017,12 +3017,10 @@ void tst_QSettings::dontCreateNeedlessPaths()
QVERIFY(!fileInfo.dir().exists());
}
-#if !defined(Q_OS_WIN)
+#if !defined(Q_OS_WIN) && !defined(QT_QSETTINGS_ALWAYS_CASE_SENSITIVE_AND_FORGET_ORIGINAL_KEY_ORDER)
+// This Qt build does not preserve ordering, as a code size optimization.
void tst_QSettings::dontReorderIniKeysNeedlessly()
{
-#ifdef QT_QSETTINGS_ALWAYS_CASE_SENSITIVE_AND_FORGET_ORIGINAL_KEY_ORDER
- QSKIP("This Qt build does not preserve ordering, as a code size optimization.");
-#endif
/*
This is a very strong test. It asserts that modifying
diff --git a/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp b/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp
index 956a3e67aa..24649bf587 100644
--- a/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp
+++ b/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp
@@ -183,7 +183,9 @@ private slots:
// This test *must* run first. See the definition for why.
void processEvents();
void exec();
+#if !defined(QT_NO_EXCEPTIONS) && !defined(Q_OS_WINCE_WM)
void throwInExec();
+#endif
void reexec();
void execAfterExit();
void wakeUp();
@@ -320,17 +322,15 @@ void tst_QEventLoop::exec()
}
}
+#if !defined(QT_NO_EXCEPTIONS) && !defined(Q_OS_WINCE_WM)
+// Exceptions need to be enabled for this test
+// Q_OS_WINCE_WM case: this platform doesn't support propagating exceptions through the event loop
+// Windows Mobile cannot handle cross library exceptions
+// qobject.cpp will try to rethrow the exception after handling
+// which causes gwes.exe to crash
void tst_QEventLoop::throwInExec()
{
-#if defined(QT_NO_EXCEPTIONS) || defined(NO_EVENTLOOP_EXCEPTIONS)
- QSKIP("Exceptions are disabled");
-#elif defined(Q_OS_WINCE_WM)
- // Windows Mobile cannot handle cross library exceptions
- // qobject.cpp will try to rethrow the exception after handling
- // which causes gwes.exe to crash
- QSKIP("This platform doesn't support propagating exceptions through the event loop");
-#else
- // exceptions compiled in, runtime tests follow.
+// exceptions compiled in, runtime tests follow.
#if defined(Q_OS_LINUX)
// C++ exceptions can't be passed through glib callbacks. Skip the test if
// we're using the glib event loop.
@@ -366,8 +366,8 @@ void tst_QEventLoop::throwInExec()
}
QCOMPARE(caughtExceptions, 2);
}
-#endif
}
+#endif
void tst_QEventLoop::reexec()
{
diff --git a/tests/auto/corelib/kernel/qsystemsemaphore/qsystemsemaphore.pro b/tests/auto/corelib/kernel/qsystemsemaphore/qsystemsemaphore.pro
new file mode 100644
index 0000000000..f8a49254d2
--- /dev/null
+++ b/tests/auto/corelib/kernel/qsystemsemaphore/qsystemsemaphore.pro
@@ -0,0 +1,3 @@
+TEMPLATE = subdirs
+
+SUBDIRS = systemsemaphorehelper test
diff --git a/tests/auto/corelib/kernel/qsystemsemaphore/systemsemaphorehelper/main.cpp b/tests/auto/corelib/kernel/qsystemsemaphore/systemsemaphorehelper/main.cpp
new file mode 100644
index 0000000000..2e85d8610e
--- /dev/null
+++ b/tests/auto/corelib/kernel/qsystemsemaphore/systemsemaphorehelper/main.cpp
@@ -0,0 +1,114 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QCoreApplication>
+#include <QDebug>
+#include <QStringList>
+#include <QSystemSemaphore>
+
+int acquire(int count = 1)
+{
+ QSystemSemaphore sem("store");
+
+ for (int i = 0; i < count; ++i) {
+ if (!sem.acquire()) {
+ qWarning() << "Could not acquire" << sem.key();
+ return EXIT_FAILURE;
+ }
+ }
+ qDebug("done aquiring");
+ return EXIT_SUCCESS;
+}
+
+int release()
+{
+ QSystemSemaphore sem("store");
+ if (!sem.release()) {
+ qWarning() << "Could not release" << sem.key();
+ return EXIT_FAILURE;
+ }
+ qDebug("done releasing");
+ return EXIT_SUCCESS;
+}
+
+int acquirerelease()
+{
+ QSystemSemaphore sem("store");
+ if (!sem.acquire()) {
+ qWarning() << "Could not acquire" << sem.key();
+ return EXIT_FAILURE;
+ }
+ if (!sem.release()) {
+ qWarning() << "Could not release" << sem.key();
+ return EXIT_FAILURE;
+ }
+ return EXIT_SUCCESS;
+}
+
+int main(int argc, char *argv[])
+{
+ QCoreApplication app(argc, argv);
+
+ QStringList arguments = app.arguments();
+ // binary name is not used here
+ arguments.takeFirst();
+ if (arguments.count() < 1) {
+ qWarning("Please call the helper with the function to call as argument");
+ return EXIT_FAILURE;
+ }
+ QString function = arguments.takeFirst();
+ if (function == QLatin1String("acquire")) {
+ int count = 1;
+ bool ok = true;
+ if (arguments.count())
+ count = arguments.takeFirst().toInt(&ok);
+ if (!ok)
+ count = 1;
+ return acquire(count);
+ } else if (function == QLatin1String("release")) {
+ return release();
+ } else if (function == QLatin1String("acquirerelease")) {
+ return acquirerelease();
+ } else {
+ qWarning() << "Unknown function" << function;
+ }
+ return EXIT_SUCCESS;
+}
diff --git a/tests/auto/corelib/kernel/qsystemsemaphore/systemsemaphorehelper/systemsemaphorehelper.pro b/tests/auto/corelib/kernel/qsystemsemaphore/systemsemaphorehelper/systemsemaphorehelper.pro
new file mode 100644
index 0000000000..d1a4e04567
--- /dev/null
+++ b/tests/auto/corelib/kernel/qsystemsemaphore/systemsemaphorehelper/systemsemaphorehelper.pro
@@ -0,0 +1,9 @@
+QT = core testlib
+
+DESTDIR = ./
+
+win32: CONFIG += console
+mac:CONFIG -= app_bundle
+
+SOURCES += main.cpp
+
diff --git a/tests/auto/corelib/kernel/qsystemsemaphore/test/test.pro b/tests/auto/corelib/kernel/qsystemsemaphore/test/test.pro
new file mode 100644
index 0000000000..cc76b2c233
--- /dev/null
+++ b/tests/auto/corelib/kernel/qsystemsemaphore/test/test.pro
@@ -0,0 +1,10 @@
+CONFIG += testcase
+QT = core testlib
+
+win32: CONFIG += console
+mac:CONFIG -= app_bundle
+
+SOURCES += tst_qsystemsemaphore.cpp
+TARGET = tst_qsystemsemaphore
+
+DESTDIR = ../
diff --git a/tests/auto/corelib/kernel/qsystemsemaphore/test/tst_qsystemsemaphore.cpp b/tests/auto/corelib/kernel/qsystemsemaphore/test/tst_qsystemsemaphore.cpp
new file mode 100644
index 0000000000..85f7d2a4b2
--- /dev/null
+++ b/tests/auto/corelib/kernel/qsystemsemaphore/test/tst_qsystemsemaphore.cpp
@@ -0,0 +1,275 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include <QtCore/QSystemSemaphore>
+#include <QtCore/QVector>
+#include <QtCore/QTemporaryDir>
+
+#define EXISTING_SHARE "existing"
+#define HELPERWAITTIME 10000
+
+class tst_QSystemSemaphore : public QObject
+{
+ Q_OBJECT
+
+public:
+ tst_QSystemSemaphore();
+
+public Q_SLOTS:
+ void initTestCase();
+ void init();
+ void cleanup();
+
+private slots:
+ void key_data();
+ void key();
+
+ void basicacquire();
+ void complexacquire();
+
+ void basicProcesses();
+
+ void processes_data();
+ void processes();
+
+#ifndef Q_OS_WIN
+ void undo();
+#endif
+ void initialValue();
+
+private:
+ QString helperBinary();
+ QSystemSemaphore *existingLock;
+};
+
+tst_QSystemSemaphore::tst_QSystemSemaphore()
+{
+}
+
+void tst_QSystemSemaphore::initTestCase()
+{
+ QVERIFY2(!helperBinary().isEmpty(), "Could not find helper binary");
+}
+
+void tst_QSystemSemaphore::init()
+{
+ existingLock = new QSystemSemaphore(EXISTING_SHARE, 1, QSystemSemaphore::Create);
+}
+
+void tst_QSystemSemaphore::cleanup()
+{
+ delete existingLock;
+}
+
+void tst_QSystemSemaphore::key_data()
+{
+ QTest::addColumn<QString>("constructorKey");
+ QTest::addColumn<QString>("setKey");
+
+ QTest::newRow("null, null") << QString() << QString();
+ QTest::newRow("null, one") << QString() << QString("one");
+ QTest::newRow("one, two") << QString("one") << QString("two");
+}
+
+/*!
+ Basic key testing
+ */
+void tst_QSystemSemaphore::key()
+{
+ QFETCH(QString, constructorKey);
+ QFETCH(QString, setKey);
+
+ QSystemSemaphore sem(constructorKey);
+ QCOMPARE(sem.key(), constructorKey);
+ QCOMPARE(sem.error(), QSystemSemaphore::NoError);
+ QCOMPARE(sem.errorString(), QString());
+
+ sem.setKey(setKey);
+ QCOMPARE(sem.key(), setKey);
+ QCOMPARE(sem.error(), QSystemSemaphore::NoError);
+ QCOMPARE(sem.errorString(), QString());
+}
+
+void tst_QSystemSemaphore::basicacquire()
+{
+ QSystemSemaphore sem("QSystemSemaphore_basicacquire", 1, QSystemSemaphore::Create);
+ QVERIFY(sem.acquire());
+ QCOMPARE(sem.error(), QSystemSemaphore::NoError);
+ QVERIFY(sem.release());
+ QCOMPARE(sem.error(), QSystemSemaphore::NoError);
+ QCOMPARE(sem.errorString(), QString());
+}
+
+void tst_QSystemSemaphore::complexacquire()
+{
+ QSystemSemaphore sem("QSystemSemaphore_complexacquire", 2, QSystemSemaphore::Create);
+ QVERIFY(sem.acquire());
+ QVERIFY(sem.release());
+ QVERIFY(sem.acquire());
+ QVERIFY(sem.release());
+ QVERIFY(sem.acquire());
+ QVERIFY(sem.acquire());
+ QVERIFY(sem.release());
+ QVERIFY(sem.release());
+ QCOMPARE(sem.error(), QSystemSemaphore::NoError);
+ QCOMPARE(sem.errorString(), QString());
+}
+
+void tst_QSystemSemaphore::basicProcesses()
+{
+ QSystemSemaphore sem("store", 0, QSystemSemaphore::Create);
+
+ QProcess acquire;
+ acquire.setProcessChannelMode(QProcess::ForwardedChannels);
+
+ QProcess release;
+ release.setProcessChannelMode(QProcess::ForwardedChannels);
+
+ acquire.start(helperBinary(), QStringList("acquire"));
+ QVERIFY2(acquire.waitForStarted(), "Could not start helper binary");
+ acquire.waitForFinished(HELPERWAITTIME);
+ QVERIFY(acquire.state() == QProcess::Running);
+ acquire.kill();
+ release.start(helperBinary(), QStringList("release"));
+ QVERIFY2(release.waitForStarted(), "Could not start helper binary");
+ acquire.waitForFinished(HELPERWAITTIME);
+ release.waitForFinished(HELPERWAITTIME);
+ QVERIFY(acquire.state() == QProcess::NotRunning);
+}
+
+void tst_QSystemSemaphore::processes_data()
+{
+ QTest::addColumn<int>("processes");
+ for (int i = 0; i < 5; ++i) {
+ QTest::newRow("1 process") << 1;
+ QTest::newRow("3 process") << 3;
+ QTest::newRow("10 process") << 10;
+ }
+}
+
+void tst_QSystemSemaphore::processes()
+{
+ QSystemSemaphore sem("store", 1, QSystemSemaphore::Create);
+
+ QFETCH(int, processes);
+ QVector<QString> scripts(processes, "acquirerelease");
+
+ QList<QProcess*> consumers;
+ for (int i = 0; i < scripts.count(); ++i) {
+ QProcess *p = new QProcess;
+ p->setProcessChannelMode(QProcess::ForwardedChannels);
+ consumers.append(p);
+ p->start(helperBinary(), QStringList(scripts.at(i)));
+ }
+
+ while (!consumers.isEmpty()) {
+ consumers.first()->waitForFinished();
+ QCOMPARE(consumers.first()->exitStatus(), QProcess::NormalExit);
+ QCOMPARE(consumers.first()->exitCode(), 0);
+ delete consumers.takeFirst();
+ }
+}
+
+// This test only checks a unix behavior.
+#ifndef Q_OS_WIN
+void tst_QSystemSemaphore::undo()
+{
+ QSystemSemaphore sem("store", 1, QSystemSemaphore::Create);
+
+ QStringList acquireArguments = QStringList("acquire");
+ QProcess acquire;
+ acquire.setProcessChannelMode(QProcess::ForwardedChannels);
+ acquire.start(helperBinary(), acquireArguments);
+ QVERIFY2(acquire.waitForStarted(), "Could not start helper binary");
+ acquire.waitForFinished(HELPERWAITTIME);
+ QVERIFY(acquire.state()== QProcess::NotRunning);
+
+ // At process exit the kernel should auto undo
+
+ acquire.start(helperBinary(), acquireArguments);
+ QVERIFY2(acquire.waitForStarted(), "Could not start helper binary");
+ acquire.waitForFinished(HELPERWAITTIME);
+ QVERIFY(acquire.state()== QProcess::NotRunning);
+}
+#endif
+
+void tst_QSystemSemaphore::initialValue()
+{
+ QSystemSemaphore sem("store", 1, QSystemSemaphore::Create);
+
+ QStringList acquireArguments = QStringList("acquire");
+ QStringList releaseArguments = QStringList("release");
+ QProcess acquire;
+ acquire.setProcessChannelMode(QProcess::ForwardedChannels);
+
+ QProcess release;
+ release.setProcessChannelMode(QProcess::ForwardedChannels);
+
+ acquire.start(helperBinary(), acquireArguments);
+ QVERIFY2(acquire.waitForStarted(), "Could not start helper binary");
+ acquire.waitForFinished(HELPERWAITTIME);
+ QVERIFY(acquire.state()== QProcess::NotRunning);
+
+ acquire.start(helperBinary(), acquireArguments << QLatin1String("2"));
+ QVERIFY2(acquire.waitForStarted(), "Could not start helper binary");
+ acquire.waitForFinished(HELPERWAITTIME);
+ QVERIFY(acquire.state()== QProcess::Running);
+ acquire.kill();
+
+ release.start(helperBinary(), releaseArguments);
+ QVERIFY2(release.waitForStarted(), "Could not start helper binary");
+ acquire.waitForFinished(HELPERWAITTIME);
+ release.waitForFinished(HELPERWAITTIME);
+ QVERIFY(acquire.state()== QProcess::NotRunning);
+}
+
+QString tst_QSystemSemaphore::helperBinary()
+{
+ QString binary = QStringLiteral("systemsemaphorehelper/systemsemaphorehelper");
+#ifdef Q_OS_WIN
+ binary += QStringLiteral(".exe");
+#endif
+ return binary;
+}
+QTEST_MAIN(tst_QSystemSemaphore)
+#include "tst_qsystemsemaphore.moc"
+
diff --git a/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp b/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp
index b731eaf12a..0d41328320 100644
--- a/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp
+++ b/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp
@@ -517,38 +517,6 @@ void tst_QMimeDatabase::allMimeTypes()
}
}
-void tst_QMimeDatabase::inheritsPerformance()
-{
- // Check performance of inherits().
- // This benchmark (which started in 2009 in kmimetypetest.cpp) uses 40 mimetypes.
- QStringList mimeTypes; mimeTypes << QLatin1String("image/jpeg") << QLatin1String("image/png") << QLatin1String("image/tiff") << QLatin1String("text/plain") << QLatin1String("text/html");
- mimeTypes += mimeTypes;
- mimeTypes += mimeTypes;
- mimeTypes += mimeTypes;
- QCOMPARE(mimeTypes.count(), 40);
- QMimeDatabase db;
- QMimeType mime = db.mimeTypeForName(QString::fromLatin1("text/x-chdr"));
- QVERIFY(mime.isValid());
- QBENCHMARK {
- QString match;
- foreach (const QString &mt, mimeTypes) {
- if (mime.inherits(mt)) {
- match = mt;
- // of course there would normally be a "break" here, but we're testing worse-case
- // performance here
- }
- }
- QCOMPARE(match, QString::fromLatin1("text/plain"));
- }
- // Numbers from 2011, in release mode:
- // KDE 4.7 numbers: 0.21 msec / 494,000 ticks / 568,345 instr. loads per iteration
- // QMimeBinaryProvider (with Qt 5): 0.16 msec / NA / 416,049 instr. reads per iteration
- // QMimeXmlProvider (with Qt 5): 0.062 msec / NA / 172,889 instr. reads per iteration
- // (but the startup time is way higher)
- // And memory usage is flat at 200K with QMimeBinaryProvider, while it peaks at 6 MB when
- // parsing XML, and then keeps being around 4.5 MB for all the in-memory hashes.
-}
-
void tst_QMimeDatabase::suffixes_data()
{
QTest::addColumn<QString>("mimeType");
diff --git a/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.h b/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.h
index f30eb00461..ea050b5014 100644
--- a/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.h
+++ b/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.h
@@ -70,7 +70,6 @@ private slots:
void mimeTypeForFileAndContent_data();
void mimeTypeForFileAndContent();
void allMimeTypes();
- void inheritsPerformance();
void suffixes_data();
void suffixes();
void knownSuffix();
diff --git a/tests/auto/corelib/thread/qfuture/tst_qfuture.cpp b/tests/auto/corelib/thread/qfuture/tst_qfuture.cpp
index 81ba1b0fd9..6d73755cfc 100644
--- a/tests/auto/corelib/thread/qfuture/tst_qfuture.cpp
+++ b/tests/auto/corelib/thread/qfuture/tst_qfuture.cpp
@@ -1251,18 +1251,32 @@ void tst_QFuture::throttling()
void tst_QFuture::voidConversions()
{
- QFutureInterface<int> iface;
- iface.reportStarted();
+ {
+ QFutureInterface<int> iface;
+ iface.reportStarted();
- QFuture<int> intFuture(&iface);
+ QFuture<int> intFuture(&iface);
+ int value = 10;
+ iface.reportFinished(&value);
- int value = 10;
- iface.reportFinished(&value);
+ QFuture<void> voidFuture(intFuture);
+ voidFuture = intFuture;
+
+ QVERIFY(voidFuture == intFuture);
+ }
- QFuture<void> voidFuture(intFuture);
- voidFuture = intFuture;
+ {
+ QFuture<void> voidFuture;
+ {
+ QFutureInterface<QList<int> > iface;
+ iface.reportStarted();
- QVERIFY(voidFuture == intFuture);
+ QFuture<QList<int> > listFuture(&iface);
+ iface.reportResult(QList<int>() << 1 << 2 << 3);
+ voidFuture = listFuture;
+ }
+ QCOMPARE(voidFuture.resultCount(), 0);
+ }
}
diff --git a/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp b/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp
index 331024c560..848fdb14a4 100644
--- a/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp
+++ b/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp
@@ -147,7 +147,9 @@ private slots:
void reserveExtended();
void movablity_data();
void movablity();
+#if defined(Q_COMPILER_LAMBDA)
void literals();
+#endif
};
static const struct StaticByteArrays {
@@ -1878,9 +1880,10 @@ void tst_QByteArray::movablity()
QVERIFY(true);
}
+#if defined(Q_COMPILER_LAMBDA)
+// Only tested on c++0x compliant compiler or gcc
void tst_QByteArray::literals()
{
-#if defined(Q_COMPILER_LAMBDA)
QByteArray str(QByteArrayLiteral("abcd"));
QVERIFY(str.length() == 4);
@@ -1897,10 +1900,8 @@ void tst_QByteArray::literals()
QVERIFY(str2.constData() == s);
QVERIFY(str2.data() != s);
-#else
- QSKIP("Only tested on c++0x compliant compiler or gcc");
-#endif
}
+#endif
const char globalChar = '1';
diff --git a/tests/auto/corelib/tools/qdate/tst_qdate.cpp b/tests/auto/corelib/tools/qdate/tst_qdate.cpp
index 01805e1271..9978a252bf 100644
--- a/tests/auto/corelib/tools/qdate/tst_qdate.cpp
+++ b/tests/auto/corelib/tools/qdate/tst_qdate.cpp
@@ -117,8 +117,8 @@ void tst_QDate::isNull_data()
QTest::addColumn<qint64>("jd");
QTest::addColumn<bool>("null");
- qint64 minJd = std::numeric_limits<qint64>::min() / 2;
- qint64 maxJd = std::numeric_limits<qint64>::max() / 2;
+ qint64 minJd = Q_INT64_C(-784350574879);
+ qint64 maxJd = Q_INT64_C( 784354017364);
QTest::newRow("qint64 min") << std::numeric_limits<qint64>::min() << true;
QTest::newRow("minJd - 1") << minJd - 1 << true;
@@ -448,8 +448,8 @@ void tst_QDate::julianDaysLimits()
{
qint64 min = std::numeric_limits<qint64>::min();
qint64 max = std::numeric_limits<qint64>::max();
- qint64 minJd = std::numeric_limits<qint64>::min() / 2;
- qint64 maxJd = std::numeric_limits<qint64>::max() / 2;
+ qint64 minJd = Q_INT64_C(-784350574879);
+ qint64 maxJd = Q_INT64_C( 784354017364);
QDate maxDate = QDate::fromJulianDay(maxJd);
QDate minDate = QDate::fromJulianDay(minJd);
@@ -492,7 +492,7 @@ void tst_QDate::julianDaysLimits()
dt = minDate.addDays(min);
QCOMPARE(dt.isValid(), false);
dt = minDate.addDays(max);
- QCOMPARE(dt.isValid(), true);
+ QCOMPARE(dt.isValid(), false);
dt = zeroDate.addDays(-1);
QCOMPARE(dt.isValid(), true);
@@ -664,8 +664,8 @@ void tst_QDate::addYears_data()
void tst_QDate::daysTo()
{
- qint64 minJd = std::numeric_limits<qint64>::min() / 2;
- qint64 maxJd = std::numeric_limits<qint64>::max() / 2;
+ qint64 minJd = Q_INT64_C(-784350574879);
+ qint64 maxJd = Q_INT64_C( 784354017364);
QDate dt1(2000, 1, 1);
QDate dt2(2000, 1, 5);
@@ -1356,9 +1356,10 @@ void tst_QDate::roundtrip() const
// year(), month(), day(), julianDayFromDate(), and getDateFromJulianDay()
// to ensure they are internally consistent (but doesn't guarantee correct)
- // Test Julian round trip around JD 0 and current low end of valid range
+ // Test Julian round trip around JD 0 and the c++ integer division rounding
+ // problem point (eg. negative numbers) in the conversion functions.
QDate testDate;
- QDate loopDate = QDate::fromJulianDay(-31738); // 1 Jan 4800 BC
+ QDate loopDate = QDate::fromJulianDay(-50001); // 1 Jan 4850 BC
while (loopDate.toJulianDay() <= 5150) { // 31 Dec 4700 BC
testDate.setDate(loopDate.year(), loopDate.month(), loopDate.day());
QCOMPARE(loopDate.toJulianDay(), testDate.toJulianDay());
@@ -1389,9 +1390,20 @@ void tst_QDate::roundtrip() const
loopDate = loopDate.addDays(1);
}
+ qint64 minJd = Q_INT64_C(-784350574879);
+ qint64 maxJd = Q_INT64_C( 784354017364);
+
// Test Gregorian round trip at top end of conversion range
- loopDate = QDate::fromJulianDay(513024036); // 1 Jan 1399900 AD
- while (loopDate.toJulianDay() <= 513060925) { // 31 Dec 1400000 AD
+ loopDate = QDate::fromJulianDay(maxJd);
+ while (loopDate.toJulianDay() >= maxJd - 146397) {
+ testDate.setDate(loopDate.year(), loopDate.month(), loopDate.day());
+ QCOMPARE(loopDate.toJulianDay(), testDate.toJulianDay());
+ loopDate = loopDate.addDays(-1);
+ }
+
+ // Test Gregorian round trip at low end of conversion range
+ loopDate = QDate::fromJulianDay(minJd);
+ while (loopDate.toJulianDay() <= minJd + 146397) {
testDate.setDate(loopDate.year(), loopDate.month(), loopDate.day());
QCOMPARE(loopDate.toJulianDay(), testDate.toJulianDay());
loopDate = loopDate.addDays(1);
diff --git a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
index 9e71a32f87..8da5d2808b 100644
--- a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
+++ b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
@@ -74,11 +74,15 @@ private slots:
void toTime_t();
void daylightSavingsTimeChange();
void setDate();
+ void setTime_data();
void setTime();
+ void setTimeSpec_data();
void setTimeSpec();
void setTime_t();
void setMSecsSinceEpoch_data();
void setMSecsSinceEpoch();
+ void fromMSecsSinceEpoch_data();
+ void fromMSecsSinceEpoch();
void toString_isoDate_data();
void toString_isoDate();
void toString_enumformat();
@@ -333,57 +337,59 @@ void tst_QDateTime::setDate()
QCOMPARE(dt6.timeSpec(), Qt::LocalTime);
}
+void tst_QDateTime::setTime_data()
+{
+ QTest::addColumn<QDateTime>("dateTime");
+ QTest::addColumn<QTime>("newTime");
+
+ QTest::newRow("data0") << QDateTime(QDate(2004, 3, 25), QTime(0, 45, 57), Qt::UTC) << QTime(23, 11, 22);
+ QTest::newRow("data1") << QDateTime(QDate(2004, 3, 25), QTime(0, 45, 57), Qt::LocalTime) << QTime(23, 11, 22);
+ QTest::newRow("data2") << QDateTime(QDate(4004, 3, 25), QTime(0, 45, 57), Qt::UTC) << QTime(23, 11, 22);
+ QTest::newRow("data3") << QDateTime(QDate(4004, 3, 25), QTime(0, 45, 57), Qt::LocalTime) << QTime(23, 11, 22);
+ QTest::newRow("data4") << QDateTime(QDate(1760, 3, 25), QTime(0, 45, 57), Qt::UTC) << QTime(23, 11, 22);
+ QTest::newRow("data5") << QDateTime(QDate(1760, 3, 25), QTime(0, 45, 57), Qt::LocalTime) << QTime(23, 11, 22);
+
+ QTest::newRow("set on std/dst") << QDateTime::currentDateTime() << QTime(23, 11, 22);
+}
+
void tst_QDateTime::setTime()
{
- QDateTime dt1(QDate(2004, 3, 25), QTime(0, 45, 57), Qt::UTC);
- dt1.setTime(QTime(23, 11, 22));
- QCOMPARE(dt1.date(), QDate(2004, 3, 25));
- QCOMPARE(dt1.time(), QTime(23, 11, 22));
- QCOMPARE(dt1.timeSpec(), Qt::UTC);
+ QFETCH(QDateTime, dateTime);
+ QFETCH(QTime, newTime);
- QDateTime dt2(QDate(2004, 3, 25), QTime(0, 45, 57), Qt::LocalTime);
- dt2.setTime(QTime(23, 11, 22));
- QCOMPARE(dt2.date(), QDate(2004, 3, 25));
- QCOMPARE(dt2.time(), QTime(23, 11, 22));
- QCOMPARE(dt2.timeSpec(), Qt::LocalTime);
+ const QDate expectedDate(dateTime.date());
+ const Qt::TimeSpec expectedTimeSpec(dateTime.timeSpec());
- QDateTime dt3(QDate(4004, 3, 25), QTime(0, 45, 57), Qt::UTC);
- dt3.setTime(QTime(23, 11, 22));
- QCOMPARE(dt3.date(), QDate(4004, 3, 25));
- QCOMPARE(dt3.time(), QTime(23, 11, 22));
- QCOMPARE(dt3.timeSpec(), Qt::UTC);
+ dateTime.setTime(newTime);
- QDateTime dt4(QDate(4004, 3, 25), QTime(0, 45, 57), Qt::LocalTime);
- dt4.setTime(QTime(23, 11, 22));
- QCOMPARE(dt4.date(), QDate(4004, 3, 25));
- QCOMPARE(dt4.time(), QTime(23, 11, 22));
- QCOMPARE(dt4.timeSpec(), Qt::LocalTime);
+ QCOMPARE(dateTime.date(), expectedDate);
+ QCOMPARE(dateTime.time(), newTime);
+ QCOMPARE(dateTime.timeSpec(), expectedTimeSpec);
+}
- QDateTime dt5(QDate(1760, 3, 25), QTime(0, 45, 57), Qt::UTC);
- dt5.setTime(QTime(23, 11, 22));
- QCOMPARE(dt5.date(), QDate(1760, 3, 25));
- QCOMPARE(dt5.time(), QTime(23, 11, 22));
- QCOMPARE(dt5.timeSpec(), Qt::UTC);
+void tst_QDateTime::setTimeSpec_data()
+{
+ QTest::addColumn<QDateTime>("dateTime");
+ QTest::addColumn<Qt::TimeSpec>("newTimeSpec");
- QDateTime dt6(QDate(1760, 3, 25), QTime(0, 45, 57), Qt::LocalTime);
- dt6.setTime(QTime(23, 11, 22));
- QCOMPARE(dt6.date(), QDate(1760, 3, 25));
- QCOMPARE(dt6.time(), QTime(23, 11, 22));
- QCOMPARE(dt6.timeSpec(), Qt::LocalTime);
+ QTest::newRow("UTC => UTC") << QDateTime(QDate(2004, 3, 25), QTime(0, 45, 57), Qt::UTC) << Qt::UTC;
+ QTest::newRow("UTC => LocalTime") << QDateTime(QDate(2004, 3, 25), QTime(0, 45, 57), Qt::UTC) << Qt::LocalTime;
+ QTest::newRow("UTC => OffsetFromUTC") << QDateTime(QDate(2004, 3, 25), QTime(0, 45, 57), Qt::UTC) << Qt::OffsetFromUTC;
}
void tst_QDateTime::setTimeSpec()
{
- QDateTime dt1(QDate(2004, 3, 25), QTime(0, 45, 57), Qt::UTC);
- dt1.setTimeSpec(Qt::UTC);
- QCOMPARE(dt1.date(), QDate(2004, 3, 25));
- QCOMPARE(dt1.time(), QTime(0, 45, 57));
- QCOMPARE(dt1.timeSpec(), Qt::UTC);
+ QFETCH(QDateTime, dateTime);
+ QFETCH(Qt::TimeSpec, newTimeSpec);
- dt1.setTimeSpec(Qt::LocalTime);
- QCOMPARE(dt1.date(), QDate(2004, 3, 25));
- QCOMPARE(dt1.time(), QTime(0, 45, 57));
- QCOMPARE(dt1.timeSpec(), Qt::LocalTime);
+ const QDate expectedDate(dateTime.date());
+ const QTime expectedTime(dateTime.time());
+
+ dateTime.setTimeSpec(newTimeSpec);
+
+ QCOMPARE(dateTime.date(), expectedDate);
+ QCOMPARE(dateTime.time(), expectedTime);
+ QCOMPARE(dateTime.timeSpec(), newTimeSpec);
}
void tst_QDateTime::setTime_t()
@@ -482,6 +488,13 @@ void tst_QDateTime::setMSecsSinceEpoch()
QCOMPARE(dt, utc);
if (europeanTimeZone) {
QCOMPARE(dt.toLocalTime(), european);
+
+ // Test converting from LocalTime to UTC back to LocalTime.
+ QDateTime localDt;
+ localDt.setTimeSpec(Qt::LocalTime);
+ localDt.setMSecsSinceEpoch(msecs);
+
+ QCOMPARE(localDt, utc);
}
QCOMPARE(dt.toMSecsSinceEpoch(), msecs);
@@ -494,6 +507,33 @@ void tst_QDateTime::setMSecsSinceEpoch()
QCOMPARE(dt, reference.addMSecs(msecs));
}
+void tst_QDateTime::fromMSecsSinceEpoch_data()
+{
+ setMSecsSinceEpoch_data();
+}
+
+void tst_QDateTime::fromMSecsSinceEpoch()
+{
+ QFETCH(qint64, msecs);
+ QFETCH(QDateTime, utc);
+ QFETCH(QDateTime, european);
+
+ QDateTime dt(QDateTime::fromMSecsSinceEpoch(msecs));
+
+ QCOMPARE(dt, utc);
+ if (europeanTimeZone)
+ QCOMPARE(dt.toLocalTime(), european);
+
+ QCOMPARE(dt.toMSecsSinceEpoch(), msecs);
+
+ if (quint64(msecs / 1000) < 0xFFFFFFFF) {
+ QCOMPARE(qint64(dt.toTime_t()), msecs / 1000);
+ }
+
+ QDateTime reference(QDate(1970, 1, 1), QTime(), Qt::UTC);
+ QCOMPARE(dt, reference.addMSecs(msecs));
+}
+
void tst_QDateTime::toString_isoDate_data()
{
QTest::addColumn<QDateTime>("dt");
@@ -514,6 +554,9 @@ void tst_QDateTime::toString_isoDate_data()
QTest::newRow("negative OffsetFromUTC")
<< dt
<< QString("1978-11-09T13:28:34-02:00");
+ QTest::newRow("invalid")
+ << QDateTime(QDate(-1, 11, 9), QTime(13, 28, 34), Qt::UTC)
+ << QString();
}
void tst_QDateTime::toString_isoDate()
@@ -1209,6 +1252,9 @@ void tst_QDateTime::operator_eqeq_data()
QTest::newRow("data11") << dateTime3 << dateTime3d << true << false;
QTest::newRow("data12") << dateTime3c << dateTime3d << true << false;
QTest::newRow("data13") << dateTime3 << dateTime3e << false << false;
+ QTest::newRow("invalid == invalid") << invalidDateTime() << invalidDateTime() << true << false;
+ QTest::newRow("invalid == valid #1") << invalidDateTime() << dateTime1 << false << false;
+
if (europeanTimeZone) {
QTest::newRow("data14") << QDateTime(QDate(2004, 1, 2), QTime(2, 2, 3), Qt::LocalTime)
<< QDateTime(QDate(2004, 1, 2), QTime(1, 2, 3), Qt::UTC) << true << true;
@@ -1248,11 +1294,14 @@ void tst_QDateTime::operator_eqeq()
}
#ifndef Q_OS_WINCE
+Q_DECLARE_METATYPE(QDataStream::Version)
+
void tst_QDateTime::operator_insert_extract_data()
{
QTest::addColumn<QDateTime>("dateTime");
QTest::addColumn<QString>("serialiseAs");
QTest::addColumn<QString>("deserialiseAs");
+ QTest::addColumn<QDataStream::Version>("dataStreamVersion");
const QDateTime positiveYear(QDateTime(QDate(2012, 8, 14), QTime(8, 0, 0), Qt::LocalTime));
const QDateTime negativeYear(QDateTime(QDate(-2012, 8, 14), QTime(8, 0, 0), Qt::LocalTime));
@@ -1260,14 +1309,19 @@ void tst_QDateTime::operator_insert_extract_data()
const QString westernAustralia(QString::fromLatin1("AWST-8AWDT-9,M10.5.0,M3.5.0/03:00:00"));
const QString hawaii(QString::fromLatin1("HAW10"));
- QTest::newRow("14/08/2012 08:00 WA => HAWAII") << positiveYear << westernAustralia << hawaii;
- QTest::newRow("14/08/2012 08:00 WA => HAWAII") << positiveYear << westernAustralia << hawaii;
- QTest::newRow("14/08/2012 08:00 WA => HAWAII") << positiveYear << westernAustralia << hawaii;
- QTest::newRow("14/08/2012 08:00 WA => WA") << positiveYear << westernAustralia << westernAustralia;
- QTest::newRow("14/08/-2012 08:00 HAWAII => WA") << negativeYear << hawaii << westernAustralia;
- QTest::newRow("14/08/-2012 08:00 HAWAII => WA") << negativeYear << hawaii << westernAustralia;
- QTest::newRow("14/08/-2012 08:00 HAWAII => WA") << negativeYear << hawaii << westernAustralia;
- QTest::newRow("14/08/2012 08:00 HAWAII => HAWAII") << positiveYear << hawaii << hawaii;
+ const QDataStream tmpDataStream;
+ const int thisVersion = tmpDataStream.version();
+ for (int version = QDataStream::Qt_1_0; version <= thisVersion; ++version) {
+ const QDataStream::Version dataStreamVersion = static_cast<QDataStream::Version>(version);
+ QTest::newRow(QString::fromLatin1("v%1 WA => HAWAII %2").arg(dataStreamVersion).arg(positiveYear.toString()).toLocal8Bit().constData())
+ << positiveYear << westernAustralia << hawaii << dataStreamVersion;
+ QTest::newRow(QString::fromLatin1("v%1 WA => WA %2").arg(dataStreamVersion).arg(positiveYear.toString()).toLocal8Bit().constData())
+ << positiveYear << westernAustralia << westernAustralia << dataStreamVersion;
+ QTest::newRow(QString::fromLatin1("v%1 HAWAII => WA %2").arg(dataStreamVersion).arg(negativeYear.toString()).toLocal8Bit().constData())
+ << negativeYear << hawaii << westernAustralia << dataStreamVersion;
+ QTest::newRow(QString::fromLatin1("v%1 HAWAII => HAWAII %2").arg(dataStreamVersion).arg(positiveYear.toString()).toLocal8Bit().constData())
+ << positiveYear << hawaii << hawaii << dataStreamVersion;
+ }
}
void tst_QDateTime::operator_insert_extract()
@@ -1275,8 +1329,11 @@ void tst_QDateTime::operator_insert_extract()
QFETCH(QDateTime, dateTime);
QFETCH(QString, serialiseAs);
QFETCH(QString, deserialiseAs);
+ QFETCH(QDataStream::Version, dataStreamVersion);
+ // Save the previous timezone so we can restore it afterwards, just in case.
QString previousTimeZone = qgetenv("TZ");
+ // Start off in a certain timezone.
qputenv("TZ", serialiseAs.toLocal8Bit().constData());
tzset();
QDateTime dateTimeAsUTC(dateTime.toUTC());
@@ -1284,8 +1341,15 @@ void tst_QDateTime::operator_insert_extract()
QByteArray byteArray;
{
QDataStream dataStream(&byteArray, QIODevice::WriteOnly);
- dataStream << dateTime;
- dataStream << dateTime;
+ dataStream.setVersion(dataStreamVersion);
+ if (dataStreamVersion >= QDataStream::Qt_5_0) {
+ // Qt 5 serialises as UTC and converts back to the stored timeSpec when
+ // deserialising; we don't need to do it ourselves...
+ dataStream << dateTime << dateTime;
+ } else {
+ // ... but lower versions don't, so we have to here.
+ dataStream << dateTimeAsUTC << dateTimeAsUTC;
+ }
}
// Ensure that a change in timezone between serialisation and deserialisation
@@ -1296,11 +1360,26 @@ void tst_QDateTime::operator_insert_extract()
{
// Deserialise whole QDateTime at once.
QDataStream dataStream(&byteArray, QIODevice::ReadOnly);
+ dataStream.setVersion(dataStreamVersion);
QDateTime deserialised;
dataStream >> deserialised;
- // Ensure local time is still correct.
- QCOMPARE(deserialised, expectedLocalTime);
- // Sanity check UTC times.
+
+ if (dataStreamVersion >= QDataStream::Qt_5_0) {
+ // Ensure local time is still correct. Again, Qt 5 handles the timeSpec
+ // conversion (in this case, UTC => LocalTime) for us when deserialising.
+ QCOMPARE(deserialised, expectedLocalTime);
+ } else {
+ if (dataStreamVersion < QDataStream::Qt_4_0) {
+ // Versions lower than Qt 4 don't serialise the timeSpec, instead
+ // assuming that everything is LocalTime.
+ deserialised.setTimeSpec(Qt::UTC);
+ }
+ // Qt 4.* versions do serialise the timeSpec, so we only need to convert from UTC here.
+ deserialised = deserialised.toLocalTime();
+
+ QCOMPARE(deserialised, expectedLocalTime);
+ }
+ // Sanity check UTC times (operator== already converts its operands to UTC before comparing).
QCOMPARE(deserialised.toUTC(), expectedLocalTime.toUTC());
// Deserialise each component individually.
@@ -1309,9 +1388,11 @@ void tst_QDateTime::operator_insert_extract()
QTime deserialisedTime;
dataStream >> deserialisedTime;
qint8 deserialisedSpec;
- dataStream >> deserialisedSpec;
+ if (dataStreamVersion >= QDataStream::Qt_4_0)
+ dataStream >> deserialisedSpec;
deserialised = QDateTime(deserialisedDate, deserialisedTime, Qt::UTC);
- deserialised = deserialised.toTimeSpec(static_cast<Qt::TimeSpec>(deserialisedSpec));
+ if (dataStreamVersion >= QDataStream::Qt_4_0)
+ deserialised = deserialised.toTimeSpec(static_cast<Qt::TimeSpec>(deserialisedSpec));
// Ensure local time is still correct.
QCOMPARE(deserialised, expectedLocalTime);
// Sanity check UTC times.
@@ -1352,8 +1433,6 @@ void tst_QDateTime::toString_strformat_data()
<< QString("d'foobar'") << QString("31foobar");
QTest::newRow( "datetime9" ) << QDateTime(QDate(1999, 12, 31), QTime(3, 59, 59, 999))
<< QString("hhhhh") << QString("03033");
- QTest::newRow( "datetime10" ) << QDateTime(QDate(1999, 12, 31), QTime(3, 59, 59, 999))
- << QString("hhhhhaA") << QString("03033amAM");
QTest::newRow( "datetime11" ) << QDateTime(QDate(1999, 12, 31), QTime(23, 59, 59, 999))
<< QString("HHHhhhAaAPap") << QString("23231111PMpmPMpm");
QTest::newRow( "datetime12" ) << QDateTime(QDate(1999, 12, 31), QTime(3, 59, 59, 999))
@@ -1361,6 +1440,26 @@ void tst_QDateTime::toString_strformat_data()
QTest::newRow( "datetime13" ) << QDateTime(QDate(1974, 12, 1), QTime(14, 14, 20))
<< QString("hh''mm''ss dd''MM''yyyy")
<< QString("14'14'20 01'12'1974");
+ QTest::newRow( "missing p and P" ) << QDateTime(QDate(1999, 12, 31), QTime(3, 59, 59, 999))
+ << QString("hhhhhaA") << QString("03033aA");
+ QTest::newRow( "OK A, bad P" ) << QDateTime(QDate(1999, 12, 31), QTime(0, 59, 59, 999))
+ << QString("hhAX") << QString("00AX");
+ QTest::newRow( "single, 0 => 12 AM" ) << QDateTime(QDate(1999, 12, 31), QTime(0, 59, 59, 999))
+ << QString("hAP") << QString("12AM");
+ QTest::newRow( "double, 0 => 12 AM" ) << QDateTime(QDate(1999, 12, 31), QTime(0, 59, 59, 999))
+ << QString("hhAP") << QString("12AM");
+ QTest::newRow( "double, garbage" ) << QDateTime(QDate(1999, 12, 31), QTime(0, 59, 59, 999))
+ << QString("hhAX") << QString("00AX");
+ QTest::newRow( "dddd" ) << QDateTime(QDate(1999, 12, 31), QTime(0, 59, 59, 999))
+ << QString("dddd") << QString("Friday");
+ QTest::newRow( "ddd" ) << QDateTime(QDate(1999, 12, 31), QTime(0, 59, 59, 999))
+ << QString("ddd") << QString("Fri");
+ QTest::newRow( "MMMM" ) << QDateTime(QDate(1999, 12, 31), QTime(0, 59, 59, 999))
+ << QString("MMMM") << QString("December");
+ QTest::newRow( "MMM" ) << QDateTime(QDate(1999, 12, 31), QTime(0, 59, 59, 999))
+ << QString("MMM") << QString("Dec");
+ QTest::newRow( "emtpy" ) << QDateTime(QDate(1999, 12, 31), QTime(0, 59, 59, 999))
+ << QString("") << QString("");
}
void tst_QDateTime::toString_strformat()
@@ -1376,126 +1475,164 @@ void tst_QDateTime::fromStringDateFormat_data()
QTest::addColumn<QString>("dateTimeStr");
QTest::addColumn<Qt::DateFormat>("dateFormat");
QTest::addColumn<QDateTime>("expected");
- QTest::addColumn<Qt::TimeSpec>("timeSpec");
// Test Qt::TextDate format.
QTest::newRow("text date") << QString::fromLatin1("Tue Jun 17 08:00:10 2003")
- << Qt::TextDate << QDateTime(QDate(2003, 6, 17), QTime(8, 0, 10, 0)) << Qt::LocalTime;
+ << Qt::TextDate << QDateTime(QDate(2003, 6, 17), QTime(8, 0, 10, 0), Qt::LocalTime);
QTest::newRow("text date Year 0999") << QString::fromLatin1("Tue Jun 17 08:00:10 0999")
- << Qt::TextDate << QDateTime(QDate(999, 6, 17), QTime(8, 0, 10, 0)) << Qt::LocalTime;
+ << Qt::TextDate << QDateTime(QDate(999, 6, 17), QTime(8, 0, 10, 0), Qt::LocalTime);
QTest::newRow("text date Year 999") << QString::fromLatin1("Tue Jun 17 08:00:10 999")
- << Qt::TextDate << QDateTime(QDate(999, 6, 17), QTime(8, 0, 10, 0)) << Qt::LocalTime;
+ << Qt::TextDate << QDateTime(QDate(999, 6, 17), QTime(8, 0, 10, 0), Qt::LocalTime);
QTest::newRow("text date Year 12345") << QString::fromLatin1("Tue Jun 17 08:00:10 12345")
- << Qt::TextDate << QDateTime(QDate(12345, 6, 17), QTime(8, 0, 10, 0)) << Qt::LocalTime;
+ << Qt::TextDate << QDateTime(QDate(12345, 6, 17), QTime(8, 0, 10, 0), Qt::LocalTime);
QTest::newRow("text date Year -4712") << QString::fromLatin1("Tue Jan 1 00:01:02 -4712")
- << Qt::TextDate << QDateTime(QDate(-4712, 1, 1), QTime(0, 1, 2, 0)) << Qt::LocalTime;
- QTest::newRow("data0") << QString::fromLatin1("Thu Jan 1 00:00:00 1970")
- << Qt::TextDate << QDateTime(QDate(1970, 1, 1), QTime(0, 0, 0)) << Qt::LocalTime;
- QTest::newRow("data1") << QString::fromLatin1("Thu Jan 2 12:34 1970")
- << Qt::TextDate << QDateTime(QDate(1970, 1, 2), QTime(12, 34, 0)) << Qt::LocalTime;
- QTest::newRow("data2") << QString::fromLatin1("Thu Jan 1 00 1970")
- << Qt::TextDate << invalidDateTime() << Qt::LocalTime;
- QTest::newRow("data3") << QString::fromLatin1("Thu Jan 1 00:00:00:00 1970")
- << Qt::TextDate << invalidDateTime() << Qt::LocalTime;
- QTest::newRow("data4") << QString::fromLatin1("Thu Jan 1 00:00:00:00 1970")
- << Qt::TextDate << invalidDateTime() << Qt::LocalTime;
- QTest::newRow("data5") << QString::fromLatin1(" Thu Jan 1 00:00:00 1970 ")
- << Qt::TextDate << QDateTime(QDate(1970, 1, 1), QTime(0, 0, 0)) << Qt::LocalTime;
- QTest::newRow("data6") << QString::fromLatin1("Thu Jan 1 00:00:00")
- << Qt::TextDate << invalidDateTime() << Qt::LocalTime;
- QTest::newRow("data7") << QString::fromLatin1("Thu Jan 1 1970 00:00:00")
- << Qt::TextDate << QDateTime(QDate(1970, 1, 1), QTime(0, 0, 0)) << Qt::LocalTime;
- QTest::newRow("data8") << QString::fromLatin1("Thu Jan 1 00:12:34 1970 GMT+foo")
- << Qt::TextDate << invalidDateTime() << Qt::LocalTime;
- QTest::newRow("data9") << QString::fromLatin1("Thu Jan 1 00:12:34 1970 GMT")
- << Qt::TextDate << QDateTime(QDate(1970, 1, 1), QTime(0, 12, 34)) << Qt::UTC;
- QTest::newRow("data10") << QString::fromLatin1("Thu Jan 1 00:12:34 1970 GMT-0300")
- << Qt::TextDate << QDateTime(QDate(1970, 1, 1), QTime(3, 12, 34)) << Qt::UTC;
- QTest::newRow("data11") << QString::fromLatin1("Thu Jan 1 00:12:34 1970 GMT+0300")
- << Qt::TextDate << QDateTime(QDate(1969, 12, 31), QTime(21, 12, 34)) << Qt::UTC;
- QTest::newRow("data12") << QString::fromLatin1("Thu Jan 1 00:12:34 1970 gmt")
- << Qt::TextDate << QDateTime(QDate(1970, 1, 1), QTime(0, 12, 34)) << Qt::UTC;
- QTest::newRow("data13") << QString::fromLatin1("Thu Jan 1 1970 00:12:34 GMT+0100")
- << Qt::TextDate << QDateTime(QDate(1969, 12, 31), QTime(23, 12, 34)) << Qt::UTC;
+ << Qt::TextDate << QDateTime(QDate(-4712, 1, 1), QTime(0, 1, 2, 0), Qt::LocalTime);
+ QTest::newRow("text data0") << QString::fromLatin1("Thu Jan 1 00:00:00 1970")
+ << Qt::TextDate << QDateTime(QDate(1970, 1, 1), QTime(0, 0, 0), Qt::LocalTime);
+ QTest::newRow("text data1") << QString::fromLatin1("Thu Jan 2 12:34 1970")
+ << Qt::TextDate << QDateTime(QDate(1970, 1, 2), QTime(12, 34, 0), Qt::LocalTime);
+ QTest::newRow("text data2") << QString::fromLatin1("Thu Jan 1 00 1970")
+ << Qt::TextDate << invalidDateTime();
+ QTest::newRow("text data3") << QString::fromLatin1("Thu Jan 1 00:00:00:00 1970")
+ << Qt::TextDate << invalidDateTime();
+ QTest::newRow("text data4") << QString::fromLatin1("Thu 1. Jan 00:00:00 1970")
+ << Qt::TextDate << QDateTime(QDate(1970, 1, 1), QTime(0, 0), Qt::LocalTime);
+ QTest::newRow("text data5") << QString::fromLatin1(" Thu Jan 1 00:00:00 1970 ")
+ << Qt::TextDate << QDateTime(QDate(1970, 1, 1), QTime(0, 0, 0), Qt::LocalTime);
+ QTest::newRow("text data6") << QString::fromLatin1("Thu Jan 1 00:00:00")
+ << Qt::TextDate << invalidDateTime();
+ QTest::newRow("text data7") << QString::fromLatin1("Thu Jan 1 1970 00:00:00")
+ << Qt::TextDate << QDateTime(QDate(1970, 1, 1), QTime(0, 0, 0), Qt::LocalTime);
+ QTest::newRow("text data8") << QString::fromLatin1("Thu Jan 1 00:12:34 1970 GMT+foo")
+ << Qt::TextDate << invalidDateTime();
+ QTest::newRow("text data9") << QString::fromLatin1("Thu Jan 1 00:12:34 1970 GMT")
+ << Qt::TextDate << QDateTime(QDate(1970, 1, 1), QTime(0, 12, 34), Qt::UTC);
+ QTest::newRow("text data10") << QString::fromLatin1("Thu Jan 1 00:12:34 1970 GMT-0300")
+ << Qt::TextDate << QDateTime(QDate(1970, 1, 1), QTime(3, 12, 34), Qt::UTC);
+ QTest::newRow("text data11") << QString::fromLatin1("Thu Jan 1 00:12:34 1970 GMT+0300")
+ << Qt::TextDate << QDateTime(QDate(1969, 12, 31), QTime(21, 12, 34), Qt::UTC);
+ QTest::newRow("text data12") << QString::fromLatin1("Thu Jan 1 00:12:34 1970 gmt")
+ << Qt::TextDate << QDateTime(QDate(1970, 1, 1), QTime(0, 12, 34), Qt::UTC);
+ QTest::newRow("text data13") << QString::fromLatin1("Thu Jan 1 1970 00:12:34 GMT+0100")
+ << Qt::TextDate << QDateTime(QDate(1969, 12, 31), QTime(23, 12, 34), Qt::UTC);
+ QTest::newRow("text empty") << QString::fromLatin1("")
+ << Qt::TextDate << invalidDateTime();
+ QTest::newRow("text too many parts") << QString::fromLatin1("Thu Jan 1 00:12:34 1970 gmt +0100")
+ << Qt::TextDate << invalidDateTime();
+ QTest::newRow("text invalid month name") << QString::fromLatin1("Thu Jaz 1 1970 00:12:34")
+ << Qt::TextDate << invalidDateTime();
+ QTest::newRow("text invalid date") << QString::fromLatin1("Thu Jan 32 1970 00:12:34")
+ << Qt::TextDate << QDateTime(invalidDate(), QTime(0, 12, 34), Qt::LocalTime);
+ QTest::newRow("text invalid day #1") << QString::fromLatin1("Thu Jan XX 1970 00:12:34")
+ << Qt::TextDate << invalidDateTime();
+ QTest::newRow("text invalid day #2") << QString::fromLatin1("Thu X. Jan 00:00:00 1970")
+ << Qt::TextDate << invalidDateTime();
+ QTest::newRow("text invalid day #3") << QString::fromLatin1("Thu 1 Jan 00:00:00 1970")
+ << Qt::TextDate << invalidDateTime();
+ QTest::newRow("text invalid year #1") << QString::fromLatin1("Thu 1. Jan 00:00:00 19X0")
+ << Qt::TextDate << invalidDateTime();
+ QTest::newRow("text invalid year #2") << QString::fromLatin1("Thu 1. Jan 19X0 00:00:00")
+ << Qt::TextDate << invalidDateTime();
+ QTest::newRow("text invalid hour") << QString::fromLatin1("Thu 1. Jan 1970 0X:00:00")
+ << Qt::TextDate << invalidDateTime();
+ QTest::newRow("text invalid minute") << QString::fromLatin1("Thu 1. Jan 1970 00:0X:00")
+ << Qt::TextDate << invalidDateTime();
+ QTest::newRow("text invalid second") << QString::fromLatin1("Thu 1. Jan 1970 00:00:0X")
+ << Qt::TextDate << invalidDateTime();
+ QTest::newRow("text invalid gmt specifier #1") << QString::fromLatin1("Thu 1. Jan 1970 00:00:00 DMT")
+ << Qt::TextDate << invalidDateTime();
+ QTest::newRow("text invalid gmt specifier #2") << QString::fromLatin1("Thu 1. Jan 1970 00:00:00 GMTx0200")
+ << Qt::TextDate << invalidDateTime();
+ QTest::newRow("text invalid gmt hour") << QString::fromLatin1("Thu 1. Jan 1970 00:00:00 GMT+0X00")
+ << Qt::TextDate << invalidDateTime();
+ QTest::newRow("text invalid gmt minute") << QString::fromLatin1("Thu 1. Jan 1970 00:00:00 GMT+000X")
+ << Qt::TextDate << invalidDateTime();
// Test Qt::ISODate format.
- QTest::newRow("data14") << QString::fromLatin1("1987-02-13T13:24:51+01:00")
- << Qt::ISODate << QDateTime(QDate(1987, 2, 13), QTime(12, 24, 51)) << Qt::UTC;
- QTest::newRow("data15") << QString::fromLatin1("1987-02-13T13:24:51-01:00")
- << Qt::ISODate << QDateTime(QDate(1987, 2, 13), QTime(14, 24, 51)) << Qt::UTC;
+ QTest::newRow("ISO +01:00") << QString::fromLatin1("1987-02-13T13:24:51+01:00")
+ << Qt::ISODate << QDateTime(QDate(1987, 2, 13), QTime(12, 24, 51), Qt::UTC);
+ QTest::newRow("ISO -01:00") << QString::fromLatin1("1987-02-13T13:24:51-01:00")
+ << Qt::ISODate << QDateTime(QDate(1987, 2, 13), QTime(14, 24, 51), Qt::UTC);
+ // Not sure about these two... it will currently be created as LocalTime, but it
+ // should probably be UTC according to the ISO 8601 spec (see 4.2.5.1).
+ QTest::newRow("ISO +0000") << QString::fromLatin1("1970-01-01T00:12:34+0000")
+ << Qt::ISODate << QDateTime(QDate(1970, 1, 1), QTime(0, 12, 34), Qt::LocalTime);
+ QTest::newRow("ISO +00:00") << QString::fromLatin1("1970-01-01T00:12:34+00:00")
+ << Qt::ISODate << QDateTime(QDate(1970, 1, 1), QTime(0, 12, 34), Qt::LocalTime);
// No time specified - defaults to Qt::LocalTime.
- QTest::newRow("data16") << QString::fromLatin1("2002-10-01")
- << Qt::ISODate << QDateTime(QDate(2002, 10, 1), QTime(0, 0, 0, 0)) << Qt::LocalTime;
+ QTest::newRow("ISO data3") << QString::fromLatin1("2002-10-01")
+ << Qt::ISODate << QDateTime(QDate(2002, 10, 1), QTime(0, 0, 0, 0), Qt::LocalTime);
QTest::newRow("ISO") << QString::fromLatin1("2005-06-28T07:57:30.0010000000Z")
- << Qt::ISODate << QDateTime(QDate(2005, 6, 28), QTime(7, 57, 30, 1)) << Qt::UTC;
+ << Qt::ISODate << QDateTime(QDate(2005, 6, 28), QTime(7, 57, 30, 1), Qt::UTC);
QTest::newRow("ISO with comma 1") << QString::fromLatin1("2005-06-28T07:57:30,0040000000Z")
- << Qt::ISODate << QDateTime(QDate(2005, 6, 28), QTime(7, 57, 30, 4)) << Qt::UTC;
+ << Qt::ISODate << QDateTime(QDate(2005, 6, 28), QTime(7, 57, 30, 4), Qt::UTC);
QTest::newRow("ISO with comma 2") << QString::fromLatin1("2005-06-28T07:57:30,0015Z")
- << Qt::ISODate << QDateTime(QDate(2005, 6, 28), QTime(7, 57, 30, 2)) << Qt::UTC;
+ << Qt::ISODate << QDateTime(QDate(2005, 6, 28), QTime(7, 57, 30, 2), Qt::UTC);
QTest::newRow("ISO with comma 3") << QString::fromLatin1("2005-06-28T07:57:30,0014Z")
- << Qt::ISODate << QDateTime(QDate(2005, 6, 28), QTime(7, 57, 30, 1)) << Qt::UTC;
+ << Qt::ISODate << QDateTime(QDate(2005, 6, 28), QTime(7, 57, 30, 1), Qt::UTC);
QTest::newRow("ISO with comma 4") << QString::fromLatin1("2005-06-28T07:57:30,1Z")
- << Qt::ISODate << QDateTime(QDate(2005, 6, 28), QTime(7, 57, 30, 100)) << Qt::UTC;
+ << Qt::ISODate << QDateTime(QDate(2005, 6, 28), QTime(7, 57, 30, 100), Qt::UTC);
QTest::newRow("ISO with comma 5") << QString::fromLatin1("2005-06-28T07:57:30,11")
- << Qt::ISODate << QDateTime(QDate(2005, 6, 28), QTime(7, 57, 30, 110)) << Qt::LocalTime;
+ << Qt::ISODate << QDateTime(QDate(2005, 6, 28), QTime(7, 57, 30, 110), Qt::LocalTime);
// 24:00:00 Should be next day according to ISO 8601 section 4.2.3.
QTest::newRow("ISO 24:00") << QString::fromLatin1("2012-06-04T24:00:00")
- << Qt::ISODate << QDateTime(QDate(2012, 6, 5), QTime(0, 0, 0, 0)) << Qt::LocalTime;
+ << Qt::ISODate << QDateTime(QDate(2012, 6, 5), QTime(0, 0, 0, 0), Qt::LocalTime);
QTest::newRow("ISO 24:00 end of month") << QString::fromLatin1("2012-06-30T24:00:00")
- << Qt::ISODate << QDateTime(QDate(2012, 7, 1), QTime(0, 0, 0, 0)) << Qt::LocalTime;
+ << Qt::ISODate << QDateTime(QDate(2012, 7, 1), QTime(0, 0, 0, 0), Qt::LocalTime);
QTest::newRow("ISO 24:00 end of year") << QString::fromLatin1("2012-12-31T24:00:00")
- << Qt::ISODate << QDateTime(QDate(2013, 1, 1), QTime(0, 0, 0, 0)) << Qt::LocalTime;
+ << Qt::ISODate << QDateTime(QDate(2013, 1, 1), QTime(0, 0, 0, 0), Qt::LocalTime);
QTest::newRow("ISO 24:00, fract ms") << QString::fromLatin1("2012-01-01T24:00:00.000")
- << Qt::ISODate << QDateTime(QDate(2012, 1, 2), QTime(0, 0, 0, 0)) << Qt::LocalTime;
+ << Qt::ISODate << QDateTime(QDate(2012, 1, 2), QTime(0, 0, 0, 0), Qt::LocalTime);
QTest::newRow("ISO 24:00 end of year, fract ms") << QString::fromLatin1("2012-12-31T24:00:00.000")
- << Qt::ISODate << QDateTime(QDate(2013, 1, 1), QTime(0, 0, 0, 0)) << Qt::LocalTime;
+ << Qt::ISODate << QDateTime(QDate(2013, 1, 1), QTime(0, 0, 0, 0), Qt::LocalTime);
// Test fractional seconds.
QTest::newRow("ISO .0 of a second (period)") << QString::fromLatin1("2012-01-01T08:00:00.0")
- << Qt::ISODate << QDateTime(QDate(2012, 1, 1), QTime(8, 0, 0, 0)) << Qt::LocalTime;
+ << Qt::ISODate << QDateTime(QDate(2012, 1, 1), QTime(8, 0, 0, 0), Qt::LocalTime);
QTest::newRow("ISO .00 of a second (period)") << QString::fromLatin1("2012-01-01T08:00:00.00")
- << Qt::ISODate << QDateTime(QDate(2012, 1, 1), QTime(8, 0, 0, 0)) << Qt::LocalTime;
+ << Qt::ISODate << QDateTime(QDate(2012, 1, 1), QTime(8, 0, 0, 0), Qt::LocalTime);
QTest::newRow("ISO .000 of a second (period)") << QString::fromLatin1("2012-01-01T08:00:00.000")
- << Qt::ISODate << QDateTime(QDate(2012, 1, 1), QTime(8, 0, 0, 0)) << Qt::LocalTime;
+ << Qt::ISODate << QDateTime(QDate(2012, 1, 1), QTime(8, 0, 0, 0), Qt::LocalTime);
QTest::newRow("ISO .1 of a second (comma)") << QString::fromLatin1("2012-01-01T08:00:00,1")
- << Qt::ISODate << QDateTime(QDate(2012, 1, 1), QTime(8, 0, 0, 100)) << Qt::LocalTime;
+ << Qt::ISODate << QDateTime(QDate(2012, 1, 1), QTime(8, 0, 0, 100), Qt::LocalTime);
QTest::newRow("ISO .99 of a second (comma)") << QString::fromLatin1("2012-01-01T08:00:00,99")
- << Qt::ISODate << QDateTime(QDate(2012, 1, 1), QTime(8, 0, 0, 990)) << Qt::LocalTime;
+ << Qt::ISODate << QDateTime(QDate(2012, 1, 1), QTime(8, 0, 0, 990), Qt::LocalTime);
QTest::newRow("ISO .998 of a second (comma)") << QString::fromLatin1("2012-01-01T08:00:00,998")
- << Qt::ISODate << QDateTime(QDate(2012, 1, 1), QTime(8, 0, 0, 998)) << Qt::LocalTime;
+ << Qt::ISODate << QDateTime(QDate(2012, 1, 1), QTime(8, 0, 0, 998), Qt::LocalTime);
QTest::newRow("ISO .999 of a second (comma)") << QString::fromLatin1("2012-01-01T08:00:00,999")
- << Qt::ISODate << QDateTime(QDate(2012, 1, 1), QTime(8, 0, 0, 999)) << Qt::LocalTime;
+ << Qt::ISODate << QDateTime(QDate(2012, 1, 1), QTime(8, 0, 0, 999), Qt::LocalTime);
QTest::newRow("ISO .3335 of a second (comma)") << QString::fromLatin1("2012-01-01T08:00:00,3335")
- << Qt::ISODate << QDateTime(QDate(2012, 1, 1), QTime(8, 0, 0, 334)) << Qt::LocalTime;
+ << Qt::ISODate << QDateTime(QDate(2012, 1, 1), QTime(8, 0, 0, 334), Qt::LocalTime);
QTest::newRow("ISO .333333 of a second (comma)") << QString::fromLatin1("2012-01-01T08:00:00,333333")
- << Qt::ISODate << QDateTime(QDate(2012, 1, 1), QTime(8, 0, 0, 333)) << Qt::LocalTime;
+ << Qt::ISODate << QDateTime(QDate(2012, 1, 1), QTime(8, 0, 0, 333), Qt::LocalTime);
QTest::newRow("ISO .00009 of a second (period)") << QString::fromLatin1("2012-01-01T08:00:00.00009")
- << Qt::ISODate << QDateTime(QDate(2012, 1, 1), QTime(8, 0, 0, 0)) << Qt::LocalTime;
+ << Qt::ISODate << QDateTime(QDate(2012, 1, 1), QTime(8, 0, 0, 0), Qt::LocalTime);
QTest::newRow("ISO no fract specified") << QString::fromLatin1("2012-01-01T08:00:00.")
- << Qt::ISODate << QDateTime(QDate(2012, 1, 1), QTime(8, 0, 0, 0)) << Qt::LocalTime;
+ << Qt::ISODate << QDateTime(QDate(2012, 1, 1), QTime(8, 0, 0, 0), Qt::LocalTime);
// Test invalid characters (should ignore invalid characters at end of string).
QTest::newRow("ISO invalid character at end") << QString::fromLatin1("2012-01-01T08:00:00!")
- << Qt::ISODate << QDateTime(QDate(2012, 1, 1), QTime(8, 0, 0, 0)) << Qt::LocalTime;
+ << Qt::ISODate << QDateTime(QDate(2012, 1, 1), QTime(8, 0, 0, 0), Qt::LocalTime);
QTest::newRow("ISO invalid character at front") << QString::fromLatin1("!2012-01-01T08:00:00")
- << Qt::ISODate << invalidDateTime() << Qt::LocalTime;
+ << Qt::ISODate << invalidDateTime();
QTest::newRow("ISO invalid character both ends") << QString::fromLatin1("!2012-01-01T08:00:00!")
- << Qt::ISODate << invalidDateTime() << Qt::LocalTime;
+ << Qt::ISODate << invalidDateTime();
QTest::newRow("ISO invalid character at front, 2 at back") << QString::fromLatin1("!2012-01-01T08:00:00..")
- << Qt::ISODate << invalidDateTime() << Qt::LocalTime;
+ << Qt::ISODate << invalidDateTime();
QTest::newRow("ISO invalid character 2 at front") << QString::fromLatin1("!!2012-01-01T08:00:00")
- << Qt::ISODate << invalidDateTime() << Qt::LocalTime;
+ << Qt::ISODate << invalidDateTime();
// Test fractional minutes.
QTest::newRow("ISO .0 of a minute (period)") << QString::fromLatin1("2012-01-01T08:00.0")
- << Qt::ISODate << QDateTime(QDate(2012, 1, 1), QTime(8, 0, 0, 0)) << Qt::LocalTime;
+ << Qt::ISODate << QDateTime(QDate(2012, 1, 1), QTime(8, 0, 0, 0), Qt::LocalTime);
QTest::newRow("ISO .8 of a minute (period)") << QString::fromLatin1("2012-01-01T08:00.8")
- << Qt::ISODate << QDateTime(QDate(2012, 1, 1), QTime(8, 0, 48, 0)) << Qt::LocalTime;
+ << Qt::ISODate << QDateTime(QDate(2012, 1, 1), QTime(8, 0, 48, 0), Qt::LocalTime);
QTest::newRow("ISO .99999 of a minute (period)") << QString::fromLatin1("2012-01-01T08:00.99999")
- << Qt::ISODate << QDateTime(QDate(2012, 1, 1), QTime(8, 0, 59, 999)) << Qt::LocalTime;
+ << Qt::ISODate << QDateTime(QDate(2012, 1, 1), QTime(8, 0, 59, 999), Qt::LocalTime);
QTest::newRow("ISO .0 of a minute (comma)") << QString::fromLatin1("2012-01-01T08:00,0")
- << Qt::ISODate << QDateTime(QDate(2012, 1, 1), QTime(8, 0, 0, 0)) << Qt::LocalTime;
+ << Qt::ISODate << QDateTime(QDate(2012, 1, 1), QTime(8, 0, 0, 0), Qt::LocalTime);
QTest::newRow("ISO .8 of a minute (comma)") << QString::fromLatin1("2012-01-01T08:00,8")
- << Qt::ISODate << QDateTime(QDate(2012, 1, 1), QTime(8, 0, 48, 0)) << Qt::LocalTime;
+ << Qt::ISODate << QDateTime(QDate(2012, 1, 1), QTime(8, 0, 48, 0), Qt::LocalTime);
QTest::newRow("ISO .99999 of a minute (comma)") << QString::fromLatin1("2012-01-01T08:00,99999")
- << Qt::ISODate << QDateTime(QDate(2012, 1, 1), QTime(8, 0, 59, 999)) << Qt::LocalTime;
+ << Qt::ISODate << QDateTime(QDate(2012, 1, 1), QTime(8, 0, 59, 999), Qt::LocalTime);
+ QTest::newRow("ISO empty") << QString::fromLatin1("") << Qt::ISODate << invalidDateTime();
}
void tst_QDateTime::fromStringDateFormat()
@@ -1503,10 +1640,8 @@ void tst_QDateTime::fromStringDateFormat()
QFETCH(QString, dateTimeStr);
QFETCH(Qt::DateFormat, dateFormat);
QFETCH(QDateTime, expected);
- QFETCH(Qt::TimeSpec, timeSpec);
QDateTime dateTime = QDateTime::fromString(dateTimeStr, dateFormat);
- expected.setTimeSpec(timeSpec);
QCOMPARE(dateTime, expected);
}
diff --git a/tests/auto/corelib/tools/qmap/tst_qmap.cpp b/tests/auto/corelib/tools/qmap/tst_qmap.cpp
index e07b3fc81e..e64496352c 100644
--- a/tests/auto/corelib/tools/qmap/tst_qmap.cpp
+++ b/tests/auto/corelib/tools/qmap/tst_qmap.cpp
@@ -49,9 +49,13 @@
class tst_QMap : public QObject
{
Q_OBJECT
+protected:
+ template <class KEY, class VALUE>
+ void sanityCheckTree(const QMap<KEY, VALUE> &m, int calledFromLine);
public slots:
void init();
private slots:
+ void ctor();
void count();
void clear();
void beginEnd();
@@ -79,6 +83,7 @@ private slots:
void setSharable();
void insert();
+ void checkMostLeftNode();
};
typedef QMap<QString, QString> StringMap;
@@ -115,11 +120,57 @@ QDebug operator << (QDebug d, const MyClass &c) {
return d;
}
+template <class KEY, class VALUE>
+void tst_QMap::sanityCheckTree(const QMap<KEY, VALUE> &m, int calledFromLine)
+{
+ QString possibleFrom;
+ possibleFrom.setNum(calledFromLine);
+ possibleFrom = "Called from line: " + possibleFrom;
+ int count = 0;
+ typename QMap<KEY, VALUE>::const_iterator oldite = m.constBegin();
+ for (typename QMap<KEY, VALUE>::const_iterator i = m.constBegin(); i != m.constEnd(); ++i) {
+ count++;
+ bool oldIteratorIsLarger = i.key() < oldite.key();
+ QVERIFY2(!oldIteratorIsLarger, possibleFrom.toUtf8());
+ oldite = i;
+ }
+ if (m.size() != count) { // Fail
+ qDebug() << possibleFrom;
+ QCOMPARE(m.size(), count);
+ }
+ if (m.size() == 0)
+ QVERIFY(m.constBegin() == m.constEnd());
+}
+
void tst_QMap::init()
{
MyClass::count = 0;
}
+void tst_QMap::ctor()
+{
+ std::map<int, int> map;
+ for (int i = 0; i < 100000; ++i)
+ map.insert(std::pair<int, int>(i * 3, i * 7));
+
+ QMap<int, int> qmap(map); // ctor.
+
+ // Check that we have the same
+ std::map<int, int>::iterator j = map.begin();
+ QMap<int, int>::const_iterator i = qmap.constBegin();
+
+ while (i != qmap.constEnd()) {
+ QCOMPARE( (*j).first, i.key());
+ QCOMPARE( (*j).second, i.value());
+ ++i;
+ ++j;
+ }
+
+ QCOMPARE( (int) map.size(), qmap.size());
+}
+
+
+
void tst_QMap::count()
{
{
@@ -280,6 +331,7 @@ void tst_QMap::clear()
map.insert( "key0", MyClass( "value1" ) );
map.insert( "key1", MyClass( "value2" ) );
map.clear();
+ sanityCheckTree(map, __LINE__);
QVERIFY( map.isEmpty() );
}
QCOMPARE( MyClass::count, int(0) );
@@ -400,6 +452,8 @@ void tst_QMap::swap()
m1.swap(m2);
QCOMPARE(m1.value(1),QLatin1String("m2[1]"));
QCOMPARE(m2.value(0),QLatin1String("m1[0]"));
+ sanityCheckTree(m1, __LINE__);
+ sanityCheckTree(m2, __LINE__);
}
void tst_QMap::operator_eq()
@@ -631,7 +685,7 @@ void tst_QMap::lowerUpperBound()
void tst_QMap::mergeCompare()
{
- QMap<int, QString> map1, map2, map3;
+ QMap<int, QString> map1, map2, map3, map1b, map2b;
map1.insert(1,"ett");
map1.insert(3,"tre");
@@ -641,6 +695,13 @@ void tst_QMap::mergeCompare()
map2.insert(4,"fyra");
map1.unite(map2);
+ sanityCheckTree(map1, __LINE__);
+
+ map1b = map1;
+ map2b = map2;
+ map2b.insert(0, "nul");
+ map1b.unite(map2b);
+ sanityCheckTree(map1b, __LINE__);
QVERIFY(map1.value(1) == "ett");
QVERIFY(map1.value(2) == "tvo");
@@ -958,9 +1019,11 @@ void tst_QMap::setSharable()
QVERIFY(!map.isDetached());
QVERIFY(copy.isSharedWith(map));
+ sanityCheckTree(copy, __LINE__);
}
map.setSharable(false);
+ sanityCheckTree(map, __LINE__);
QVERIFY(map.isDetached());
QCOMPARE(map.size(), 4);
QCOMPARE(const_(map)[4], QString("quatro"));
@@ -975,6 +1038,8 @@ void tst_QMap::setSharable()
QCOMPARE(const_(copy)[4], QString("quatro"));
QCOMPARE(map, copy);
+ sanityCheckTree(map, __LINE__);
+ sanityCheckTree(copy, __LINE__);
}
map.setSharable(true);
@@ -1012,5 +1077,57 @@ void tst_QMap::insert()
}
}
+void tst_QMap::checkMostLeftNode()
+{
+ QMap<int, int> map;
+
+ map.insert(100, 1);
+ sanityCheckTree(map, __LINE__);
+
+ // insert
+ map.insert(99, 1);
+ sanityCheckTree(map, __LINE__);
+ map.insert(98, 1);
+ sanityCheckTree(map, __LINE__);
+ map.insert(97, 1);
+ sanityCheckTree(map, __LINE__);
+ map.insert(96, 1);
+ sanityCheckTree(map, __LINE__);
+ map.insert(95, 1);
+
+ // remove
+ sanityCheckTree(map, __LINE__);
+ map.take(95);
+ sanityCheckTree(map, __LINE__);
+ map.remove(96);
+ sanityCheckTree(map, __LINE__);
+ map.erase(map.begin());
+ sanityCheckTree(map, __LINE__);
+ map.remove(97);
+ sanityCheckTree(map, __LINE__);
+ map.remove(98);
+ sanityCheckTree(map, __LINE__);
+ map.remove(99);
+ sanityCheckTree(map, __LINE__);
+ map.remove(100);
+ sanityCheckTree(map, __LINE__);
+ map.insert(200, 1);
+ QCOMPARE(map.constBegin().key(), 200);
+ sanityCheckTree(map, __LINE__);
+ // remove the non left most node
+ map.insert(202, 2);
+ map.insert(203, 3);
+ map.insert(204, 4);
+ map.remove(202);
+ sanityCheckTree(map, __LINE__);
+ map.remove(203);
+ sanityCheckTree(map, __LINE__);
+ map.remove(204);
+ sanityCheckTree(map, __LINE__);
+ // erase last item
+ map.erase(map.begin());
+ sanityCheckTree(map, __LINE__);
+}
+
QTEST_APPLESS_MAIN(tst_QMap)
#include "tst_qmap.moc"
diff --git a/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp b/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp
index 1918841d24..6a7ce66bd7 100644
--- a/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp
+++ b/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp
@@ -439,12 +439,7 @@ void tst_QPixmap::fill_data()
QTest::newRow(QString("syscolor_%1").arg(color).toLatin1())
<< uint(color) << true << false;
-#ifdef Q_WS_QWS
- if (QScreen::instance()->depth() >= 24) {
-#elif defined (Q_WS_X11)
- QPixmap pm(1, 1);
- if (pm.x11PictureHandle()) {
-#elif defined (Q_OS_WINCE)
+#if defined (Q_OS_WINCE)
QPixmap pixmap(1,1);
if (QApplication::desktop()->grab().depth() >= 24) {
#else
diff --git a/tests/auto/gui/itemmodels/qstandarditem/tst_qstandarditem.cpp b/tests/auto/gui/itemmodels/qstandarditem/tst_qstandarditem.cpp
index ca6d2b0585..7949e13a71 100644
--- a/tests/auto/gui/itemmodels/qstandarditem/tst_qstandarditem.cpp
+++ b/tests/auto/gui/itemmodels/qstandarditem/tst_qstandarditem.cpp
@@ -150,59 +150,59 @@ void tst_QStandardItem::getSetData()
QString text = QString("text %0").arg(i);
item.setText(text);
QCOMPARE(item.text(), text);
-
+
QPixmap pixmap(32, 32);
pixmap.fill((i == 1) ? Qt::red : Qt::green);
QIcon icon(pixmap);
item.setIcon(icon);
QCOMPARE(item.icon(), icon);
-
+
QString toolTip = QString("toolTip %0").arg(i);
item.setToolTip(toolTip);
QCOMPARE(item.toolTip(), toolTip);
-
+
QString statusTip = QString("statusTip %0").arg(i);
item.setStatusTip(statusTip);
QCOMPARE(item.statusTip(), statusTip);
-
+
QString whatsThis = QString("whatsThis %0").arg(i);
item.setWhatsThis(whatsThis);
QCOMPARE(item.whatsThis(), whatsThis);
-
+
QSize sizeHint(64*i, 48*i);
item.setSizeHint(sizeHint);
QCOMPARE(item.sizeHint(), sizeHint);
-
+
QFont font;
item.setFont(font);
QCOMPARE(item.font(), font);
-
+
Qt::Alignment textAlignment((i == 1)
? Qt::AlignLeft|Qt::AlignVCenter
: Qt::AlignRight);
item.setTextAlignment(textAlignment);
QCOMPARE(item.textAlignment(), textAlignment);
-
+
QColor backgroundColor((i == 1) ? Qt::blue : Qt::yellow);
item.setBackground(backgroundColor);
QCOMPARE(item.background().color(), backgroundColor);
-
+
QColor textColor((i == i) ? Qt::green : Qt::cyan);
item.setForeground(textColor);
QCOMPARE(item.foreground().color(), textColor);
-
+
Qt::CheckState checkState((i == 1) ? Qt::PartiallyChecked : Qt::Checked);
item.setCheckState(checkState);
QCOMPARE(item.checkState(), checkState);
-
+
QString accessibleText = QString("accessibleText %0").arg(i);
item.setAccessibleText(accessibleText);
QCOMPARE(item.accessibleText(), accessibleText);
-
+
QString accessibleDescription = QString("accessibleDescription %0").arg(i);
item.setAccessibleDescription(accessibleDescription);
QCOMPARE(item.accessibleDescription(), accessibleDescription);
-
+
QCOMPARE(item.text(), text);
QCOMPARE(item.icon(), icon);
QCOMPARE(item.toolTip(), toolTip);
@@ -216,7 +216,7 @@ void tst_QStandardItem::getSetData()
QCOMPARE(item.checkState(), checkState);
QCOMPARE(item.accessibleText(), accessibleText);
QCOMPARE(item.accessibleDescription(), accessibleDescription);
-
+
QCOMPARE(qvariant_cast<QString>(item.data(Qt::DisplayRole)), text);
QCOMPARE(qvariant_cast<QIcon>(item.data(Qt::DecorationRole)), icon);
QCOMPARE(qvariant_cast<QString>(item.data(Qt::ToolTipRole)), toolTip);
@@ -250,7 +250,7 @@ void tst_QStandardItem::getSetData()
item.setData(QVariant(), Qt::CheckStateRole);
item.setData(QVariant(), Qt::AccessibleTextRole);
item.setData(QVariant(), Qt::AccessibleDescriptionRole);
-
+
QCOMPARE(item.data(Qt::DisplayRole), QVariant());
QCOMPARE(item.data(Qt::DecorationRole), QVariant());
QCOMPARE(item.data(Qt::ToolTipRole), QVariant());
@@ -296,7 +296,7 @@ void tst_QStandardItem::getSetFlags()
QVERIFY(item.isDropEnabled());
QVERIFY(item.flags() & Qt::ItemIsDropEnabled);
#endif
-
+
QVERIFY(item.isEnabled());
item.setEnabled(false);
QVERIFY(!item.isEnabled());
@@ -332,7 +332,7 @@ void tst_QStandardItem::getSetFlags()
item.setCheckState(Qt::Checked);
item.setCheckable(true);
QCOMPARE(item.checkState(), Qt::Checked);
-}
+}
void tst_QStandardItem::getSetRowAndColumnCount()
{
@@ -427,7 +427,7 @@ void tst_QStandardItem::parent()
QCOMPARE(child->parent(), static_cast<QStandardItem*>(0));
item.setChild(0, 0, child);
QCOMPARE(child->parent(), &item);
-
+
QStandardItem *childOfChild = new QStandardItem;
child->setChild(0, 0, childOfChild);
QCOMPARE(childOfChild->parent(), child);
@@ -897,7 +897,7 @@ void tst_QStandardItem::takeRow()
void tst_QStandardItem::streamItem()
{
QStandardItem item;
-
+
item.setText(QLatin1String("text"));
item.setToolTip(QLatin1String("toolTip"));
item.setStatusTip(QLatin1String("statusTip"));
@@ -1006,7 +1006,7 @@ void tst_QStandardItem::sortChildren()
two->appendRow(new QStandardItem(QLatin1String("e")));
item->appendRow(one);
item->appendRow(two);
-
+
QSignalSpy layoutAboutToBeChangedSpy(
model, SIGNAL(layoutAboutToBeChanged()));
QSignalSpy layoutChangedSpy(
@@ -1021,7 +1021,7 @@ void tst_QStandardItem::sortChildren()
QCOMPARE(two->child(0)->text(), QLatin1String("f"));
QCOMPARE(two->child(1)->text(), QLatin1String("d"));
QCOMPARE(two->child(2)->text(), QLatin1String("e"));
-
+
two->sortChildren(0, Qt::AscendingOrder);
// verify sorted
QCOMPARE(two->child(0)->text(), QLatin1String("d"));
@@ -1031,7 +1031,7 @@ void tst_QStandardItem::sortChildren()
QCOMPARE(one->child(0)->text(), QLatin1String("c"));
QCOMPARE(one->child(1)->text(), QLatin1String("b"));
QCOMPARE(one->child(2)->text(), QLatin1String("a"));
-
+
item->sortChildren(0, Qt::AscendingOrder);
// verify everything sorted
QCOMPARE(one->child(0)->text(), QLatin1String("a"));
diff --git a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp
index cc291f72fa..a7c38d6664 100644
--- a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp
+++ b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp
@@ -336,12 +336,11 @@ class BlockableWindow : public QWindow
Q_OBJECT
public:
int blocked;
+ int leaves;
+ int enters;
inline BlockableWindow()
- : QWindow()
- {
- blocked = false;
- }
+ : QWindow(), blocked(false), enters(0), leaves(0) {}
bool event(QEvent *e)
{
@@ -352,11 +351,23 @@ public:
case QEvent::WindowUnblocked:
--blocked;
break;
+ case QEvent::Leave:
+ leaves++;
+ break;
+ case QEvent::Enter:
+ enters++;
+ break;
default:
break;
}
return QWindow::event(e);
}
+
+ void resetCounts()
+ {
+ leaves = 0;
+ enters = 0;
+ }
};
void tst_QGuiApplication::modalWindow()
@@ -391,6 +402,12 @@ void tst_QGuiApplication::modalWindow()
QCOMPARE(windowModalWindow2->blocked, 0);
QCOMPARE(applicationModalWindow1->blocked, 0);
+ // enter mouse in window1
+ QWindowSystemInterface::handleEnterEvent(window1);
+ QGuiApplication::processEvents();
+ QCOMPARE(window1->enters, 1);
+ QCOMPARE(window1->leaves, 0);
+
// show applicationModalWindow1, everything is blocked
applicationModalWindow1->show();
QCOMPARE(app.modalWindow(), applicationModalWindow1);
@@ -400,6 +417,24 @@ void tst_QGuiApplication::modalWindow()
QCOMPARE(windowModalWindow2->blocked, 1);
QCOMPARE(applicationModalWindow1->blocked, 0);
+ // opening modal causes leave for previously entered window, but not others
+ QGuiApplication::processEvents();
+ QCOMPARE(window1->enters, 1);
+ QCOMPARE(window1->leaves, 1);
+ QCOMPARE(window2->enters, 0);
+ QCOMPARE(window2->leaves, 0);
+ QCOMPARE(applicationModalWindow1->enters, 0);
+ QCOMPARE(applicationModalWindow1->leaves, 0);
+ window1->resetCounts();
+
+ // Try entering/leaving blocked window2 - no events should reach it
+ QWindowSystemInterface::handleEnterEvent(window2);
+ QGuiApplication::processEvents();
+ QWindowSystemInterface::handleLeaveEvent(window2);
+ QGuiApplication::processEvents();
+ QCOMPARE(window2->enters, 0);
+ QCOMPARE(window2->leaves, 0);
+
// everything is unblocked when applicationModalWindow1 is hidden
applicationModalWindow1->hide();
QCOMPARE(app.modalWindow(), static_cast<QWindow *>(0));
@@ -409,6 +444,12 @@ void tst_QGuiApplication::modalWindow()
QCOMPARE(windowModalWindow2->blocked, 0);
QCOMPARE(applicationModalWindow1->blocked, 0);
+ // Enter window2 - should not be blocked
+ QWindowSystemInterface::handleEnterEvent(window2);
+ QGuiApplication::processEvents();
+ QCOMPARE(window2->enters, 1);
+ QCOMPARE(window2->leaves, 0);
+
// show the windowModalWindow1, only window1 is blocked
windowModalWindow1->show();
QCOMPARE(app.modalWindow(), windowModalWindow1);
@@ -418,6 +459,15 @@ void tst_QGuiApplication::modalWindow()
QCOMPARE(windowModalWindow2->blocked, 0);
QCOMPARE(applicationModalWindow1->blocked, 0);
+ // opening window modal window doesn't cause leave for unblocked window
+ QGuiApplication::processEvents();
+ QCOMPARE(window1->enters, 0);
+ QCOMPARE(window1->leaves, 0);
+ QCOMPARE(window2->enters, 1);
+ QCOMPARE(window2->leaves, 0);
+ QCOMPARE(windowModalWindow1->enters, 0);
+ QCOMPARE(windowModalWindow1->leaves, 0);
+
// show the windowModalWindow2, windowModalWindow1 is blocked as well
windowModalWindow2->show();
QCOMPARE(app.modalWindow(), windowModalWindow2);
@@ -472,6 +522,17 @@ void tst_QGuiApplication::modalWindow()
QCOMPARE(windowModalWindow2->blocked, 1);
QCOMPARE(applicationModalWindow1->blocked, 0);
+ // window2 gets finally the leave
+ QGuiApplication::processEvents();
+ QCOMPARE(window1->enters, 0);
+ QCOMPARE(window1->leaves, 0);
+ QCOMPARE(window2->enters, 1);
+ QCOMPARE(window2->leaves, 1);
+ QCOMPARE(windowModalWindow1->enters, 0);
+ QCOMPARE(windowModalWindow1->leaves, 0);
+ QCOMPARE(applicationModalWindow1->enters, 0);
+ QCOMPARE(applicationModalWindow1->leaves, 0);
+
// hide applicationModalWindow1, windowModalWindow1 and window1 are blocked
applicationModalWindow1->hide();
QCOMPARE(app.modalWindow(), windowModalWindow2);
diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
index 84ba1f4fdf..f85e48022a 100644
--- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
+++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
@@ -67,6 +67,7 @@ private slots:
void touchCancel();
void touchCancelWithTouchToMouse();
void orientation();
+ void sizes();
void close();
void activateAndClose();
void mouseEventSequence();
@@ -739,6 +740,58 @@ void tst_QWindow::orientation()
QCOMPARE(spy.count(), 1);
}
+void tst_QWindow::sizes()
+{
+ QWindow window;
+
+ QSignalSpy minimumWidthSpy(&window, SIGNAL(minimumWidthChanged(int)));
+ QSignalSpy minimumHeightSpy(&window, SIGNAL(minimumHeightChanged(int)));
+ QSignalSpy maximumWidthSpy(&window, SIGNAL(maximumWidthChanged(int)));
+ QSignalSpy maximumHeightSpy(&window, SIGNAL(maximumHeightChanged(int)));
+
+ QSize oldMaximum = window.maximumSize();
+
+ window.setMinimumWidth(10);
+ QCOMPARE(window.minimumWidth(), 10);
+ QCOMPARE(window.minimumHeight(), 0);
+ QCOMPARE(window.minimumSize(), QSize(10, 0));
+ QCOMPARE(window.maximumSize(), oldMaximum);
+ QCOMPARE(minimumWidthSpy.count(), 1);
+ QCOMPARE(minimumHeightSpy.count(), 0);
+ QCOMPARE(maximumWidthSpy.count(), 0);
+ QCOMPARE(maximumHeightSpy.count(), 0);
+
+ window.setMinimumHeight(10);
+ QCOMPARE(window.minimumWidth(), 10);
+ QCOMPARE(window.minimumHeight(), 10);
+ QCOMPARE(window.minimumSize(), QSize(10, 10));
+ QCOMPARE(window.maximumSize(), oldMaximum);
+ QCOMPARE(minimumWidthSpy.count(), 1);
+ QCOMPARE(minimumHeightSpy.count(), 1);
+ QCOMPARE(maximumWidthSpy.count(), 0);
+ QCOMPARE(maximumHeightSpy.count(), 0);
+
+ window.setMaximumWidth(100);
+ QCOMPARE(window.maximumWidth(), 100);
+ QCOMPARE(window.maximumHeight(), oldMaximum.height());
+ QCOMPARE(window.minimumSize(), QSize(10, 10));
+ QCOMPARE(window.maximumSize(), QSize(100, oldMaximum.height()));
+ QCOMPARE(minimumWidthSpy.count(), 1);
+ QCOMPARE(minimumHeightSpy.count(), 1);
+ QCOMPARE(maximumWidthSpy.count(), 1);
+ QCOMPARE(maximumHeightSpy.count(), 0);
+
+ window.setMaximumHeight(100);
+ QCOMPARE(window.maximumWidth(), 100);
+ QCOMPARE(window.maximumHeight(), 100);
+ QCOMPARE(window.minimumSize(), QSize(10, 10));
+ QCOMPARE(window.maximumSize(), QSize(100, 100));
+ QCOMPARE(minimumWidthSpy.count(), 1);
+ QCOMPARE(minimumHeightSpy.count(), 1);
+ QCOMPARE(maximumWidthSpy.count(), 1);
+ QCOMPARE(maximumHeightSpy.count(), 1);
+}
+
void tst_QWindow::close()
{
QWindow a;
diff --git a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
index 09180b3de9..be3e68ad38 100644
--- a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
+++ b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
@@ -231,7 +231,9 @@ private slots:
void drawRect_task215378();
void drawRect_task247505();
+#if defined(Q_OS_MAC)
void drawText_subPixelPositionsInRaster_qtbug5053();
+#endif
void drawImage_data();
void drawImage();
@@ -4178,11 +4180,10 @@ void tst_QPainter::clipBoundingRect()
}
+#if defined(Q_OS_MAC)
+// Only Mac supports sub pixel positions in raster engine currently
void tst_QPainter::drawText_subPixelPositionsInRaster_qtbug5053()
{
-#if !defined(Q_OS_MAC)
- QSKIP("Only Mac supports sub pixel positions in raster engine currently");
-#endif
QFontMetricsF fm(qApp->font());
QImage baseLine(fm.width(QChar::fromLatin1('e')), fm.height(), QImage::Format_RGB32);
@@ -4212,6 +4213,7 @@ void tst_QPainter::drawText_subPixelPositionsInRaster_qtbug5053()
QVERIFY(foundDifferentRasterization);
}
+#endif
void tst_QPainter::drawPointScaled()
{
diff --git a/tests/auto/gui/text/qfontmetrics/qfontmetrics.pro b/tests/auto/gui/text/qfontmetrics/qfontmetrics.pro
index ef08458c56..88436f6a0e 100644
--- a/tests/auto/gui/text/qfontmetrics/qfontmetrics.pro
+++ b/tests/auto/gui/text/qfontmetrics/qfontmetrics.pro
@@ -1,7 +1,7 @@
CONFIG += testcase
CONFIG += parallel_test
TARGET = tst_qfontmetrics
-QT += testlib
+QT += testlib core-private gui-private
SOURCES += tst_qfontmetrics.cpp
RESOURCES += testfont.qrc
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/gui/text/qfontmetrics/tst_qfontmetrics.cpp b/tests/auto/gui/text/qfontmetrics/tst_qfontmetrics.cpp
index 4f502ae5f2..b457e17b48 100644
--- a/tests/auto/gui/text/qfontmetrics/tst_qfontmetrics.cpp
+++ b/tests/auto/gui/text/qfontmetrics/tst_qfontmetrics.cpp
@@ -44,6 +44,7 @@
#include <qfont.h>
#include <qfontmetrics.h>
#include <qfontdatabase.h>
+#include <private/qfontengine_p.h>
#include <qstringlist.h>
#include <qlist.h>
@@ -279,6 +280,39 @@ void tst_QFontMetrics::inFontUcs4()
QVERIFY(fm.inFontUcs4(0x1D7FF));
}
+ {
+ QFontEngine *engine = QFontPrivate::get(font)->engineForScript(QUnicodeTables::Common);
+ QGlyphLayout glyphs;
+ glyphs.numGlyphs = 3;
+ uint buf[3];
+ glyphs.glyphs = buf;
+
+ QString string;
+ {
+ string.append(QChar::highSurrogate(0x1D7FF));
+ string.append(QChar::lowSurrogate(0x1D7FF));
+
+ glyphs.numGlyphs = 3;
+ glyphs.glyphs[0] = 0;
+ QVERIFY(engine->stringToCMap(string.constData(), string.size(),
+ &glyphs, &glyphs.numGlyphs,
+ QFontEngine::GlyphIndicesOnly));
+ QCOMPARE(glyphs.numGlyphs, 1);
+ QCOMPARE(glyphs.glyphs[0], uint(1));
+ }
+ {
+ string.clear();
+ string.append(QChar::ObjectReplacementCharacter);
+
+ glyphs.numGlyphs = 3;
+ glyphs.glyphs[0] = 0;
+ QVERIFY(engine->stringToCMap(string.constData(), string.size(),
+ &glyphs, &glyphs.numGlyphs,
+ QFontEngine::GlyphIndicesOnly));
+ QVERIFY(glyphs.glyphs[0] != 1);
+ }
+ }
+
QFontDatabase::removeApplicationFont(id);
}
diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
index 284768ea13..b3282beaf5 100644
--- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
@@ -1354,7 +1354,8 @@ void tst_QNetworkReply::initTestCase()
if (testDataDir.isEmpty())
testDataDir = QCoreApplication::applicationDirPath();
- QVERIFY(QtNetworkSettings::verifyTestNetworkSettings());
+ if (!QtNetworkSettings::verifyTestNetworkSettings())
+ QSKIP("No network test server available");
#if !defined Q_OS_WIN
wronlyFileName = testDataDir + "/write-only" + uniqueExtension;
QFile wr(wronlyFileName);
diff --git a/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp b/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp
index 25ea5ca76e..f4c585c594 100644
--- a/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp
+++ b/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp
@@ -430,10 +430,10 @@ class LookupThread : public QThread
protected:
inline void run()
{
- QHostInfo info = QHostInfo::fromName("qt.nokia.com");
+ QHostInfo info = QHostInfo::fromName("qt-project.org");
QCOMPARE(info.error(), QHostInfo::NoError);
QVERIFY(info.addresses().count() > 0);
- QCOMPARE(info.addresses().at(0).toString(), QString("87.238.50.178"));
+ QCOMPARE(info.addresses().at(0).toString(), QString("87.238.53.172"));
}
};
@@ -468,7 +468,7 @@ public:
void LookupReceiver::start()
{
for (int i=0;i<numrequests;i++)
- QHostInfo::lookupHost(QString("qt.nokia.com"), this, SLOT(resultsReady(QHostInfo)));
+ QHostInfo::lookupHost(QString("qt-project.org"), this, SLOT(resultsReady(QHostInfo)));
}
void LookupReceiver::resultsReady(const QHostInfo &info)
@@ -499,7 +499,7 @@ void tst_QHostInfo::threadSafetyAsynchronousAPI()
QVERIFY(threads.at(k)->wait(60000));
foreach (LookupReceiver* receiver, receivers) {
QCOMPARE(receiver->result.error(), QHostInfo::NoError);
- QCOMPARE(receiver->result.addresses().at(0).toString(), QString("87.238.50.178"));
+ QCOMPARE(receiver->result.addresses().at(0).toString(), QString("87.238.53.172"));
QCOMPARE(receiver->numrequests, 0);
}
}
@@ -536,7 +536,7 @@ void tst_QHostInfo::multipleDifferentLookups_data()
void tst_QHostInfo::multipleDifferentLookups()
{
QStringList hostnameList;
- hostnameList << "www.ovi.com" << "www.nokia.com" << "qt.nokia.com" << "www.trolltech.com" << "troll.no"
+ hostnameList << "www.ovi.com" << "www.nokia.com" << "qt-project.org" << "www.trolltech.com" << "troll.no"
<< "www.qtcentre.org" << "forum.nokia.com" << "www.nokia.com" << "wiki.forum.nokia.com"
<< "www.nokia.com" << "nokia.de" << "127.0.0.1" << "----";
@@ -610,7 +610,7 @@ void tst_QHostInfo::abortHostLookup()
lookupsDoneCounter = 0;
bool valid = false;
int id = -1;
- QHostInfo result = qt_qhostinfo_lookup("qt.nokia.com", this, SLOT(resultsReady(QHostInfo)), &valid, &id);
+ QHostInfo result = qt_qhostinfo_lookup("qt-project.org", this, SLOT(resultsReady(QHostInfo)), &valid, &id);
QVERIFY(!valid);
//it is assumed that the DNS request/response in the backend is slower than it takes to call abort
QHostInfo::abortHostLookup(id);
@@ -637,7 +637,7 @@ void tst_QHostInfo::abortHostLookupInDifferentThread()
lookupsDoneCounter = 0;
bool valid = false;
int id = -1;
- QHostInfo result = qt_qhostinfo_lookup("qt.nokia.com", this, SLOT(resultsReady(QHostInfo)), &valid, &id);
+ QHostInfo result = qt_qhostinfo_lookup("qt-project.org", this, SLOT(resultsReady(QHostInfo)), &valid, &id);
QVERIFY(!valid);
QThread thread;
LookupAborter aborter;
diff --git a/tests/auto/network/ssl/qsslcertificate/more-certificates/cert-large-expiration-date.txt.1.0.1 b/tests/auto/network/ssl/qsslcertificate/more-certificates/cert-large-expiration-date.txt.1.0.1
new file mode 100644
index 0000000000..1a7d945b76
--- /dev/null
+++ b/tests/auto/network/ssl/qsslcertificate/more-certificates/cert-large-expiration-date.txt.1.0.1
@@ -0,0 +1,42 @@
+Certificate:
+ Data:
+ Version: 3 (0x2)
+ Serial Number:
+ ce:db:31:28:45:c4:05:40
+ Signature Algorithm: sha1WithRSAEncryption
+ Issuer: C=AU, ST=Some-State, O=Internet Widgits Pty Ltd
+ Validity
+ Not Before: Aug 4 09:53:41 2010 GMT
+ Not After : Aug 29 09:53:41 2051 GMT
+ Subject: C=AU, ST=Some-State, O=Internet Widgits Pty Ltd
+ Subject Public Key Info:
+ Public Key Algorithm: rsaEncryption
+ Public-Key: (1024 bit)
+ Modulus:
+ 00:cd:aa:db:6f:d6:34:c9:a7:f1:c0:be:e4:41:18:
+ 19:e2:02:c9:22:e6:a7:d5:ba:03:2e:9e:28:7a:f4:
+ 5f:1a:77:5f:77:a9:11:3b:8f:7e:f0:2e:c6:9e:eb:
+ 3a:d9:12:d7:c1:0c:51:e8:24:52:3f:23:c3:42:0c:
+ 11:c6:f2:1c:a1:42:fe:b4:c2:69:83:ad:f7:70:b1:
+ 18:15:cc:20:28:62:30:f0:2c:15:e6:33:19:af:c3:
+ eb:1c:c0:91:f7:11:68:94:50:f8:49:37:08:32:d7:
+ 3e:75:df:a3:bc:69:00:15:de:cd:87:0f:5c:02:6b:
+ 82:c8:01:7d:6a:f0:1d:dc:73
+ Exponent: 65537 (0x10001)
+ X509v3 extensions:
+ X509v3 Subject Key Identifier:
+ 8A:6E:19:E7:97:9B:8F:D9:7F:B3:BB:01:4F:E8:6A:2F:52:95:0D:D9
+ X509v3 Authority Key Identifier:
+ keyid:8A:6E:19:E7:97:9B:8F:D9:7F:B3:BB:01:4F:E8:6A:2F:52:95:0D:D9
+
+ X509v3 Basic Constraints:
+ CA:TRUE
+ Signature Algorithm: sha1WithRSAEncryption
+ a1:74:8e:5d:36:96:2c:05:7e:ea:66:cc:2e:68:c7:3d:93:dc:
+ 8c:a3:11:ad:b5:7e:6e:d0:04:c4:09:bd:0a:f9:39:3b:97:d7:
+ f0:bb:0c:09:7b:83:fe:bf:87:b0:47:e8:94:b7:aa:9c:79:ad:
+ 71:9e:b7:c4:99:98:6f:1d:38:32:f8:a3:75:38:c4:e5:e7:37:
+ 37:21:ec:7b:50:8b:15:b0:97:1e:17:9c:50:17:3c:c1:df:94:
+ 55:fb:60:2e:50:40:d1:ea:23:c6:3c:21:6f:97:8c:06:16:a5:
+ 82:72:c1:63:14:64:86:eb:d7:ff:72:f6:09:f5:6d:e6:04:13:
+ 7a:6a
diff --git a/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp b/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp
index 3ed753d292..c30a8f5e97 100644
--- a/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp
+++ b/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp
@@ -854,16 +854,25 @@ void tst_QSslCertificate::toText()
QCOMPARE(certList.size(), 1);
const QSslCertificate &cert = certList.at(0);
- // Openssl's cert dump method changed slightly between 0.9.8 and 1.0.0 versions, so we want it to match any output
+ // Openssl's cert dump method changed slightly between 0.9.8, 1.0.0 and 1.01 versions, so we want it to match any output
- QFile fOld(testDataDir + "/more-certificates/cert-large-expiration-date.txt.0.9.8");
- QVERIFY(fOld.open(QIODevice::ReadOnly | QFile::Text));
- QByteArray txtOld = fOld.readAll();
+ QFile f098(testDataDir + "/more-certificates/cert-large-expiration-date.txt.0.9.8");
+ QVERIFY(f098.open(QIODevice::ReadOnly | QFile::Text));
+ QByteArray txt098 = f098.readAll();
- QFile fNew(testDataDir + "/more-certificates/cert-large-expiration-date.txt.1.0.0");
- QVERIFY(fNew.open(QIODevice::ReadOnly | QFile::Text));
- QByteArray txtNew = fNew.readAll();
- QVERIFY(QString::fromLatin1(txtOld) == cert.toText() || QString::fromLatin1(txtNew) == cert.toText());
+ QFile f100(testDataDir + "/more-certificates/cert-large-expiration-date.txt.1.0.0");
+ QVERIFY(f100.open(QIODevice::ReadOnly | QFile::Text));
+ QByteArray txt100 = f100.readAll();
+
+ QFile f101(testDataDir + "/more-certificates/cert-large-expiration-date.txt.1.0.1");
+ QVERIFY(f101.open(QIODevice::ReadOnly | QFile::Text));
+ QByteArray txt101 = f101.readAll();
+
+ QString txtcert = cert.toText();
+
+ QVERIFY(QString::fromLatin1(txt098) == txtcert ||
+ QString::fromLatin1(txt100) == txtcert ||
+ QString::fromLatin1(txt101) == txtcert );
}
void tst_QSslCertificate::multipleCommonNames()
diff --git a/tests/auto/other/lancelot/scripts/arcs.qps b/tests/auto/other/lancelot/scripts/arcs.qps
index 8a7a468df1..8afaf73ff1 100644
--- a/tests/auto/other/lancelot/scripts/arcs.qps
+++ b/tests/auto/other/lancelot/scripts/arcs.qps
@@ -3,7 +3,7 @@
setRenderHint LineAntialiasing
-setPen red
+setPen red 0
drawEllipse 0 0 600 400
@@ -59,7 +59,7 @@ drawPath arcs
translate 200 400
rotate 10
scale 0.5 0.5
-setPen red
+setPen red 0
setBrush nobrush
drawEllipse 0 0 600 400
diff --git a/tests/auto/other/lancelot/scripts/beziers.qps b/tests/auto/other/lancelot/scripts/beziers.qps
index 9b47cd05ac..62d9d031a6 100644
--- a/tests/auto/other/lancelot/scripts/beziers.qps
+++ b/tests/auto/other/lancelot/scripts/beziers.qps
@@ -1,9 +1,10 @@
# Version: 1
# CheckVsReference: 5%
-
setRenderHint LineAntialiasing
+setPen green 0
+
translate 20 20
path_moveTo fullSize 0 0
path_cubicTo fullSize 200 100 -100 100 100 0
diff --git a/tests/auto/other/lancelot/scripts/join_cap_styles_duplicate_control_points.qps b/tests/auto/other/lancelot/scripts/join_cap_styles_duplicate_control_points.qps
index b4630148e2..96405ceae7 100644
--- a/tests/auto/other/lancelot/scripts/join_cap_styles_duplicate_control_points.qps
+++ b/tests/auto/other/lancelot/scripts/join_cap_styles_duplicate_control_points.qps
@@ -16,53 +16,53 @@ scale 2 2
setPen black 10 solidline roundcap roundjoin
drawPath p
-setPen red
+setPen red 0
drawPath p
translate 100 0
setPen black 10 solidline roundcap miterjoin
drawPath p
-setPen red
+setPen red 0
drawPath p
translate 100 0
setPen black 10 solidline roundcap beveljoin
drawPath p
-setPen red
+setPen red 0
drawPath p
translate -200 100
setPen black 10 solidline squarecap roundjoin
drawPath p
-setPen red
+setPen red 0
drawPath p
translate 100 0
setPen black 10 solidline squarecap miterjoin
drawPath p
-setPen red
+setPen red 0
drawPath p
translate 100 0
setPen black 10 solidline squarecap beveljoin
drawPath p
-setPen red
+setPen red 0
drawPath p
translate -200 100
setPen black 10 solidline flatcap roundjoin
drawPath p
-setPen red
+setPen red 0
drawPath p
translate 100 0
setPen black 10 solidline flatcap miterjoin
drawPath p
-setPen red
+setPen red 0
drawPath p
translate 100 0
setPen black 10 solidline flatcap beveljoin
drawPath p
-setPen red
+setPen red 0
drawPath p \ No newline at end of file
diff --git a/tests/auto/other/lancelot/scripts/lines.qps b/tests/auto/other/lancelot/scripts/lines.qps
index c0daffb1b0..274a7f31ec 100644
--- a/tests/auto/other/lancelot/scripts/lines.qps
+++ b/tests/auto/other/lancelot/scripts/lines.qps
@@ -1,7 +1,6 @@
# Version: 1
# CheckVsReference: 5% (0 0 310 425)
-
translate 10 10
begin_block draw_lines
@@ -260,132 +259,8 @@ save
repeat_block draw_lines
restore
-translate 320 0
-
-setPen black 0 solidline squarecap
-
-begin_block lines
-
-# 0 -> 45 degress
-drawLine 100 100 200 90
-drawLine 100 100 200 80
-drawLine 100 100 200 70
-drawLine 100 100 200 60
-drawLine 100 100 200 50
-drawLine 100 100 200 40
-drawLine 100 100 200 30
-drawLine 100 100 200 20
-drawLine 100 100 200 10
-
-# 45
-drawLine 100 100 200 0
-
-# 45 -> 90
-drawLine 100 100 190 0
-drawLine 100 100 180 0
-drawLine 100 100 170 0
-drawLine 100 100 160 0
-drawLine 100 100 150 0
-drawLine 100 100 140 0
-drawLine 100 100 130 0
-drawLine 100 100 120 0
-drawLine 100 100 110 0
-
-# 90
-drawLine 100 100 100 0
-
-# 90 -> 135
-drawLine 100 100 90 0
-drawLine 100 100 80 0
-drawLine 100 100 70 0
-drawLine 100 100 60 0
-drawLine 100 100 50 0
-drawLine 100 100 40 0
-drawLine 100 100 30 0
-drawLine 100 100 20 0
-drawLine 100 100 10 0
-
-# 135
-drawLine 100 100 0 0
-
-# 135 -> 180 degress
-drawLine 100 100 0 10
-drawLine 100 100 0 20
-drawLine 100 100 0 30
-drawLine 100 100 0 40
-drawLine 100 100 0 50
-drawLine 100 100 0 60
-drawLine 100 100 0 70
-drawLine 100 100 0 80
-drawLine 100 100 0 90
-
-# 180
-drawLine 100 100 0 100
-
-# 180 -> 225
-drawLine 100 100 0 110
-drawLine 100 100 0 120
-drawLine 100 100 0 130
-drawLine 100 100 0 140
-drawLine 100 100 0 150
-drawLine 100 100 0 160
-drawLine 100 100 0 170
-drawLine 100 100 0 180
-drawLine 100 100 0 190
-
-# 225
-drawLine 100 100 0 200
-
-# 225 -> 270
-drawLine 100 100 10 200
-drawLine 100 100 20 200
-drawLine 100 100 30 200
-drawLine 100 100 40 200
-drawLine 100 100 50 200
-drawLine 100 100 60 200
-drawLine 100 100 70 200
-drawLine 100 100 80 200
-drawLine 100 100 90 200
-
-# 270
-drawLine 100 100 100 200
-
-# 270 -> 315 degrees
-drawLine 100 100 110 200
-drawLine 100 100 120 200
-drawLine 100 100 130 200
-drawLine 100 100 140 200
-drawLine 100 100 150 200
-drawLine 100 100 160 200
-drawLine 100 100 170 200
-drawLine 100 100 180 200
-drawLine 100 100 190 200
-
-# 315
-drawLine 100 100 200 200
-
-# 315 -> 360 degress
-drawLine 100 100 200 100
-drawLine 100 100 200 110
-drawLine 100 100 200 120
-drawLine 100 100 200 130
-drawLine 100 100 200 140
-drawLine 100 100 200 150
-drawLine 100 100 200 160
-drawLine 100 100 200 170
-drawLine 100 100 200 180
-drawLine 100 100 200 190
-
-end_block
-
-
-setRenderHint Antialiasing
-setPen 0x7fff0000
-translate 0.5 0.5
-repeat_block lines
-
setPen 0x000000 8
-translate 20 240
+translate 350 240
drawText 0 0 "Steep slopes:"
translate 0 10
@@ -555,4 +430,4 @@ drawRect 0.5 0.5 64 64
setPen red 2 solidline flatcap
setClipRect 2 2 63 63
-drawLine 1.5 1.5 33560000 33560000 \ No newline at end of file
+drawLine 1.5 1.5 33560000 33560000
diff --git a/tests/auto/other/lancelot/scripts/lines3.qps b/tests/auto/other/lancelot/scripts/lines3.qps
new file mode 100644
index 0000000000..676235e652
--- /dev/null
+++ b/tests/auto/other/lancelot/scripts/lines3.qps
@@ -0,0 +1,171 @@
+
+clearRenderHint
+setPen black 0 solidline squarecap
+
+save
+translate 20 20
+
+begin_block lines
+
+# 0 -> 45 degress
+drawLine 100 100 200 90
+drawLine 100 100 200 80
+drawLine 100 100 200 70
+drawLine 100 100 200 60
+drawLine 100 100 200 50
+drawLine 100 100 200 40
+drawLine 100 100 200 30
+drawLine 100 100 200 20
+drawLine 100 100 200 10
+
+# 45
+drawLine 100 100 200 0
+
+# 45 -> 90
+drawLine 100 100 190 0
+drawLine 100 100 180 0
+drawLine 100 100 170 0
+drawLine 100 100 160 0
+drawLine 100 100 150 0
+drawLine 100 100 140 0
+drawLine 100 100 130 0
+drawLine 100 100 120 0
+drawLine 100 100 110 0
+
+# 90
+drawLine 100 100 100 0
+
+# 90 -> 135
+drawLine 100 100 90 0
+drawLine 100 100 80 0
+drawLine 100 100 70 0
+drawLine 100 100 60 0
+drawLine 100 100 50 0
+drawLine 100 100 40 0
+drawLine 100 100 30 0
+drawLine 100 100 20 0
+drawLine 100 100 10 0
+
+# 135
+drawLine 100 100 0 0
+
+# 135 -> 180 degress
+drawLine 100 100 0 10
+drawLine 100 100 0 20
+drawLine 100 100 0 30
+drawLine 100 100 0 40
+drawLine 100 100 0 50
+drawLine 100 100 0 60
+drawLine 100 100 0 70
+drawLine 100 100 0 80
+drawLine 100 100 0 90
+
+# 180
+drawLine 100 100 0 100
+
+# 180 -> 225
+drawLine 100 100 0 110
+drawLine 100 100 0 120
+drawLine 100 100 0 130
+drawLine 100 100 0 140
+drawLine 100 100 0 150
+drawLine 100 100 0 160
+drawLine 100 100 0 170
+drawLine 100 100 0 180
+drawLine 100 100 0 190
+
+# 225
+drawLine 100 100 0 200
+
+# 225 -> 270
+drawLine 100 100 10 200
+drawLine 100 100 20 200
+drawLine 100 100 30 200
+drawLine 100 100 40 200
+drawLine 100 100 50 200
+drawLine 100 100 60 200
+drawLine 100 100 70 200
+drawLine 100 100 80 200
+drawLine 100 100 90 200
+
+# 270
+drawLine 100 100 100 200
+
+# 270 -> 315 degrees
+drawLine 100 100 110 200
+drawLine 100 100 120 200
+drawLine 100 100 130 200
+drawLine 100 100 140 200
+drawLine 100 100 150 200
+drawLine 100 100 160 200
+drawLine 100 100 170 200
+drawLine 100 100 180 200
+drawLine 100 100 190 200
+
+# 315
+drawLine 100 100 200 200
+
+# 315 -> 360 degress
+drawLine 100 100 200 100
+drawLine 100 100 200 110
+drawLine 100 100 200 120
+drawLine 100 100 200 130
+drawLine 100 100 200 140
+drawLine 100 100 200 150
+drawLine 100 100 200 160
+drawLine 100 100 200 170
+drawLine 100 100 200 180
+drawLine 100 100 200 190
+
+end_block
+
+setRenderHint Antialiasing
+setPen 0x7fff0000 0 solidline squarecap
+repeat_block lines
+
+translate 250.5 0.5
+clearRenderHint
+setPen black 0 solidline squarecap
+repeat_block lines
+setRenderHint Antialiasing
+setPen 0x7fff0000 0 solidline squarecap
+repeat_block lines
+
+restore
+
+save
+
+translate 20 250
+clearRenderHint
+setPen black 1 solidline squarecap
+repeat_block lines
+setRenderHint Antialiasing
+setPen 0x7fff0000 1 solidline squarecap
+repeat_block lines
+
+translate 250.5 0.5
+clearRenderHint
+setPen black 1 soslidline squarecap
+repeat_block lines
+setRenderHint Antialiasing
+setPen 0x7fff0000 0 solidline squarecap
+repeat_block lines
+
+restore
+
+translate 20 500
+scale 1.5 1.5
+clearRenderHint
+setPen black 1 solidline squarecap
+repeat_block lines
+setRenderHint Antialiasing
+setPen 0x7fff0000 1 solidline squarecap
+repeat_block lines
+
+translate 250.5 0.5
+clearRenderHint
+setPen black 1 soslidline squarecap
+repeat_block lines
+setRenderHint Antialiasing
+setPen 0x7fff0000 0 solidline squarecap
+repeat_block lines
diff --git a/tests/auto/other/lancelot/scripts/paths.qps b/tests/auto/other/lancelot/scripts/paths.qps
index 555390de45..454b2a039d 100644
--- a/tests/auto/other/lancelot/scripts/paths.qps
+++ b/tests/auto/other/lancelot/scripts/paths.qps
@@ -1,8 +1,12 @@
# Version: 1
-setPen black
+setPen black 1
setBrush 7f7fff
+setFont "arial" 12
+drawText 10 330 "Non-Cosmetic"
+drawText 10 730 "Cosmetic"
+
path_moveTo star 50 0
path_lineTo star 30 90
path_lineTo star 100 60
@@ -29,6 +33,17 @@ translate -200 100
drawPath text
end_block
-translate 50 100
+begin_block xform
+save
+translate 50 60
rotate 10
+scale 1.0 0.7
+repeat_block drawing
+restore
+end_block xform
+
+setPen black 0
+setBrush ff7f7f
+translate 0 300
repeat_block drawing
+repeat_block xform
diff --git a/tests/auto/other/lancelot/scripts/pens_cosmetic.qps b/tests/auto/other/lancelot/scripts/pens_cosmetic.qps
index d1a60d150d..9120290462 100644
--- a/tests/auto/other/lancelot/scripts/pens_cosmetic.qps
+++ b/tests/auto/other/lancelot/scripts/pens_cosmetic.qps
@@ -6,6 +6,9 @@ path_addRect path 25 5 4 4
translate 20 20
+setPen black 0
+pen_setCosmetic false
+
begin_block lines
save
drawLine 0 0 10 10
@@ -58,6 +61,7 @@ drawText 580 15 "non-cosmetic, 0-width"
translate 0 50
setPen black 2
+pen_setCosmetic false
repeat_block lines
drawText 580 15 "non-cosmetic, 2-width"
@@ -80,12 +84,14 @@ translate 0 20
translate 0 50
setPen black 0
+pen_setCosmetic false
repeat_block lines
drawText 580 15 "non-cosmetic, 0-width"
translate 0 50
setPen black 2
+pen_setCosmetic false
repeat_block lines
drawText 580 15 "non-cosmetic, 2-width"
diff --git a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
index 58ddf531c5..7d0914b791 100644
--- a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
+++ b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
@@ -52,6 +52,8 @@
# include <AccessibleComponent.h>
# include <AccessibleEditableText.h>
# include <AccessibleText.h>
+# include <AccessibleTable2.h>
+# include <AccessibleTableCell.h>
# endif
#endif
#include <QtTest/QtTest>
@@ -1907,6 +1909,22 @@ void tst_QAccessibility::lineEditTest()
}
{
+ QLineEdit le(QStringLiteral("My characters have geometries."), toplevel);
+ // characterRect()
+ le.show();
+ QTest::qWaitForWindowShown(&le);
+ QAIPtr iface(QAccessible::queryAccessibleInterface(&le));
+ QAccessibleTextInterface* textIface = iface->textInterface();
+ QVERIFY(textIface);
+ const QRect lineEditRect = iface->rect();
+ // Only first 10 characters, check if they are within the bounds of line edit
+ for (int i = 0; i < 10; ++i) {
+ QVERIFY(lineEditRect.contains(textIface->characterRect(i)));
+ }
+ QTestAccessibility::clearEvents();
+ }
+
+ {
// Test events: cursor movement, selection, text changes
QString text = "Hello, world";
QLineEdit *lineEdit = new QLineEdit(text, toplevel);
@@ -2543,13 +2561,27 @@ void tst_QAccessibility::treeTest()
QVERIFY(!(cell2->state().expandable));
QCOMPARE(iface->indexOfChild(cell2), 10);
+ QPoint pos = treeView->mapToGlobal(QPoint(0,0));
+ QModelIndex index = treeView->model()->index(0, 0, treeView->model()->index(1, 0));
+ pos += treeView->visualRect(index).center();
+ pos += QPoint(0, treeView->header()->height());
+ QAIPtr childAt2(iface->childAt(pos.x(), pos.y()));
+ QVERIFY(childAt2);
+ QCOMPARE(childAt2->text(QAccessible::Name), QString("Klimt"));
+
QCOMPARE(table2->columnDescription(0), QString("Artist"));
QCOMPARE(table2->columnDescription(1), QString("Work"));
delete iface;
+ delete treeView;
QTestAccessibility::clearEvents();
}
+// The table used below is this:
+// Button (0) | h1 (1) | h2 (2) | h3 (3)
+// v1 (4) | 0.0 (5) | 1.0 (6) | 2.0 (7)
+// v2 (8) | 0.1 (9) | 1.1 (10) | 2.1 (11)
+// v3 (12) | 0.2 (13) | 1.2 (14) | 2.2 (15)
void tst_QAccessibility::tableTest()
{
QTableWidget *tableView = new QTableWidget(3, 3);
@@ -2570,44 +2602,52 @@ void tst_QAccessibility::tableTest()
tableView->resize(600,600);
tableView->show();
- QTest::qWait(1); // Need this for indexOfchild to work.
- QCoreApplication::processEvents();
- QTest::qWait(100);
+ QTest::qWaitForWindowExposed(tableView);
- QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(tableView);
- QCOMPARE(verifyHierarchy(iface), 0);
+ QAIPtr iface = QAIPtr(QAccessible::queryAccessibleInterface(tableView));
+ QCOMPARE(verifyHierarchy(iface.data()), 0);
- QCOMPARE((int)iface->role(), (int)QAccessible::Table);
+ QCOMPARE(iface->role(), QAccessible::Table);
// header and 2 rows (the others are not expanded, thus not visible)
QCOMPARE(iface->childCount(), 9+3+3+1); // cell+headers+topleft button
- QAccessibleInterface *cornerButton = iface->child(0);
+ QAIPtr cornerButton(iface->child(0));
QVERIFY(cornerButton);
- QCOMPARE(iface->indexOfChild(cornerButton), 0);
+ QCOMPARE(iface->indexOfChild(cornerButton.data()), 0);
QCOMPARE(cornerButton->role(), QAccessible::Pane);
- delete cornerButton;
- QAccessibleInterface *child1 = iface->child(2);
- QVERIFY(child1);
- QCOMPARE(iface->indexOfChild(child1), 2);
- QCOMPARE(child1->text(QAccessible::Name), QString("h2"));
- QCOMPARE(child1->role(), QAccessible::ColumnHeader);
- QVERIFY(!(child1->state().expanded));
- delete child1;
-
- QAccessibleInterface *child2 = iface->child(10);
- QVERIFY(child2);
- QCOMPARE(iface->indexOfChild(child2), 10);
- QCOMPARE(child2->text(QAccessible::Name), QString("1.1"));
- QAccessibleTableCellInterface *cell2Iface = child2->tableCellInterface();
- QCOMPARE(cell2Iface->rowIndex(), 1);
- QCOMPARE(cell2Iface->columnIndex(), 1);
- delete child2;
+ QAIPtr h2(iface->child(2));
+ QVERIFY(h2);
+ QCOMPARE(iface->indexOfChild(h2.data()), 2);
+ QCOMPARE(h2->text(QAccessible::Name), QString("h2"));
+ QCOMPARE(h2->role(), QAccessible::ColumnHeader);
+ QVERIFY(!(h2->state().expanded));
+
+ QAIPtr v3(iface->child(12));
+ QVERIFY(v3);
+ QCOMPARE(iface->indexOfChild(v3.data()), 12);
+ QCOMPARE(v3->text(QAccessible::Name), QString("v3"));
+ QCOMPARE(v3->role(), QAccessible::RowHeader);
+ QVERIFY(!(v3->state().expanded));
+
+
+ QAIPtr child10(iface->child(10));
+ QVERIFY(child10);
+ QCOMPARE(iface->indexOfChild(child10.data()), 10);
+ QCOMPARE(child10->text(QAccessible::Name), QString("1.1"));
+ QAccessibleTableCellInterface *cell10Iface = child10->tableCellInterface();
+ QCOMPARE(cell10Iface->rowIndex(), 1);
+ QCOMPARE(cell10Iface->columnIndex(), 1);
+ QPoint pos = tableView->mapToGlobal(QPoint(0,0));
+ pos += tableView->visualRect(tableView->model()->index(1, 1)).center();
+ pos += QPoint(tableView->verticalHeader()->width(), tableView->horizontalHeader()->height());
+ QAIPtr childAt10(iface->childAt(pos.x(), pos.y()));
+ QCOMPARE(childAt10->text(QAccessible::Name), QString("1.1"));
+
+ QAIPtr child11(iface->child(11));
+ QCOMPARE(iface->indexOfChild(child11.data()), 11);
+ QCOMPARE(child11->text(QAccessible::Name), QString("1.2"));
- QAccessibleInterface *child3 = iface->child(11);
- QCOMPARE(iface->indexOfChild(child3), 11);
- QCOMPARE(child3->text(QAccessible::Name), QString("1.2"));
- delete child3;
QTestAccessibility::clearEvents();
@@ -2621,23 +2661,21 @@ void tst_QAccessibility::tableTest()
QCOMPARE(cell1->text(QAccessible::Name), QString("0.0"));
QCOMPARE(iface->indexOfChild(cell1), 5);
- QAccessibleInterface *cell2;
- QVERIFY(cell2 = table2->cellAt(0,1));
+ QAIPtr cell2(table2->cellAt(0,1));
+ QVERIFY(cell2);
QCOMPARE(cell2->text(QAccessible::Name), QString("0.1"));
QCOMPARE(cell2->role(), QAccessible::Cell);
QCOMPARE(cell2->tableCellInterface()->rowIndex(), 0);
QCOMPARE(cell2->tableCellInterface()->columnIndex(), 1);
- QCOMPARE(iface->indexOfChild(cell2), 6);
- delete cell2;
+ QCOMPARE(iface->indexOfChild(cell2.data()), 6);
- QAccessibleInterface *cell3;
- QVERIFY(cell3 = table2->cellAt(1,2));
+ QAIPtr cell3(table2->cellAt(1,2));
+ QVERIFY(cell3);
QCOMPARE(cell3->text(QAccessible::Name), QString("1.2"));
QCOMPARE(cell3->role(), QAccessible::Cell);
QCOMPARE(cell3->tableCellInterface()->rowIndex(), 1);
QCOMPARE(cell3->tableCellInterface()->columnIndex(), 2);
- QCOMPARE(iface->indexOfChild(cell3), 11);
- delete cell3;
+ QCOMPARE(iface->indexOfChild(cell3.data()), 11);
QCOMPARE(table2->columnDescription(0), QString("h1"));
QCOMPARE(table2->columnDescription(1), QString("h2"));
@@ -2646,8 +2684,6 @@ void tst_QAccessibility::tableTest()
QCOMPARE(table2->rowDescription(1), QString("v2"));
QCOMPARE(table2->rowDescription(2), QString("v3"));
- delete iface;
-
delete tableView;
QTestAccessibility::clearEvents();
@@ -2999,8 +3035,29 @@ void tst_QAccessibility::bridgeTest()
QPushButton *button = new QPushButton(tr("Push me"), window);
QTextEdit *te = new QTextEdit(window);
te->setText(QLatin1String("hello world\nhow are you today?\n"));
+
+ // Add QTableWidget
+ QTableWidget *tableWidget = new QTableWidget(3, 3, window);
+ tableWidget->setColumnCount(3);
+ QStringList hHeader;
+ hHeader << "h1" << "h2" << "h3";
+ tableWidget->setHorizontalHeaderLabels(hHeader);
+
+ QStringList vHeader;
+ vHeader << "v1" << "v2" << "v3";
+ tableWidget->setVerticalHeaderLabels(vHeader);
+
+ for (int i = 0; i<9; ++i) {
+ QTableWidgetItem *item = new QTableWidgetItem;
+ item->setText(QString::number(i/3) + QString(".") + QString::number(i%3));
+ tableWidget->setItem(i/3, i%3, item);
+ }
+
+ tableWidget->setFixedSize(600, 600);
+
lay->addWidget(button);
lay->addWidget(te);
+ lay->addWidget(tableWidget);
window->show();
QVERIFY(QTest::qWaitForWindowExposed(window));
@@ -3096,7 +3153,7 @@ void tst_QAccessibility::bridgeTest()
long nChildren;
hr = iaccWindow->get_accChildCount(&nChildren);
QVERIFY(SUCCEEDED(hr));
- QCOMPARE(nChildren, (long)2);
+ QCOMPARE(nChildren, (long)3);
/**************************************************
* QTextEdit
@@ -3136,6 +3193,63 @@ void tst_QAccessibility::bridgeTest()
iaccTextEdit->Release();
+ /**************************************************
+ * QTableWidget
+ **************************************************/
+ {
+ // Get the second child (the accessible interface for the table widget)
+ varChild.vt = VT_I4;
+ varChild.lVal = 3;
+ QVERIFY(iaccWindow);
+ IAccessible *iaccTable = 0;
+ hr = iaccWindow->get_accChild(varChild, (IDispatch**)&iaccTable);
+ QVERIFY(SUCCEEDED(hr));
+ QVERIFY(iaccTable);
+ hr = iaccTable->get_accRole(varSELF, &varRole);
+ QVERIFY(SUCCEEDED(hr));
+
+ QCOMPARE(varRole.vt, (VARTYPE)VT_I4);
+ QCOMPARE(varRole.lVal, (LONG)ROLE_SYSTEM_TABLE);
+
+
+#ifdef QT_SUPPORTS_IACCESSIBLE2
+ IAccessibleTable2 *ia2Table = (IAccessibleTable2*)queryIA2(iaccTable, IID_IAccessibleTable2);
+ QVERIFY(ia2Table);
+ BSTR bstrDescription;
+ hr = ia2Table->get_columnDescription(0, &bstrDescription);
+ QVERIFY(SUCCEEDED(hr));
+ const QString description((QChar*)bstrDescription);
+ QCOMPARE(description, QLatin1String("h1"));
+
+ IAccessible *accTableCell = 0;
+ hr = ia2Table->get_cellAt(1, 2, (IUnknown**)&accTableCell);
+ IAccessibleTableCell *ia2TableCell = (IAccessibleTableCell *)queryIA2(accTableCell, IID_IAccessibleTableCell);
+ QVERIFY(SUCCEEDED(hr));
+ QVERIFY(ia2TableCell);
+ LONG index;
+ ia2TableCell->get_rowIndex(&index);
+ QCOMPARE(index, (LONG)1);
+ ia2TableCell->get_columnIndex(&index);
+ QCOMPARE(index, (LONG)2);
+
+ IAccessible *iaccTableCell = 0;
+ hr = ia2TableCell->QueryInterface(IID_IAccessible, (void**)&iaccTableCell);
+ QVERIFY(SUCCEEDED(hr));
+ QVERIFY(iaccTableCell);
+ BSTR bstrCellName;
+ hr = iaccTableCell->get_accName(varSELF, &bstrCellName);
+ QVERIFY(SUCCEEDED(hr));
+ QString cellName((QChar*)bstrCellName);
+ QCOMPARE(cellName, QLatin1String("1.2"));
+
+ accTableCell->Release();
+ iaccTableCell->Release();
+ ia2TableCell->Release();
+ ia2Table->Release();
+#endif
+ iaccTextEdit->Release();
+ }
+
iaccWindow->Release();
QTestAccessibility::clearEvents();
#endif
diff --git a/tests/auto/other/qaccessibilitylinux/qaccessibilitylinux.pro b/tests/auto/other/qaccessibilitylinux/qaccessibilitylinux.pro
index be6b537c0c..a6fb145604 100644
--- a/tests/auto/other/qaccessibilitylinux/qaccessibilitylinux.pro
+++ b/tests/auto/other/qaccessibilitylinux/qaccessibilitylinux.pro
@@ -1,7 +1,7 @@
CONFIG += testcase
# This is temporary to start running the test as part of normal CI.
-CONFIG += insignificant_test
+CONFIG += insignificant_test # QTBUG-27732
TARGET = tst_qaccessibilitylinux
diff --git a/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp b/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp
index 0f7c7f7a84..b01f311f4f 100644
--- a/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp
+++ b/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp
@@ -109,6 +109,8 @@ private slots:
void valuePreservation();
void errorReporting();
void testCustomPageSizes();
+ void customPaperSizeAndMargins_data();
+ void customPaperSizeAndMargins();
#if !defined(QT_NO_COMPLETER) && !defined(QT_NO_FILEDIALOG)
void printDialogCompleter();
#endif
@@ -933,6 +935,63 @@ void tst_QPrinter::testCustomPageSizes()
QCOMPARE(paperSize, customSize);
}
+void tst_QPrinter::customPaperSizeAndMargins_data()
+{
+ QTest::addColumn<bool>("pdf");
+ QTest::addColumn<bool>("before");
+ QTest::addColumn<qreal>("left");
+ QTest::addColumn<qreal>("top");
+ QTest::addColumn<qreal>("right");
+ QTest::addColumn<qreal>("bottom");
+
+ QTest::newRow("beforeNoPDF") << false << true << qreal(2) << qreal(2) << qreal(2) << qreal(2);
+ QTest::newRow("beforePDF") << true << true << qreal(2) << qreal(2) << qreal(2) << qreal(2);
+ QTest::newRow("afterNoPDF") << false << false << qreal(2) << qreal(2) << qreal(2) << qreal(2);
+ QTest::newRow("afterAfterPDF") << true << false << qreal(2) << qreal(2) << qreal(2) << qreal(2);
+}
+
+void tst_QPrinter::customPaperSizeAndMargins()
+{
+ QFETCH(bool, pdf);
+ QFETCH(bool, before);
+ QFETCH(qreal, left);
+ QFETCH(qreal, top);
+ QFETCH(qreal, right);
+ QFETCH(qreal, bottom);
+
+ qreal tolerance = 0.05;
+ qreal getLeft = 0;
+ qreal getRight = 0;
+ qreal getTop = 0;
+ qreal getBottom = 0;
+ QSizeF customSize(8.5, 11.0);
+
+ QPrinter p;
+ if (pdf)
+ p.setOutputFormat(QPrinter::PdfFormat);
+ if (before)
+ p.setPageMargins(left, top, right, bottom, QPrinter::Millimeter);
+ p.setPaperSize(customSize, QPrinter::Millimeter);
+ p.getPageMargins(&getLeft, &getTop, &getRight, &getBottom, QPrinter::Millimeter);
+ if (before) {
+ QVERIFY(fabs(left - getLeft) < tolerance);
+ QVERIFY(fabs(left - getTop) < tolerance);
+ QVERIFY(fabs(left - getRight) < tolerance);
+ QVERIFY(fabs(left - getBottom) < tolerance);
+ } else {
+ QVERIFY(getLeft == 0);
+ QVERIFY(getTop == 0);
+ QVERIFY(getRight == 0);
+ QVERIFY(getBottom == 0);
+ p.setPageMargins(left, top, right, bottom, QPrinter::Millimeter);
+ p.getPageMargins(&getLeft, &getTop, &getRight, &getBottom, QPrinter::Millimeter);
+ QVERIFY(fabs(left - getLeft) < tolerance);
+ QVERIFY(fabs(left - getTop) < tolerance);
+ QVERIFY(fabs(left - getRight) < tolerance);
+ QVERIFY(fabs(left - getBottom) < tolerance);
+ }
+}
+
#if !defined(QT_NO_COMPLETER) && !defined(QT_NO_FILEDIALOG)
void tst_QPrinter::printDialogCompleter()
{
diff --git a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp
index 32610fda18..8ce0742854 100644
--- a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp
+++ b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp
@@ -130,7 +130,9 @@ private slots:
void selectFilter();
void viewMode();
void proxymodel();
+ void setNameFilter_data();
void setNameFilter();
+ void setEmptyNameFilter();
void focus();
void caption();
void historyBack();
@@ -1003,13 +1005,56 @@ void tst_QFiledialog::proxymodel()
QCOMPARE(fd.proxyModel(), (QAbstractProxyModel*)0);
}
-void tst_QFiledialog::setNameFilter()
+void tst_QFiledialog::setEmptyNameFilter()
{
QNonNativeFileDialog fd;
fd.setNameFilter(QString());
fd.setNameFilters(QStringList());
}
+void tst_QFiledialog::setNameFilter_data()
+{
+ QTest::addColumn<bool>("nameFilterDetailsVisible");
+ QTest::addColumn<QStringList>("filters");
+ QTest::addColumn<QString>("selectFilter");
+ QTest::addColumn<QString>("expectedSelectedFilter");
+
+ QTest::newRow("namedetailsvisible-empty") << true << QStringList() << QString() << QString();
+ QTest::newRow("namedetailsinvisible-empty") << false << QStringList() << QString() << QString();
+
+ const QString anyFileNoDetails = QLatin1String("Any files");
+ const QString anyFile = anyFileNoDetails + QLatin1String(" (*)");
+ const QString imageFilesNoDetails = QLatin1String("Image files");
+ const QString imageFiles = imageFilesNoDetails + QLatin1String(" (*.png *.xpm *.jpg)");
+ const QString textFileNoDetails = QLatin1String("Text files");
+ const QString textFile = textFileNoDetails + QLatin1String(" (*.txt)");
+
+ QStringList filters;
+ filters << anyFile << imageFiles << textFile;
+
+ QTest::newRow("namedetailsvisible-images") << true << filters << imageFiles << imageFiles;
+ QTest::newRow("namedetailsinvisible-images") << false << filters << imageFiles << imageFilesNoDetails;
+
+ const QString invalid = "foo";
+ QTest::newRow("namedetailsvisible-invalid") << true << filters << invalid << anyFile;
+ // Potential crash when trying to convert the invalid filter into a list and stripping it, resulting in an empty list.
+ QTest::newRow("namedetailsinvisible-invalid") << false << filters << invalid << anyFileNoDetails;
+}
+
+void tst_QFiledialog::setNameFilter()
+{
+ QFETCH(bool, nameFilterDetailsVisible);
+ QFETCH(QStringList, filters);
+ QFETCH(QString, selectFilter);
+ QFETCH(QString, expectedSelectedFilter);
+
+ QNonNativeFileDialog fd;
+ fd.setNameFilters(filters);
+ fd.setNameFilterDetailsVisible(nameFilterDetailsVisible);
+ fd.selectNameFilter(selectFilter);
+ QCOMPARE(fd.selectedNameFilter(), expectedSelectedFilter);
+}
+
void tst_QFiledialog::focus()
{
QNonNativeFileDialog fd;
diff --git a/tests/auto/widgets/itemviews/qcolumnview/qcolumnview.pro b/tests/auto/widgets/itemviews/qcolumnview/qcolumnview.pro
index 7acbe016d5..4980b45389 100644
--- a/tests/auto/widgets/itemviews/qcolumnview/qcolumnview.pro
+++ b/tests/auto/widgets/itemviews/qcolumnview/qcolumnview.pro
@@ -3,6 +3,6 @@ CONFIG += parallel_test
QT += widgets widgets-private
QT += gui-private core-private testlib
-SOURCES += tst_qcolumnview.cpp
+SOURCES += tst_qcolumnview.cpp
TARGET = tst_qcolumnview
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/widgets/itemviews/qdatawidgetmapper/tst_qdatawidgetmapper.cpp b/tests/auto/widgets/itemviews/qdatawidgetmapper/tst_qdatawidgetmapper.cpp
index 85ee7144c9..6ef0988f31 100644
--- a/tests/auto/widgets/itemviews/qdatawidgetmapper/tst_qdatawidgetmapper.cpp
+++ b/tests/auto/widgets/itemviews/qdatawidgetmapper/tst_qdatawidgetmapper.cpp
@@ -362,8 +362,10 @@ void tst_QDataWidgetMapper::comboBox()
mapper.addMapping(&readWriteBox, 1, "currentText");
mapper.toFirst();
+ // setCurrentIndex caused the value at index 0 to be displayed
QCOMPARE(readOnlyBox.currentText(), QString("read only item 0"));
- QCOMPARE(readWriteBox.currentText(), QString("read write item 0"));
+ // setCurrentText set the value in the line edit since the combobox is editable
+ QCOMPARE(readWriteBox.currentText(), QString("item 0 1"));
// set some new values on the boxes
readOnlyBox.setCurrentIndex(1);
@@ -380,7 +382,6 @@ void tst_QDataWidgetMapper::comboBox()
model->setData(model->index(0, 1), QString("read write item z"), Qt::EditRole);
QCOMPARE(readOnlyBox.currentIndex(), 2);
- QEXPECT_FAIL("", "See task 125493 and QTBUG-428", Abort);
QCOMPARE(readWriteBox.currentText(), QString("read write item z"));
}
diff --git a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp
index 8458ca78fb..8b8f7e8949 100644
--- a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp
+++ b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp
@@ -115,7 +115,9 @@ private slots:
void scrollBarAsNeeded();
void moveItems();
void wordWrap();
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && WINVER >= 0x0500
void setCurrentIndexAfterAppendRowCrash();
+#endif
void emptyItemSize();
void task203585_selectAll();
void task228566_infiniteRelayout();
@@ -1510,15 +1512,14 @@ private:
};
#endif
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && WINVER >= 0x0500
+// This test only makes sense on windows 2000 and higher.
void tst_QListView::setCurrentIndexAfterAppendRowCrash()
{
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && WINVER >= 0x0500
SetCurrentIndexAfterAppendRowCrashDialog w;
w.exec();
-#else
- QSKIP("This test only makes sense on windows 2000 and higher.");
-#endif
}
+#endif
void tst_QListView::emptyItemSize()
{
diff --git a/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp b/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp
index 2bccb03845..80d77aa652 100644
--- a/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp
+++ b/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp
@@ -4065,9 +4065,9 @@ void tst_QTableView::taskQTBUG_8777_scrollToSpans()
}
void tst_QTableView::taskQTBUG_10169_sizeHintForRow()
-{
- QtTestTableView tableView;
- QStandardItemModel model(1, 3);
+{
+ QtTestTableView tableView;
+ QStandardItemModel model(1, 3);
model.setData(model.index(0, 0), "Word wrapping text goes here.");
tableView.setModel(&model);
tableView.verticalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
diff --git a/tests/auto/widgets/itemviews/qtablewidget/tst_qtablewidget.cpp b/tests/auto/widgets/itemviews/qtablewidget/tst_qtablewidget.cpp
index 2c93492fe9..e141ec294d 100644
--- a/tests/auto/widgets/itemviews/qtablewidget/tst_qtablewidget.cpp
+++ b/tests/auto/widgets/itemviews/qtablewidget/tst_qtablewidget.cpp
@@ -130,7 +130,7 @@ void tst_QTableWidget::getSetCheck()
// QCOMPARE(INT_MAX, obj1.rowCount());
obj1.setRowCount(100);
QCOMPARE(100, obj1.rowCount());
-
+
// int QTableWidget::columnCount()
// void QTableWidget::setColumnCount(int)
@@ -584,7 +584,7 @@ void tst_QTableWidget::selectedItems()
}
if (hidden)
continue;
-
+
for (int column = 0; column<testWidget->columnCount(); ++column) {
foreach (int hiddenColumn, hiddenColumns){
if(hiddenColumn == column){
@@ -594,7 +594,7 @@ void tst_QTableWidget::selectedItems()
}
if (hidden)
continue;
-
+
QTableWidgetItem *item = testWidget->item(row, column);
if (item && testWidget->isItemSelected(item))
QVERIFY(selectedItems.contains(item));
@@ -1321,7 +1321,7 @@ void tst_QTableWidget::setItemWithSorting()
QAbstractItemModel *model = w.model();
QList<QPersistentModelIndex> persistent;
-
+
int ti = 0;
for (int r = 0; r < rowCount; ++r) {
for (int c = 0; c < columnCount; ++c) {
@@ -1330,10 +1330,10 @@ void tst_QTableWidget::setItemWithSorting()
}
persistent << model->index(r, sortColumn);
}
-
+
w.sortItems(sortColumn, static_cast<Qt::SortOrder>(sortOrder));
w.setSortingEnabled(true);
-
+
QSignalSpy dataChangedSpy(model, SIGNAL(dataChanged(QModelIndex,QModelIndex)));
QSignalSpy layoutChangedSpy(model, SIGNAL(layoutChanged()));
@@ -1354,7 +1354,7 @@ void tst_QTableWidget::setItemWithSorting()
QCOMPARE(w.item(r, c)->text(), str);
}
}
-
+
for (int k = 0; k < persistent.count(); ++k) {
QCOMPARE(persistent.at(k).row(), expectedRows.at(k));
int i = (persistent.at(k).row() * columnCount) + sortColumn;
diff --git a/tests/auto/widgets/kernel/qactiongroup/tst_qactiongroup.cpp b/tests/auto/widgets/kernel/qactiongroup/tst_qactiongroup.cpp
index bd4e53e7ed..7d724514b9 100644
--- a/tests/auto/widgets/kernel/qactiongroup/tst_qactiongroup.cpp
+++ b/tests/auto/widgets/kernel/qactiongroup/tst_qactiongroup.cpp
@@ -171,14 +171,6 @@ void tst_QActionGroup::separators()
mw.show();
-#ifdef QT_SOFTKEYS_ENABLED
- // Softkeys add extra "Select" and "Back" actions to menu by default.
- // Two first actions will be Select and Back when softkeys are enabled
- int numSoftkeyActions = 2;
-#else
- int numSoftkeyActions = 0;
-#endif
-
QAction *action = new QAction(&actGroup);
action->setText("test one");
@@ -190,13 +182,13 @@ void tst_QActionGroup::separators()
while (it.hasNext())
menu.addAction(it.next());
- QCOMPARE((int)menu.actions().size(), 2 + numSoftkeyActions);
+ QCOMPARE((int)menu.actions().size(), 2);
it = QListIterator<QAction*>(actGroup.actions());
while (it.hasNext())
menu.removeAction(it.next());
- QCOMPARE((int)menu.actions().size(), 0 + numSoftkeyActions);
+ QCOMPARE((int)menu.actions().size(), 0);
action = new QAction(&actGroup);
action->setText("test two");
@@ -205,7 +197,7 @@ void tst_QActionGroup::separators()
while (it.hasNext())
menu.addAction(it.next());
- QCOMPARE((int)menu.actions().size(), 3 + numSoftkeyActions);
+ QCOMPARE((int)menu.actions().size(), 3);
}
void tst_QActionGroup::testActionInTwoQActionGroup()
diff --git a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp
index 29846d619a..d5ac0c20a8 100644
--- a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp
+++ b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp
@@ -1589,7 +1589,7 @@ class ChangeEventWidget : public QWidget
static bool recurse = false;
if (!recurse) {
recurse = true;
- QStyle *style = new QFusionStyle
+ QStyle *style = new QFusionStyle;
style->setParent(this);
setStyle(style);
recurse = false;
diff --git a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
index 11e9a9d82f..3b9f408e73 100644
--- a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
+++ b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
@@ -116,11 +116,15 @@ private slots:
void insertOnCurrentIndex();
void textpixmapdata_data();
void textpixmapdata();
+ void currentTextChanged_data();
+ void currentTextChanged();
void editTextChanged();
void setModel();
void modelDeleted();
void setMaxCount();
void setCurrentIndex();
+ void setCurrentText_data();
+ void setCurrentText();
void convenienceViews();
void findText_data();
void findText();
@@ -1355,6 +1359,110 @@ void tst_QComboBox::setCurrentIndex()
QCOMPARE(testWidget->currentText(), QString("foo"));
}
+void tst_QComboBox::setCurrentText_data()
+{
+ QTest::addColumn<bool>("editable");
+ QTest::newRow("editable") << true;
+ QTest::newRow("not editable") << false;
+}
+
+void tst_QComboBox::setCurrentText()
+{
+ QFETCH(bool, editable);
+
+ QCOMPARE(testWidget->count(), 0);
+ testWidget->addItems(QStringList() << "foo" << "bar");
+ QCOMPARE(testWidget->count(), 2);
+
+ testWidget->setEditable(editable);
+ testWidget->setCurrentIndex(0);
+ QCOMPARE(testWidget->currentIndex(), 0);
+
+ // effect on currentText and currentIndex
+ // currentIndex not changed if editable
+ QCOMPARE(testWidget->currentText(), QString("foo"));
+ testWidget->setCurrentText(QString("bar"));
+ QCOMPARE(testWidget->currentText(), QString("bar"));
+ if (editable)
+ QCOMPARE(testWidget->currentIndex(), 0);
+ else
+ QCOMPARE(testWidget->currentIndex(), 1);
+
+ testWidget->setCurrentText(QString("foo"));
+ QCOMPARE(testWidget->currentIndex(), 0);
+ QCOMPARE(testWidget->currentText(), QString("foo"));
+
+ // effect of text not found in list
+ testWidget->setCurrentText(QString("qt"));
+ QCOMPARE(testWidget->currentIndex(), 0);
+ if (editable)
+ QCOMPARE(testWidget->currentText(), QString("qt"));
+ else
+ QCOMPARE(testWidget->currentText(), QString("foo"));
+
+#ifndef QT_NO_PROPERTIES
+ // verify WRITE for currentText property
+ testWidget->setCurrentIndex(0);
+ const QByteArray n("currentText");
+ QCOMPARE(testWidget->property(n).toString(), QString("foo"));
+ testWidget->setProperty(n, QString("bar"));
+ QCOMPARE(testWidget->property(n).toString(), QString("bar"));
+#endif
+}
+
+void tst_QComboBox::currentTextChanged_data()
+{
+ QTest::addColumn<bool>("editable");
+ QTest::newRow("editable") << true;
+ QTest::newRow("not editable") << false;
+}
+
+void tst_QComboBox::currentTextChanged()
+{
+ QFETCH(bool, editable);
+
+ QCOMPARE(testWidget->count(), 0);
+ testWidget->addItems(QStringList() << "foo" << "bar");
+ QCOMPARE(testWidget->count(), 2);
+
+ QSignalSpy spy(testWidget, SIGNAL(currentTextChanged(QString)));
+
+ testWidget->setEditable(editable);
+
+ // set text in list
+ testWidget->setCurrentIndex(0);
+ QCOMPARE(testWidget->currentIndex(), 0);
+ spy.clear();
+ testWidget->setCurrentText(QString("bar"));
+ QCOMPARE(spy.count(), 1);
+ QCOMPARE(qvariant_cast<QString>(spy.at(0).at(0)), QString("bar"));
+
+ // set text not in list
+ testWidget->setCurrentIndex(0);
+ QCOMPARE(testWidget->currentIndex(), 0);
+ spy.clear();
+ testWidget->setCurrentText(QString("qt"));
+ if (editable) {
+ QCOMPARE(spy.count(), 1);
+ QCOMPARE(qvariant_cast<QString>(spy.at(0).at(0)), QString("qt"));
+ } else {
+ QCOMPARE(spy.count(), 0);
+ }
+
+ // item changed
+ testWidget->setCurrentIndex(0);
+ QCOMPARE(testWidget->currentIndex(), 0);
+ spy.clear();
+ testWidget->setItemText(0, QString("ape"));
+ QCOMPARE(spy.count(), 1);
+ QCOMPARE(qvariant_cast<QString>(spy.at(0).at(0)), QString("ape"));
+ // change it back
+ spy.clear();
+ testWidget->setItemText(0, QString("foo"));
+ QCOMPARE(spy.count(), 1);
+ QCOMPARE(qvariant_cast<QString>(spy.at(0).at(0)), QString("foo"));
+}
+
void tst_QComboBox::editTextChanged()
{
QCOMPARE(testWidget->count(), 0);
diff --git a/tests/auto/widgets/widgets/qdialogbuttonbox/tst_qdialogbuttonbox.cpp b/tests/auto/widgets/widgets/qdialogbuttonbox/tst_qdialogbuttonbox.cpp
index 8c8f5b5d71..74b30039f8 100644
--- a/tests/auto/widgets/widgets/qdialogbuttonbox/tst_qdialogbuttonbox.cpp
+++ b/tests/auto/widgets/widgets/qdialogbuttonbox/tst_qdialogbuttonbox.cpp
@@ -107,9 +107,6 @@ private slots:
void testSignalOrder();
void testDefaultButton_data();
void testDefaultButton();
-#ifdef QT_SOFTKEYS_ENABLED
- void testSoftKeyReparenting();
-#endif
void task191642_default();
private:
@@ -714,51 +711,6 @@ void tst_QDialogButtonBox::testDefaultButton_data()
QTest::newRow("third accept explicit after add") << 0 << 2 << 2;
}
-static int softKeyCount(QWidget *widget)
-{
- int softkeyCount = 0;
-#ifndef QT_NO_ACTION
- QList<QAction *> actions = widget->actions();
- foreach (QAction *action, actions) {
- if (action->softKeyRole() != QAction::NoSoftKey)
- softkeyCount++;
- }
-#endif
- return softkeyCount;
-}
-
-#ifdef QT_SOFTKEYS_ENABLED
-void tst_QDialogButtonBox::testSoftKeyReparenting()
-{
- QDialog dialog;
- QDialogButtonBox *buttonBox = new QDialogButtonBox;
- buttonBox->addButton(QDialogButtonBox::Ok);
- buttonBox->addButton(QDialogButtonBox::Cancel);
-
-#ifndef QT_NO_ACTION
- QCOMPARE(softKeyCount(&dialog), 0);
- QCOMPARE(softKeyCount(buttonBox), 2);
-#endif
-
- // Were the softkeys re-parented correctly?
- dialog.setLayout(new QVBoxLayout);
- dialog.layout()->addWidget(buttonBox);
-#ifndef QT_NO_ACTION
- QCOMPARE(softKeyCount(&dialog), 2);
- QCOMPARE(softKeyCount(buttonBox), 0);
-#endif
-
- // Softkeys are only added to QDialog, not QWidget
- QWidget *nested = new QWidget;
- nested->setLayout(new QVBoxLayout);
- nested->layout()->addWidget(buttonBox);
-#ifndef QT_NO_ACTION
- QCOMPARE(softKeyCount(nested), 0);
- QCOMPARE(softKeyCount(buttonBox), 2);
-#endif
-}
-#endif
-
void tst_QDialogButtonBox::testDefaultButton()
{
QFETCH(int, whenToSetDefault);
diff --git a/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp b/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp
index cf2d0de0e2..5f0a1e84b0 100644
--- a/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp
+++ b/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp
@@ -1322,26 +1322,18 @@ void tst_QMainWindow::createPopupMenu()
mainwindow.addDockWidget(Qt::LeftDockWidgetArea, &dockwidget4);
-#ifdef QT_SOFTKEYS_ENABLED
- // Softkeys add extra "Select" and "Back" actions to menu by default.
- // Two first actions will be Select and Back when softkeys are enabled
- int numSoftkeyActions = 2;
-#else
- int numSoftkeyActions = 0;
-#endif
-
QMenu *menu = mainwindow.createPopupMenu();
QVERIFY(menu != 0);
QList<QAction *> actions = menu->actions();
- QCOMPARE(actions.size(), 7 + numSoftkeyActions);
+ QCOMPARE(actions.size(), 7);
- QCOMPARE(actions.at(0 + numSoftkeyActions), dockwidget1.toggleViewAction());
- QCOMPARE(actions.at(1 + numSoftkeyActions), dockwidget2.toggleViewAction());
- QCOMPARE(actions.at(2 + numSoftkeyActions), dockwidget3.toggleViewAction());
- QCOMPARE(actions.at(3 + numSoftkeyActions), dockwidget4.toggleViewAction());
- QVERIFY(actions.at(4 + numSoftkeyActions)->isSeparator());
- QCOMPARE(actions.at(5 + numSoftkeyActions), toolbar1.toggleViewAction());
- QCOMPARE(actions.at(6 + numSoftkeyActions), toolbar2.toggleViewAction());
+ QCOMPARE(actions.at(0), dockwidget1.toggleViewAction());
+ QCOMPARE(actions.at(1), dockwidget2.toggleViewAction());
+ QCOMPARE(actions.at(2), dockwidget3.toggleViewAction());
+ QCOMPARE(actions.at(3), dockwidget4.toggleViewAction());
+ QVERIFY(actions.at(4)->isSeparator());
+ QCOMPARE(actions.at(5), toolbar1.toggleViewAction());
+ QCOMPARE(actions.at(6), toolbar2.toggleViewAction());
delete menu;
@@ -1352,12 +1344,12 @@ void tst_QMainWindow::createPopupMenu()
menu = mainwindow.createPopupMenu();
QVERIFY(menu != 0);
actions = menu->actions();
- QCOMPARE(actions.size(), 4 + numSoftkeyActions);
+ QCOMPARE(actions.size(), 4);
- QCOMPARE(actions.at(0 + numSoftkeyActions), dockwidget2.toggleViewAction());
- QCOMPARE(actions.at(1 + numSoftkeyActions), dockwidget3.toggleViewAction());
- QVERIFY(actions.at(2 + numSoftkeyActions)->isSeparator());
- QCOMPARE(actions.at(3 + numSoftkeyActions), toolbar2.toggleViewAction());
+ QCOMPARE(actions.at(0), dockwidget2.toggleViewAction());
+ QCOMPARE(actions.at(1), dockwidget3.toggleViewAction());
+ QVERIFY(actions.at(2)->isSeparator());
+ QCOMPARE(actions.at(3), toolbar2.toggleViewAction());
delete menu;
}
diff --git a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
index 4a53473903..28068a808d 100644
--- a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
+++ b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
@@ -243,17 +243,9 @@ void tst_QMenu::onStatusMessageChanged(const QString &s)
void tst_QMenu::addActionsAndClear()
{
-#ifdef QT_SOFTKEYS_ENABLED
- // Softkeys add extra "Select" and "Back" actions to menu by default.
- // Two first actions will be Select and Back when softkeys are enabled
- int numSoftkeyActions = 2;
-#else
- int numSoftkeyActions = 0;
-#endif
-
- QCOMPARE(menus[0]->actions().count(), 0 + numSoftkeyActions);
+ QCOMPARE(menus[0]->actions().count(), 0);
createActions();
- QCOMPARE(menus[0]->actions().count(), 8 + numSoftkeyActions);
+ QCOMPARE(menus[0]->actions().count(), 8);
menus[0]->clear();
QCOMPARE(menus[0]->actions().count(), 0);
}
@@ -730,11 +722,6 @@ void tst_QMenu::menuSizeHint()
int maxWidth =0;
QRect result;
foreach (QAction *action, menu.actions()) {
-#ifdef QT_SOFTKEYS_ENABLED
- // Softkey actions are not widgets and have no geometry.
- if (menu.actionGeometry(action).topLeft() == QPoint(0,0))
- continue;
-#endif
maxWidth = qMax(maxWidth, menu.actionGeometry(action).width());
result |= menu.actionGeometry(action);
QCOMPARE(result.x(), left + hmargin + panelWidth);
diff --git a/tests/benchmarks/corelib/corelib.pro b/tests/benchmarks/corelib/corelib.pro
index da5247cc42..b5781ad49e 100644
--- a/tests/benchmarks/corelib/corelib.pro
+++ b/tests/benchmarks/corelib/corelib.pro
@@ -2,6 +2,7 @@ TEMPLATE = subdirs
SUBDIRS = \
io \
json \
+ mimetypes \
kernel \
thread \
tools \
diff --git a/tests/benchmarks/corelib/mimetypes/mimetypes.pro b/tests/benchmarks/corelib/mimetypes/mimetypes.pro
new file mode 100644
index 0000000000..14dc5f0e10
--- /dev/null
+++ b/tests/benchmarks/corelib/mimetypes/mimetypes.pro
@@ -0,0 +1,3 @@
+TEMPLATE = subdirs
+SUBDIRS = \
+ qmimedatabase \
diff --git a/tests/benchmarks/corelib/mimetypes/qmimedatabase/main.cpp b/tests/benchmarks/corelib/mimetypes/qmimedatabase/main.cpp
new file mode 100644
index 0000000000..4a4d25d201
--- /dev/null
+++ b/tests/benchmarks/corelib/mimetypes/qmimedatabase/main.cpp
@@ -0,0 +1,87 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+
+class tst_QMimeDatabase: public QObject
+{
+
+ Q_OBJECT
+
+private slots:
+ void inheritsPerformance();
+};
+
+void tst_QMimeDatabase::inheritsPerformance()
+{
+ // Check performance of inherits().
+ // This benchmark (which started in 2009 in kmimetypetest.cpp) uses 40 mimetypes.
+ QStringList mimeTypes;
+ mimeTypes << QLatin1String("image/jpeg") << QLatin1String("image/png") << QLatin1String("image/tiff") << QLatin1String("text/plain") << QLatin1String("text/html");
+ mimeTypes += mimeTypes;
+ mimeTypes += mimeTypes;
+ mimeTypes += mimeTypes;
+ QCOMPARE(mimeTypes.count(), 40);
+ QMimeDatabase db;
+ QMimeType mime = db.mimeTypeForName(QString::fromLatin1("text/x-chdr"));
+ QVERIFY(mime.isValid());
+ QBENCHMARK {
+ QString match;
+ foreach (const QString &mt, mimeTypes) {
+ if (mime.inherits(mt)) {
+ match = mt;
+ // of course there would normally be a "break" here, but we're testing worse-case
+ // performance here
+ }
+ }
+ QCOMPARE(match, QString::fromLatin1("text/plain"));
+ }
+ // Numbers from 2011, in release mode:
+ // KDE 4.7 numbers: 0.21 msec / 494,000 ticks / 568,345 instr. loads per iteration
+ // QMimeBinaryProvider (with Qt 5): 0.16 msec / NA / 416,049 instr. reads per iteration
+ // QMimeXmlProvider (with Qt 5): 0.062 msec / NA / 172,889 instr. reads per iteration
+ // (but the startup time is way higher)
+ // And memory usage is flat at 200K with QMimeBinaryProvider, while it peaks at 6 MB when
+ // parsing XML, and then keeps being around 4.5 MB for all the in-memory hashes.
+}
+
+QTEST_MAIN(tst_QMimeDatabase)
+#include "main.moc"
diff --git a/tests/benchmarks/corelib/mimetypes/qmimedatabase/qmimedatabase.pro b/tests/benchmarks/corelib/mimetypes/qmimedatabase/qmimedatabase.pro
new file mode 100644
index 0000000000..0a0d9b1193
--- /dev/null
+++ b/tests/benchmarks/corelib/mimetypes/qmimedatabase/qmimedatabase.pro
@@ -0,0 +1,6 @@
+QT = core testlib
+
+TARGET = tst_bench_qmimedatabase
+SOURCES = main.cpp
+
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/benchmarks/corelib/tools/qmap/main.cpp b/tests/benchmarks/corelib/tools/qmap/main.cpp
index 05b52ba42f..c11e54ff1d 100644
--- a/tests/benchmarks/corelib/tools/qmap/main.cpp
+++ b/tests/benchmarks/corelib/tools/qmap/main.cpp
@@ -60,6 +60,10 @@ private slots:
void lookup_string_int();
void iteration();
+ void toStdMap();
+ void iterator_begin();
+
+ void ctorStdMap();
};
@@ -159,6 +163,46 @@ void tst_QMap::iteration()
}
}
+void tst_QMap::toStdMap()
+{
+ QMap<int, int> map;
+ for (int i = 0; i < 100000; ++i)
+ map.insert(i, i);
+
+ QBENCHMARK {
+ std::map<int, int> n = map.toStdMap();
+ n.begin();
+ }
+}
+
+void tst_QMap::iterator_begin()
+{
+ QMap<int, int> map;
+ for (int i = 0; i < 100000; ++i)
+ map.insert(i, i);
+
+ QBENCHMARK {
+ for (int i = 0; i < 100000; ++i) {
+ QMap<int, int>::const_iterator it = map.constBegin();
+ QMap<int, int>::const_iterator end = map.constEnd();
+ if (it == end) // same as if (false)
+ ++it;
+ }
+ }
+}
+
+void tst_QMap::ctorStdMap()
+{
+ std::map<int, int> map;
+ for (int i = 0; i < 100000; ++i)
+ map.insert(std::pair<int, int>(i, i));
+
+ QBENCHMARK {
+ QMap<int, int> qmap(map);
+ qmap.constBegin();
+ }
+}
+
QTEST_MAIN(tst_QMap)
diff --git a/tests/manual/cocoa/menus/main.cpp b/tests/manual/cocoa/menus/main.cpp
index 736ca134ff..760115ce25 100644
--- a/tests/manual/cocoa/menus/main.cpp
+++ b/tests/manual/cocoa/menus/main.cpp
@@ -39,9 +39,12 @@
**
****************************************************************************/
-#include <QtGui>
-#include <QtWidgets>
-
+#include <QMainWindow>
+#include <QMenu>
+#include <QApplication>
+#include <QMenuBar>
+#include <QMessageBox>
+#include <QDebug>
class Responder : public QObject
{
@@ -49,13 +52,34 @@ class Responder : public QObject
public:
Responder(QObject *pr) :
- QObject(pr)
+ QObject(pr), visibleMenu(0), visibleSubMenu(0), enabledMenu(0), enabledSubMenu(0), visibleAction(0), enabledAction(0)
{
}
-
+ void setVisibleObjects(QMenu *vm, QMenu *vsm, QAction *va)
+ {
+ visibleMenu = vm;
+ visibleSubMenu = vsm;
+ visibleAction = va;
+ }
+ void setEnabledObjects(QMenu *em, QMenu *esm, QAction *ea)
+ {
+ enabledMenu = em;
+ enabledSubMenu = esm;
+ enabledAction = ea;
+ }
public slots:
-
-
+ void toggleVisiblity()
+ {
+ visibleMenu->menuAction()->setVisible(!visibleMenu->menuAction()->isVisible());
+ visibleSubMenu->menuAction()->setVisible(!visibleSubMenu->menuAction()->isVisible());
+ visibleAction->setVisible(!visibleAction->isVisible());
+ }
+ void toggleEnabled()
+ {
+ enabledMenu->menuAction()->setEnabled(!enabledMenu->menuAction()->isEnabled());
+ enabledSubMenu->menuAction()->setEnabled(!enabledSubMenu->menuAction()->isEnabled());
+ enabledAction->setEnabled(!enabledAction->isEnabled());
+ }
void toggleChecked(bool b)
{
QAction *a = qobject_cast<QAction *>(sender());
@@ -82,6 +106,9 @@ public slots:
m->addAction(QString("Recent File %1").arg(i + 1));
}
}
+private:
+ QMenu *visibleMenu, *visibleSubMenu, *enabledMenu, *enabledSubMenu;
+ QAction *visibleAction, *enabledAction;
};
void createWindow1()
@@ -156,6 +183,39 @@ void createWindow1()
menu2->addAction(checkableAction);
+ QMenu *menu4 = new QMenu("Toggle menu", window);
+ QAction *toggleVisiblity = new QAction("Toggle visibility", window);
+ QAction *toggleEnabled = new QAction("Toggle enabled", window);
+ QObject::connect(toggleVisiblity, SIGNAL(triggered()), r, SLOT(toggleVisiblity()));
+ QObject::connect(toggleEnabled, SIGNAL(triggered()), r, SLOT(toggleEnabled()));
+ menu4->addAction(toggleVisiblity);
+ menu4->addAction(toggleEnabled);
+ window->menuBar()->addMenu(menu4);
+
+ QMenu *menu5 = new QMenu("Visible Menu", window);
+ menu5->addAction("Dummy action");
+ window->menuBar()->addMenu(menu5);
+ QMenu *menu6 = new QMenu("Menu with visible action and submenu", window);
+ QAction *visibleAction = new QAction("Visible action", window);
+ menu6->addAction(visibleAction);
+ QMenu *subMenu6 = new QMenu("Submenu");
+ subMenu6->addAction("Dummy action");
+ menu6->addMenu(subMenu6);
+ window->menuBar()->addMenu(menu6);
+
+ QMenu *menu7 = new QMenu("Enabled Menu", window);
+ menu7->addAction("Dummy action");
+ window->menuBar()->addMenu(menu7);
+ QMenu *menu8 = new QMenu("Menu with enabled action and submenu", window);
+ QAction *enabledAction = new QAction("Enabled action", window);
+ menu8->addAction(enabledAction);
+ QMenu *subMenu8 = new QMenu("Submenu");
+ subMenu8->addAction("Dummy action");
+ menu8->addMenu(subMenu8);
+ window->menuBar()->addMenu(menu8);
+
+ r->setVisibleObjects(menu5, subMenu6, visibleAction);
+ r->setEnabledObjects(menu7, subMenu8, enabledAction);
window->show();
}
diff --git a/tests/manual/dialogs/dialogs.pro b/tests/manual/dialogs/dialogs.pro
new file mode 100644
index 0000000000..ff916d3854
--- /dev/null
+++ b/tests/manual/dialogs/dialogs.pro
@@ -0,0 +1,8 @@
+QT += core gui
+greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
+
+TARGET = dialogs
+TEMPLATE = app
+
+SOURCES += main.cpp filedialogpanel.cpp
+HEADERS += filedialogpanel.h
diff --git a/tests/manual/dialogs/filedialogpanel.cpp b/tests/manual/dialogs/filedialogpanel.cpp
new file mode 100644
index 0000000000..4da3d6ee42
--- /dev/null
+++ b/tests/manual/dialogs/filedialogpanel.cpp
@@ -0,0 +1,373 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "filedialogpanel.h"
+
+#include <QGridLayout>
+#include <QVBoxLayout>
+#include <QHBoxLayout>
+#include <QFormLayout>
+#include <QSpacerItem>
+#include <QGroupBox>
+#include <QComboBox>
+#include <QPushButton>
+#include <QCheckBox>
+#include <QLineEdit>
+#include <QPlainTextEdit>
+#include <QLabel>
+#include <QMessageBox>
+#include <QApplication>
+
+#include <QTimer>
+#include <QDebug>
+
+struct ComboData
+{
+ const char *description;
+ int value;
+};
+
+const ComboData acceptModeComboData[] =
+{
+{"AcceptOpen", QFileDialog::AcceptOpen },
+{"AcceptSave", QFileDialog::AcceptSave }
+};
+
+const ComboData viewModeComboData[] =
+{
+ {"Detail", QFileDialog::Detail},
+ {"List", QFileDialog::List}
+};
+
+const ComboData fileModeComboData[] =
+{
+ {"AnyFile", QFileDialog::AnyFile},
+ {"ExistingFile", QFileDialog::ExistingFile},
+ {"ExistingFiles", QFileDialog::ExistingFiles},
+ {"Directory", QFileDialog::Directory},
+ {"DirectoryOnly", QFileDialog::DirectoryOnly}
+};
+
+static QComboBox *createCombo(QWidget *parent, const ComboData *d, size_t size)
+{
+ QComboBox *c = new QComboBox(parent);
+ for (size_t i = 0; i < size; ++i)
+ c->addItem(QLatin1String(d[i].description), QVariant(d[i].value));
+ return c;
+}
+
+template <class Enum>
+Enum comboBoxValue(const QComboBox *c)
+{
+ return static_cast<Enum>(c->itemData(c->currentIndex()).toInt());
+}
+
+inline void setComboBoxValue(QComboBox *c, int v)
+{
+ c->setCurrentIndex(c->findData(QVariant(v)));
+}
+
+static inline void addButton(const QString &desription, QBoxLayout *layout, QObject *receiver, const char *slotFunc)
+{
+ QPushButton *button = new QPushButton(desription);
+ QObject::connect(button, SIGNAL(clicked()), receiver, slotFunc);
+ layout->addWidget(button);
+}
+
+// A line edit for editing the label fields of the dialog, keeping track of whether it has
+// been modified by the user to avoid applying Qt's default texts to native dialogs.
+
+class LabelLineEdit : public QLineEdit
+{
+ Q_OBJECT
+public:
+ explicit LabelLineEdit(QFileDialog::DialogLabel label, QWidget *parent = 0) : QLineEdit(parent), m_label(label), m_dirty(false)
+ {
+ connect(this, SIGNAL(textEdited(QString)), this, SLOT(setDirty()));
+ }
+
+ void restoreDefault(const QFileDialog *d)
+ {
+ setText(d->labelText(m_label));
+ m_dirty = false;
+ }
+
+ void apply(QFileDialog *d) const
+ {
+ if (m_dirty)
+ d->setLabelText(m_label, text());
+ }
+
+private slots:
+ void setDirty() { m_dirty = true; }
+
+private:
+ const QFileDialog::DialogLabel m_label;
+ bool m_dirty;
+};
+
+FileDialogPanel::FileDialogPanel(QWidget *parent)
+ : QWidget(parent)
+ , m_readOnly(new QCheckBox(tr("Read only")))
+ , m_confirmOverWrite(new QCheckBox(tr("Confirm overwrite")))
+ , m_nameFilterDetailsVisible(new QCheckBox(tr("Name filter details visible")))
+ , m_resolveSymLinks(new QCheckBox(tr("Resolve symlinks")))
+ , m_native(new QCheckBox(tr("Use native dialog")))
+ , m_acceptMode(createCombo(this, acceptModeComboData, sizeof(acceptModeComboData)/sizeof(ComboData)))
+ , m_fileMode(createCombo(this, fileModeComboData, sizeof(fileModeComboData)/sizeof(ComboData)))
+ , m_viewMode(createCombo(this, viewModeComboData, sizeof(viewModeComboData)/sizeof(ComboData)))
+ , m_defaultSuffix(new QLineEdit(this))
+ , m_directory(new QLineEdit(this))
+ , m_selectedFileName(new QLineEdit(this))
+ , m_nameFilters(new QPlainTextEdit)
+ , m_selectedNameFilter(new QLineEdit(this))
+{
+ // Options
+ QGroupBox *optionsGroupBox = new QGroupBox(tr("Options"));
+ QFormLayout *optionsLayout = new QFormLayout(optionsGroupBox);
+ optionsLayout->addRow(tr("AcceptMode:"), m_acceptMode);
+ optionsLayout->addRow(tr("FileMode:"), m_fileMode);
+ optionsLayout->addRow(tr("ViewMode:"), m_viewMode);
+ optionsLayout->addRow(m_native);
+ optionsLayout->addRow(m_confirmOverWrite);
+ optionsLayout->addRow(m_nameFilterDetailsVisible);
+ optionsLayout->addRow(m_resolveSymLinks);
+ optionsLayout->addRow(m_readOnly);
+
+ // Files
+ QGroupBox *filesGroupBox = new QGroupBox(tr("Files / Filters"));
+ QFormLayout *filesLayout = new QFormLayout(filesGroupBox);
+ filesLayout->addRow(tr("Default Suffix:"), m_defaultSuffix);
+ filesLayout->addRow(tr("Directory:"), m_directory);
+ filesLayout->addRow(tr("Selected file:"), m_selectedFileName);
+ m_nameFilters->setMaximumHeight(80);
+ filesLayout->addRow(tr("Name filters:"), m_nameFilters);
+ filesLayout->addRow(tr("Selected name filter:"), m_selectedNameFilter);
+
+ // Optional labels
+ QGroupBox *labelsGroupBox = new QGroupBox(tr("Labels"));
+ QFormLayout *labelsLayout = new QFormLayout(labelsGroupBox);
+ m_labelLineEdits.push_back(new LabelLineEdit(QFileDialog::LookIn, this));
+ labelsLayout->addRow(tr("Look in label:"), m_labelLineEdits.back());
+ m_labelLineEdits.push_back(new LabelLineEdit(QFileDialog::FileName, this));
+ labelsLayout->addRow(tr("File name label:"), m_labelLineEdits.back());
+ m_labelLineEdits.push_back(new LabelLineEdit(QFileDialog::FileType, this));
+ labelsLayout->addRow(tr("File type label:"), m_labelLineEdits.back());
+ m_labelLineEdits.push_back(new LabelLineEdit(QFileDialog::Accept, this));
+ labelsLayout->addRow(tr("Accept label:"), m_labelLineEdits.back());
+ m_labelLineEdits.push_back(new LabelLineEdit(QFileDialog::Reject, this));
+ labelsLayout->addRow(tr("Reject label:"), m_labelLineEdits.back());
+
+ // Buttons
+ QVBoxLayout *buttonLayout = new QVBoxLayout;
+ buttonLayout->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Ignored, QSizePolicy::MinimumExpanding));
+ addButton(tr("Show modal"), buttonLayout, this, SLOT(showModal()));
+ addButton(tr("Show non-modal"), buttonLayout, this, SLOT(showNonModal()));
+ addButton(tr("getOpenFileName"), buttonLayout, this, SLOT(getOpenFileName()));
+ addButton(tr("getOpenFileNames"), buttonLayout, this, SLOT(getOpenFileNames()));
+ addButton(tr("getSaveFileName"), buttonLayout, this, SLOT(getSaveFileName()));
+ addButton(tr("getExistingDirectory"), buttonLayout, this, SLOT(getExistingDirectory()));
+ addButton(tr("Restore defaults"), buttonLayout, this, SLOT(restoreDefaults()));
+ QGroupBox *buttonsGroupBox = new QGroupBox(tr("Show"));
+ QHBoxLayout *buttonsGroupLayout = new QHBoxLayout(buttonsGroupBox);
+ buttonsGroupLayout->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::MinimumExpanding, QSizePolicy::Ignored));
+ buttonsGroupLayout->addLayout(buttonLayout);
+
+ // Main layout
+ QGridLayout *gridLayout = new QGridLayout(this);
+ gridLayout->addWidget(optionsGroupBox, 0, 0);
+ gridLayout->addWidget(filesGroupBox, 0, 1);
+ gridLayout->addWidget(labelsGroupBox, 1, 0);
+ gridLayout->addWidget(buttonsGroupBox, 1, 1);
+
+ restoreDefaults();
+}
+
+void FileDialogPanel::showModal()
+{
+ QFileDialog dialog(this);
+ applySettings(&dialog);
+ dialog.setWindowTitle(tr("Modal File Dialog Qt %1").arg(QLatin1String(QT_VERSION_STR)));
+ dialog.exec();
+}
+
+void FileDialogPanel::showNonModal()
+{
+ QFileDialog *dialog = new QFileDialog(this);
+ dialog->setAttribute(Qt::WA_DeleteOnClose);
+ applySettings(dialog);
+ dialog->setWindowTitle(tr("Non-Modal File Dialog Qt %1").arg(QLatin1String(QT_VERSION_STR)));
+ dialog->show();
+}
+
+QString FileDialogPanel::filterString() const
+{
+ return m_nameFilters->toPlainText().trimmed().replace(QLatin1String("\n"), QLatin1String(";;"));
+}
+
+QFileDialog::Options FileDialogPanel::options() const
+{
+ QFileDialog::Options result;
+ if (!m_nameFilterDetailsVisible->isChecked())
+ result |= QFileDialog::HideNameFilterDetails;
+ if (!m_resolveSymLinks->isChecked())
+ result |= QFileDialog::DontResolveSymlinks;
+ if (m_readOnly->isChecked())
+ result |= QFileDialog::ReadOnly;
+ if (!m_confirmOverWrite->isChecked())
+ result |= QFileDialog::DontConfirmOverwrite;
+ if (!m_native->isChecked())
+ result |= QFileDialog::DontUseNativeDialog;
+ return result;
+}
+
+void FileDialogPanel::getOpenFileNames()
+{
+ QString selectedFilter = m_selectedNameFilter->text().trimmed();
+ const QStringList files =
+ QFileDialog::getOpenFileNames(this, tr("getOpenFileNames Qt %1").arg(QLatin1String(QT_VERSION_STR)),
+ m_directory->text(), filterString(), &selectedFilter, options());
+ if (!files.isEmpty()) {
+ QString result;
+ QDebug(&result).nospace()
+ << "Files: " << files
+ << "\nName filter: " << selectedFilter;
+ QMessageBox::information(this, tr("getOpenFileNames"), result, QMessageBox::Ok);
+ }
+}
+
+void FileDialogPanel::getOpenFileName()
+{
+ QString selectedFilter = m_selectedNameFilter->text().trimmed();
+ const QString file =
+ QFileDialog::getOpenFileName(this, tr("getOpenFileName Qt %1").arg(QLatin1String(QT_VERSION_STR)),
+ m_directory->text(), filterString(), &selectedFilter, options());
+ if (!file.isEmpty()) {
+ QString result;
+ QDebug(&result).nospace()
+ << "File: " << file
+ << "\nName filter: " << selectedFilter;
+ QMessageBox::information(this, tr("getOpenFileName"), result, QMessageBox::Ok);
+ }
+}
+
+void FileDialogPanel::getSaveFileName()
+{
+ QString selectedFilter = m_selectedNameFilter->text().trimmed();
+ const QString file =
+ QFileDialog::getSaveFileName(this, tr("getSaveFileName Qt %1").arg(QLatin1String(QT_VERSION_STR)),
+ m_directory->text(), filterString(), &selectedFilter, options());
+ if (!file.isEmpty()) {
+ QString result;
+ QDebug(&result).nospace()
+ << "File: " << file
+ << "\nName filter: " << selectedFilter;
+ QMessageBox::information(this, tr("getSaveFileNames"), result, QMessageBox::Ok);
+ }
+}
+
+void FileDialogPanel::getExistingDirectory()
+{
+ const QString dir =
+ QFileDialog::getExistingDirectory(this, tr("getExistingDirectory Qt %1").arg(QLatin1String(QT_VERSION_STR)),
+ m_directory->text(), options() | QFileDialog::ShowDirsOnly);
+ if (!dir.isEmpty())
+ QMessageBox::information(this, tr("getExistingDirectory"), QLatin1String("Directory: ") + dir, QMessageBox::Ok);
+}
+
+void FileDialogPanel::restoreDefaults()
+{
+ QFileDialog d;
+ setComboBoxValue(m_acceptMode, d.acceptMode());
+ setComboBoxValue(m_fileMode, d.fileMode());
+ setComboBoxValue(m_viewMode, d.viewMode());
+ m_confirmOverWrite->setChecked(d.confirmOverwrite());
+ m_nameFilterDetailsVisible->setChecked(d.isNameFilterDetailsVisible());
+ m_resolveSymLinks->setChecked(d.resolveSymlinks());
+ m_readOnly->setChecked(d.isReadOnly());
+ m_native->setChecked(true);
+ m_directory->setText(QDir::homePath());
+ m_defaultSuffix->setText(QLatin1String(".txt"));
+ m_nameFilters->setPlainText(QLatin1String("Any files (*)\nImage files (*.png *.xpm *.jpg)\nText files (*.txt)"));
+ m_selectedFileName->setText(QString());
+ m_selectedNameFilter->setText(QString());
+ foreach (LabelLineEdit *l, m_labelLineEdits)
+ l->restoreDefault(&d);
+}
+
+void FileDialogPanel::applySettings(QFileDialog *d) const
+{
+ d->setAcceptMode(comboBoxValue<QFileDialog::AcceptMode>(m_acceptMode));
+ d->setViewMode(comboBoxValue<QFileDialog::ViewMode>(m_viewMode));
+ d->setFileMode(comboBoxValue<QFileDialog::FileMode>(m_fileMode));
+ d->setOptions(options());
+ d->setDefaultSuffix(m_defaultSuffix->text().trimmed());
+ d->setDirectory(m_directory->text().trimmed());
+ const QString file = m_selectedFileName->text().trimmed();
+ if (!file.isEmpty())
+ d->selectFile(file);
+ d->setNameFilters(m_nameFilters->toPlainText().trimmed().split(QLatin1Char('\n'), QString::SkipEmptyParts));
+ const QString filter = m_selectedNameFilter->text().trimmed();
+ if (!filter.isEmpty())
+ d->selectNameFilter(filter);
+ foreach (LabelLineEdit *l, m_labelLineEdits)
+ l->apply(d);
+ connect(d, SIGNAL(accepted()), this, SLOT(accepted()));
+}
+
+void FileDialogPanel::accepted()
+{
+ const QFileDialog *d = qobject_cast<const QFileDialog *>(sender());
+ Q_ASSERT(d);
+ m_result.clear();
+ QDebug(&m_result).nospace()
+ << "Files: " << d->selectedFiles()
+ << "\nDirectory: " << d->directory().absolutePath()
+ << "\nName filter: " << d->selectedNameFilter();
+ QTimer::singleShot(0, this, SLOT(showAcceptedResult())); // Avoid problems with the closing (modal) dialog as parent.
+}
+
+void FileDialogPanel::showAcceptedResult()
+{
+ QMessageBox::information(this, tr("File Dialog Accepted"), m_result, QMessageBox::Ok);
+}
+
+#include "filedialogpanel.moc"
diff --git a/src/widgets/kernel/qsoftkeymanager_p.h b/tests/manual/dialogs/filedialogpanel.h
index a80088d33c..bc8b66535b 100644
--- a/src/widgets/kernel/qsoftkeymanager_p.h
+++ b/tests/manual/dialogs/filedialogpanel.h
@@ -3,7 +3,7 @@
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -39,74 +39,55 @@
**
****************************************************************************/
-#ifndef QSOFTKEYMANAGER_P_H
-#define QSOFTKEYMANAGER_P_H
+#ifndef FILEDIALOGPANEL_H
+#define FILEDIALOGPANEL_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 <QGroupBox>
+#include <QFileDialog>
-#include <QtCore/qobject.h>
-#include "QtWidgets/qaction.h"
+class QCheckBox;
+class QComboBox;
+class QLineEdit;
+class QPlainTextEdit;
+class LabelLineEdit;
-QT_BEGIN_HEADER
-
-#ifndef QT_NO_SOFTKEYMANAGER
-QT_BEGIN_NAMESPACE
-
-class QSoftKeyManagerPrivate;
-
-class Q_AUTOTEST_EXPORT QSoftKeyManager : public QObject
+class FileDialogPanel : public QWidget
{
Q_OBJECT
- Q_DECLARE_PRIVATE(QSoftKeyManager)
-
public:
-
- enum StandardSoftKey {
- OkSoftKey,
- SelectSoftKey,
- DoneSoftKey,
- MenuSoftKey,
- CancelSoftKey
- };
-
- static void updateSoftKeys();
-
- static QAction *createAction(StandardSoftKey standardKey, QWidget *actionWidget);
- static QAction *createKeyedAction(StandardSoftKey standardKey, Qt::Key key, QWidget *actionWidget);
- static QString standardSoftKeyText(StandardSoftKey standardKey);
- static void setForceEnabledInSoftkeys(QAction *action);
- static bool isForceEnabledInSofkeys(QAction *action);
-
-protected:
- bool event(QEvent *e);
-
-private:
- QSoftKeyManager();
- static QSoftKeyManager *instance();
- bool appendSoftkeys(const QWidget &source, int level);
- QWidget *softkeySource(QWidget *previousSource, bool& recursiveMerging);
- bool handleUpdateSoftKeys();
-
-private Q_SLOTS:
- void cleanupHash(QObject* obj);
- void sendKeyEvent();
+ explicit FileDialogPanel(QWidget *parent = 0);
+
+public slots:
+ void showModal();
+ void showNonModal();
+ void getOpenFileNames();
+ void getOpenFileName();
+ void getSaveFileName();
+ void getExistingDirectory();
+ void accepted();
+ void showAcceptedResult();
+ void restoreDefaults();
private:
- Q_DISABLE_COPY(QSoftKeyManager)
+ QString filterString() const;
+ QFileDialog::Options options() const;
+ void applySettings(QFileDialog *d) const;
+
+ QCheckBox *m_readOnly;
+ QCheckBox *m_confirmOverWrite;
+ QCheckBox *m_nameFilterDetailsVisible;
+ QCheckBox *m_resolveSymLinks;
+ QCheckBox *m_native;
+ QComboBox *m_acceptMode;
+ QComboBox *m_fileMode;
+ QComboBox *m_viewMode;
+ QLineEdit *m_defaultSuffix;
+ QLineEdit *m_directory;
+ QLineEdit *m_selectedFileName;
+ QList<LabelLineEdit *> m_labelLineEdits;
+ QPlainTextEdit *m_nameFilters;
+ QLineEdit *m_selectedNameFilter;
+ QString m_result;
};
-QT_END_NAMESPACE
-#endif //QT_NO_SOFTKEYMANAGER
-
-QT_END_HEADER
-
-#endif //QSOFTKEYMANAGER_P_H
+#endif // FILEDIALOGPANEL_H
diff --git a/src/widgets/kernel/qsoftkeymanager_common_p.h b/tests/manual/dialogs/main.cpp
index 27e1b869ae..ab6c623990 100644
--- a/src/widgets/kernel/qsoftkeymanager_common_p.h
+++ b/tests/manual/dialogs/main.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -39,47 +39,45 @@
**
****************************************************************************/
-#ifndef QSOFTKEYMANAGER_COMMON_P_H
-#define QSOFTKEYMANAGER_COMMON_P_H
+#include "filedialogpanel.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 <QMainWindow>
+#include <QApplication>
+#include <QMenuBar>
+#include <QTabWidget>
+#include <QMenu>
+#include <QAction>
+#include <QKeySequence>
-#include <private/qobject_p.h>
-
-QT_BEGIN_HEADER
-
-#ifndef QT_NO_SOFTKEYMANAGER
-
-QT_BEGIN_NAMESPACE
-
-class QSoftKeyManagerPrivate : public QObjectPrivate
-{
- Q_DECLARE_PUBLIC(QSoftKeyManager)
+// Test for dialogs, allowing to play with all dialog options for implementing native dialogs.
+// Currently, only QFileDialog is implemented.
+// Compiles with Qt 4.8 and Qt 5.
+class MainWindow : public QMainWindow {
+ Q_OBJECT
public:
- virtual void updateSoftKeys_sys() {}
-
-protected:
- static QSoftKeyManager *self;
- QHash<QAction*, Qt::Key> keyedActions;
- QMultiHash<int, QAction*> requestedSoftKeyActions;
- QWidget *initialSoftKeySource;
- bool pendingUpdate;
+ explicit MainWindow(QWidget *parent = 0);
};
-QT_END_NAMESPACE
-
-#endif //QT_NO_SOFTKEYMANAGER
+MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
+{
+ setWindowTitle(tr("Dialogs Qt %1").arg(QLatin1String(QT_VERSION_STR)));
+ QMenu *fileMenu = menuBar()->addMenu(tr("File"));
+ QAction *quitAction = fileMenu->addAction(tr("Quit"));
+ quitAction->setShortcut(QKeySequence(QKeySequence::Quit));
+ connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
+ QTabWidget *tabWidget = new QTabWidget;
+ tabWidget->addTab(new FileDialogPanel, tr("QFileDialog"));
+ setCentralWidget(tabWidget);
+}
-QT_END_HEADER
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+ MainWindow w;
+ w.move(500, 200);
+ w.show();
+ return a.exec();
+}
-#endif // QSOFTKEYMANAGER_COMMON_P_H
+#include "main.moc"
diff --git a/tests/manual/manual.pro b/tests/manual/manual.pro
index 04bdff6abc..cfa812aaba 100644
--- a/tests/manual/manual.pro
+++ b/tests/manual/manual.pro
@@ -32,7 +32,8 @@ widgets/itemviews/delegate \
windowflags \
windowgeometry \
windowmodality \
-widgetgrab
+widgetgrab \
+dialogs
!contains(QT_CONFIG, openssl):!contains(QT_CONFIG, openssl-linked):SUBDIRS -= qssloptions
diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp
index e085b87f35..6280e27f4a 100644
--- a/tools/configure/configureapp.cpp
+++ b/tools/configure/configureapp.cpp
@@ -236,6 +236,7 @@ Configure::Configure(int& argc, char** argv)
dictionary[ "QT_CUPS" ] = "auto";
dictionary[ "CFG_GCC_SYSROOT" ] = "yes";
dictionary[ "SLOG2" ] = "no";
+ dictionary[ "SYSTEM_PROXIES" ] = "no";
//Only used when cross compiling.
dictionary[ "QT_INSTALL_SETTINGS" ] = "/etc/xdg";
@@ -877,6 +878,10 @@ void Configure::parseCmdLine()
dictionary[ "SLOG2" ] = "no";
} else if (configCmdLine.at(i) == "-slog2") {
dictionary[ "SLOG2" ] = "yes";
+ } else if (configCmdLine.at(i) == "-no-system-proxies") {
+ dictionary[ "SYSTEM_PROXIES" ] = "no";
+ } else if (configCmdLine.at(i) == "-system-proxies") {
+ dictionary[ "SYSTEM_PROXIES" ] = "yes";
}
// Work around compiler nesting limitation
@@ -1682,6 +1687,10 @@ bool Configure::displayHelp()
desc("QT_INSTALL_SETTINGS", "auto", "-sysconfdir <dir>", "Settings used by Qt programs will be looked for in\n<dir>.\n");
+ desc("SYSTEM_PROXIES", "yes", "-system-proxies", "Use system network proxies by default.");
+ desc("SYSTEM_PROXIES", "no", "-no-system-proxies", "Do not use system network proxies by default.\n");
+
+
#if !defined(EVAL)
desc( "-qtnamespace <name>", "Wraps all Qt library code in 'namespace name {...}'.");
desc( "-qtlibinfix <infix>", "Renames all Qt* libs to Qt*<infix>.\n");
@@ -2303,6 +2312,25 @@ void Configure::generateBuildKey()
build_defines.sort();
}
+void Configure::generateSystemVars()
+{
+ // Generate an empty .qmake.cache file for config.tests
+ QDir buildDir(buildPath);
+ bool success = true;
+ if (!buildDir.exists("config.tests"))
+ success = buildDir.mkdir("config.tests");
+
+ QString fileName(buildPath + "/config.tests/.qmake.cache");
+ QFile cacheFile(fileName);
+ success &= cacheFile.open(QIODevice::WriteOnly);
+ cacheFile.close();
+
+ if (!success) {
+ cout << "Failed to create file " << qPrintable(QDir::toNativeSeparators(fileName)) << endl;
+ dictionary[ "DONE" ] = "error";
+ }
+}
+
void Configure::generateOutputVars()
{
// Generate variables for output
@@ -2560,6 +2588,9 @@ void Configure::generateOutputVars()
if (dictionary[ "V8SNAPSHOT" ] == "yes")
qtConfig += "v8snapshot";
+ if (dictionary[ "SYSTEM_PROXIES" ] == "yes")
+ qtConfig += "system-proxies";
+
// Add config levels --------------------------------------------
QStringList possible_configs = QStringList()
<< "minimal"
@@ -2680,7 +2711,6 @@ void Configure::generateCachefile()
for (QStringList::Iterator var = qmakeVars.begin(); var != qmakeVars.end(); ++var) {
cacheStream << (*var) << endl;
}
- cacheStream << "CONFIG += " << qmakeConfig.join(' ') << "no_private_qt_headers_warning QTDIR_build" << endl;
cacheStream.flush();
cacheFile.close();
@@ -2720,7 +2750,8 @@ void Configure::generateCachefile()
if (!dictionary["DECORATIONS"].isEmpty())
moduleStream << "decorations += "<<dictionary["DECORATIONS"]<<endl;
- moduleStream << "CONFIG += create_prl link_prl prepare_docs";
+ moduleStream << "CONFIG += " << qmakeConfig.join(' ')
+ << " create_prl link_prl prepare_docs no_private_qt_headers_warning QTDIR_build";
if (dictionary[ "SSE2" ] == "yes")
moduleStream << " sse2";
if (dictionary[ "SSE3" ] == "yes")
@@ -3043,37 +3074,6 @@ QString Configure::addDefine(QString def)
}
#if !defined(EVAL)
-bool Configure::copySpec(const char *name, const char *pfx, const QString &spec)
-{
- // "Link" configured mkspec to default directory, but remove the old one first, if there is any
- QString defSpec = buildPath + "/mkspecs/" + name;
- QFileInfo defSpecInfo(defSpec);
- if (defSpecInfo.exists()) {
- if (!Environment::rmdir(defSpec)) {
- cout << "Couldn't update default " << pfx << "mkspec! Are files in " << qPrintable(defSpec) << " read-only?" << endl;
- dictionary["DONE"] = "error";
- return false;
- }
- }
-
- QDir::current().mkpath(defSpec);
- QFile qfile(defSpec + "/qmake.conf");
- if (qfile.open(QFile::WriteOnly | QFile::Text)) {
- QTextStream fileStream;
- fileStream.setDevice(&qfile);
- QString srcSpec = buildPath + "/mkspecs/" + spec; // We copied it to the build dir
- fileStream << "QMAKESPEC_ORIGINAL = " << formatPath(srcSpec) << endl;
- fileStream << "include($$QMAKESPEC_ORIGINAL/qmake.conf)" << endl;
- qfile.close();
- }
- if (qfile.error() != QFile::NoError) {
- cout << "Couldn't update default " << pfx << "mkspec: " << qPrintable(qfile.errorString()) << endl;
- dictionary["DONE"] = "error";
- return false;
- }
- return true;
-}
-
void Configure::generateConfigfiles()
{
QDir(buildPath).mkpath("src/corelib/global");
@@ -3328,7 +3328,8 @@ void Configure::displayConfig()
sout << "QtDBus support.............." << dictionary[ "DBUS" ] << endl;
sout << "QtWidgets module support...." << dictionary[ "WIDGETS" ] << endl;
sout << "QML debugging..............." << dictionary[ "QML_DEBUG" ] << endl;
- sout << "DirectWrite support........." << dictionary[ "DIRECTWRITE" ] << endl << endl;
+ sout << "DirectWrite support........." << dictionary[ "DIRECTWRITE" ] << endl;
+ sout << "Use system proxies.........." << dictionary[ "SYSTEM_PROXIES" ] << endl << endl;
sout << "Third Party Libraries:" << endl;
sout << " ZLIB support............" << dictionary[ "ZLIB" ] << endl;
@@ -3478,6 +3479,11 @@ void Configure::generateHeaders()
}
}
+static QString stripPrefix(const QString &str, const QString &pfx)
+{
+ return str.startsWith(pfx) ? str.mid(pfx.length()) : str;
+}
+
void Configure::generateQConfigCpp()
{
// if QT_INSTALL_* have not been specified on commandline, define them now from QT_INSTALL_PREFIX
@@ -3521,6 +3527,10 @@ void Configure::generateQConfigCpp()
QDir(buildPath).mkpath("src/corelib/global");
const QString outName(buildPath + "/src/corelib/global/qconfig.cpp");
+ QString specPfx = dictionary["QT_HOST_DATA"] + "/mkspecs/";
+ QString hostSpec = stripPrefix(dictionary["QMAKESPEC"], specPfx);
+ QString targSpec = dictionary.contains("XQMAKESPEC") ? stripPrefix(dictionary["XQMAKESPEC"], specPfx) : hostSpec;
+
QTemporaryFile tmpFile;
if (tmpFile.open()) {
QTextStream tmpStream(&tmpFile);
@@ -3548,6 +3558,8 @@ void Configure::generateQConfigCpp()
<< " \"qt_hpfxpath=" << formatPath(dictionary["QT_HOST_PREFIX"]) << "\"," << endl
<< " \"qt_hbinpath=" << formatPath(dictionary["QT_HOST_BINS"]) << "\"," << endl
<< " \"qt_hdatpath=" << formatPath(dictionary["QT_HOST_DATA"]) << "\"," << endl
+ << " \"qt_targspec=" << targSpec << "\"," << endl
+ << " \"qt_hostspec=" << hostSpec << "\"," << endl
<< "#endif" << endl
<< "};" << endl;
@@ -3660,14 +3672,6 @@ void Configure::buildQmake()
confFile.close();
}
- //create default mkspecs
- QString spec = dictionary.contains("XQMAKESPEC") ? dictionary["XQMAKESPEC"] : dictionary["QMAKESPEC"];
- if (!copySpec("default", "", spec)
- || !copySpec("default-host", "host ", dictionary["QMAKESPEC"])) {
- cout << "Error installing default mkspecs" << endl << endl;
- exit(EXIT_FAILURE);
- }
-
}
#endif
diff --git a/tools/configure/configureapp.h b/tools/configure/configureapp.h
index 8cae9da4f8..bfec520c39 100644
--- a/tools/configure/configureapp.h
+++ b/tools/configure/configureapp.h
@@ -79,10 +79,10 @@ public:
void generateMakefiles();
void appendMakeItem(int inList, const QString &item);
#if !defined(EVAL)
- bool copySpec(const char *name, const char *pfx, const QString &spec);
void generateConfigfiles();
void detectArch();
void generateQConfigPri();
+ void generateSystemVars();
#endif
void showSummary();
void findProjects( const QString& dirName );
diff --git a/tools/configure/main.cpp b/tools/configure/main.cpp
index 53013c969d..e917137837 100644
--- a/tools/configure/main.cpp
+++ b/tools/configure/main.cpp
@@ -78,6 +78,10 @@ int runConfigure( int argc, char** argv )
if (!app.isOk())
return 3;
+ app.generateSystemVars();
+ if (!app.isOk())
+ return 3;
+
// Auto-detect modules and settings.
app.autoDetection();
diff --git a/util/accessibilityinspector/accessibilityinspector.pri b/util/accessibilityinspector/accessibilityinspector.pri
index be0a09ccf6..30519a9718 100644
--- a/util/accessibilityinspector/accessibilityinspector.pri
+++ b/util/accessibilityinspector/accessibilityinspector.pri
@@ -2,7 +2,7 @@ QT += declarative
INCLUDEPATH += $$PWD
# DEFINES += ACCESSIBILITYINSPECTOR_NO_UITOOLS
-# CONFIG += uitools
+# QT += uitools
HEADERS += \
$$PWD/screenreader.h \