aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2017-01-23 12:36:29 +0100
committerLaszlo Agocs <laszlo.agocs@qt.io>2017-01-23 12:36:29 +0100
commit03fe99ba3a7d29b1606660baa407cff21c4d4d35 (patch)
tree525d5f03e8703bf7e9a7851280de67a597dceea1
parentf02e234fc012f4430378bc5205f32914822e4dff (diff)
parent94e6106d357ca5a1349a2b10a69dd84db34065c8 (diff)
Merge remote-tracking branch 'origin/dev' into wip/scenegraphng
-rw-r--r--dist/changes-5.8.0172
-rw-r--r--examples/qml/doc/src/qml-extending.qdoc30
-rw-r--r--examples/qml/referenceexamples/extended/main.cpp4
-rw-r--r--examples/qml/referenceexamples/methods/example.qml4
-rw-r--r--examples/quick/demos/calqlatr/calqlatr.qml5
-rw-r--r--examples/quick/demos/samegame/content/qmldir1
-rw-r--r--examples/quick/demos/samegame/samegame.qrc2
-rw-r--r--examples/quick/localstorage/doc/src/localstorage.qdoc2
-rw-r--r--examples/quick/localstorage/localstorage/qml-localstorage-example.pngbin46168 -> 0 bytes
-rw-r--r--examples/quick/scenegraph/graph/graph.cpp2
-rw-r--r--src/3rdparty/masm/assembler/MacroAssemblerCodeRef.h2
-rw-r--r--src/3rdparty/masm/stubs/ExecutableAllocator.h13
-rw-r--r--src/3rdparty/masm/wtf/Compiler.h5
-rw-r--r--src/3rdparty/masm/wtf/OSAllocatorWinRT.cpp11
-rw-r--r--src/3rdparty/masm/wtf/Platform.h16
-rw-r--r--src/imports/layouts/qquicklayout.cpp29
-rw-r--r--src/imports/layouts/qquicklayout_p.h2
-rw-r--r--src/imports/layouts/qquicklayoutstyleinfo.cpp2
-rw-r--r--src/imports/layouts/qquicklinearlayout.cpp36
-rw-r--r--src/imports/layouts/qquicklinearlayout_p.h2
-rw-r--r--src/imports/localstorage/plugin.cpp22
-rw-r--r--src/imports/statemachine/signaltransition.cpp2
-rw-r--r--src/imports/statemachine/state.cpp2
-rw-r--r--src/imports/statemachine/statemachine.cpp2
-rw-r--r--src/imports/statemachine/timeouttransition.cpp2
-rw-r--r--src/imports/testlib/TestCase.qml11
-rw-r--r--src/imports/xmllistmodel/qqmlxmllistmodel.cpp8
-rw-r--r--src/imports/xmllistmodel/qqmlxmllistmodel_p.h4
-rw-r--r--src/particles/qquickcustomparticle.cpp9
-rw-r--r--src/particles/qquickgravity.cpp41
-rw-r--r--src/particles/qquickgravity_p.h42
-rw-r--r--src/particles/qquickimageparticle.cpp31
-rw-r--r--src/particles/qquickmaskextruder.cpp2
-rw-r--r--src/particles/qquickspritegoal_p.h2
-rw-r--r--src/particles/shaders/imageparticle.vert6
-rw-r--r--src/particles/shaders/imageparticle_core.vert6
-rw-r--r--src/plugins/scenegraph/d3d12/qsgd3d12threadedrenderloop.cpp5
-rw-r--r--src/plugins/scenegraph/openvg/qsgopenvgrenderloop.cpp12
-rw-r--r--src/qml/compiler/qv4compilationunitmapper_win.cpp8
-rw-r--r--src/qml/compiler/qv4compileddata.cpp5
-rw-r--r--src/qml/compiler/qv4isel_moth.cpp5
-rw-r--r--src/qml/compiler/qv4ssa.cpp2
-rw-r--r--src/qml/debugger/qqmlprofiler_p.h59
-rw-r--r--src/qml/doc/src/examples.qdoc36
-rw-r--r--src/qml/doc/src/qmllanguageref/documents/networktransparency.qdoc8
-rw-r--r--src/qml/jit/qv4assembler.cpp182
-rw-r--r--src/qml/jit/qv4assembler_p.h4
-rw-r--r--src/qml/jit/qv4binop.cpp86
-rw-r--r--src/qml/jit/qv4binop_p.h98
-rw-r--r--src/qml/jit/qv4isel_masm.cpp171
-rw-r--r--src/qml/jit/qv4regalloc.cpp4
-rw-r--r--src/qml/jsapi/qjsvalue.cpp3
-rw-r--r--src/qml/jsruntime/qv4engine.cpp2
-rw-r--r--src/qml/jsruntime/qv4global_p.h8
-rw-r--r--src/qml/jsruntime/qv4profiling_p.h5
-rw-r--r--src/qml/jsruntime/qv4regexpobject.cpp3
-rw-r--r--src/qml/jsruntime/qv4runtime.cpp1
-rw-r--r--src/qml/jsruntime/qv4script.cpp2
-rw-r--r--src/qml/jsruntime/qv4string.cpp12
-rw-r--r--src/qml/jsruntime/qv4string_p.h6
-rw-r--r--src/qml/memory/qv4mm.cpp25
-rw-r--r--src/qml/memory/qv4mm_p.h24
-rw-r--r--src/qml/qml.pro2
-rw-r--r--src/qml/qml/qqmlabstractbinding.cpp2
-rw-r--r--src/qml/qml/qqmlabstracturlinterceptor.h1
-rw-r--r--src/qml/qml/qqmlapplicationengine.cpp15
-rw-r--r--src/qml/qml/qqmlbinding.cpp2
-rw-r--r--src/qml/qml/qqmlboundsignal.cpp9
-rw-r--r--src/qml/qml/qqmlcomponent.cpp15
-rw-r--r--src/qml/qml/qqmlcustomparser.cpp2
-rw-r--r--src/qml/qml/qqmlengine.cpp31
-rw-r--r--src/qml/qml/qqmlerror.cpp72
-rw-r--r--src/qml/qml/qqmlerror.h3
-rw-r--r--src/qml/qml/qqmlextensionplugin.cpp10
-rw-r--r--src/qml/qml/qqmlinfo.cpp127
-rw-r--r--src/qml/qml/qqmlinfo.h16
-rw-r--r--src/qml/qml/qqmllist.cpp5
-rw-r--r--src/qml/qml/qqmlloggingcategory.cpp4
-rw-r--r--src/qml/qml/qqmlobjectcreator.cpp13
-rw-r--r--src/qml/qml/qqmlplatform.cpp4
-rw-r--r--src/qml/qml/qqmltypeloader.cpp2
-rw-r--r--src/qml/types/qqmlbind.cpp4
-rw-r--r--src/qml/types/qqmlconnections.cpp6
-rw-r--r--src/qml/types/qqmldelegatemodel.cpp68
-rw-r--r--src/qml/types/qqmllistmodel.cpp50
-rw-r--r--src/qml/types/qqmlobjectmodel.cpp6
-rw-r--r--src/qmltest/quicktest.cpp3
-rw-r--r--src/quick/doc/images/qml-localstorage-example.pngbin14409 -> 13957 bytes
-rw-r--r--src/quick/doc/images/touchpoint-metrics.pngbin0 -> 38894 bytes
-rw-r--r--src/quick/doc/snippets/qml/listview/listview.qml15
-rw-r--r--src/quick/doc/snippets/qml/localstorage/dbtransaction.js30
-rwxr-xr-xsrc/quick/items/checksync.pl106
-rw-r--r--src/quick/items/context2d/qquickcanvasitem.cpp17
-rw-r--r--src/quick/items/qquickanchors.cpp34
-rw-r--r--src/quick/items/qquickanimatedimage.cpp2
-rw-r--r--src/quick/items/qquickanimatedsprite.cpp2
-rw-r--r--src/quick/items/qquickborderimage.cpp2
-rw-r--r--src/quick/items/qquickdrag.cpp12
-rw-r--r--src/quick/items/qquickevents.cpp3
-rw-r--r--src/quick/items/qquickevents_p_p.h18
-rw-r--r--src/quick/items/qquickflickable.cpp80
-rw-r--r--src/quick/items/qquickflickable_p.h12
-rw-r--r--src/quick/items/qquickflickable_p_p.h3
-rw-r--r--src/quick/items/qquickflickablebehavior_p.h12
-rw-r--r--src/quick/items/qquickflipable.cpp4
-rw-r--r--src/quick/items/qquickgridview.cpp121
-rw-r--r--src/quick/items/qquickgridview_p.h12
-rw-r--r--src/quick/items/qquickimagebase.cpp2
-rw-r--r--src/quick/items/qquickitem.cpp10
-rw-r--r--src/quick/items/qquickitemanimation.cpp14
-rw-r--r--src/quick/items/qquickitemgrabresult.cpp15
-rw-r--r--src/quick/items/qquickitemsmodule.cpp20
-rw-r--r--src/quick/items/qquickitemview.cpp73
-rw-r--r--src/quick/items/qquickitemview_p.h22
-rw-r--r--src/quick/items/qquickitemview_p_p.h12
-rw-r--r--src/quick/items/qquickitemviewtransition.cpp2
-rw-r--r--src/quick/items/qquicklistview.cpp214
-rw-r--r--src/quick/items/qquicklistview_p.h14
-rw-r--r--src/quick/items/qquickloader.cpp2
-rw-r--r--src/quick/items/qquickmousearea.cpp4
-rw-r--r--src/quick/items/qquickmultipointtoucharea.cpp73
-rw-r--r--src/quick/items/qquickmultipointtoucharea_p.h19
-rw-r--r--src/quick/items/qquickpathview.cpp23
-rw-r--r--src/quick/items/qquickpathview_p.h14
-rw-r--r--src/quick/items/qquickpathview_p_p.h2
-rw-r--r--src/quick/items/qquickpositioners.cpp101
-rw-r--r--src/quick/items/qquickpositioners_p.h3
-rw-r--r--src/quick/items/qquickrendercontrol.cpp5
-rw-r--r--src/quick/items/qquickrepeater.cpp2
-rw-r--r--src/quick/items/qquickspriteengine.cpp10
-rw-r--r--src/quick/items/qquickspritesequence.cpp2
-rw-r--r--src/quick/items/qquickstateoperations.cpp8
-rw-r--r--src/quick/items/qquicktext.cpp16
-rw-r--r--src/quick/items/qquicktext_p.h3
-rw-r--r--src/quick/items/qquicktextdocument.cpp2
-rw-r--r--src/quick/items/qquicktextedit.cpp4
-rw-r--r--src/quick/items/qquicktextinput.cpp17
-rw-r--r--src/quick/items/qquicktextinput_p.h1
-rw-r--r--src/quick/items/qquicktextutil.cpp4
-rw-r--r--src/quick/items/qquickview.cpp2
-rw-r--r--src/quick/items/qquickview.h16
-rw-r--r--src/quick/items/qquickview_p.h2
-rw-r--r--src/quick/items/qquickwindow.cpp5
-rw-r--r--src/quick/items/qquickwindowmodule.cpp3
-rw-r--r--src/quick/quick.pro2
-rw-r--r--src/quick/scenegraph/adaptations/software/qsgsoftwarethreadedrenderloop.cpp5
-rw-r--r--src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp24
-rw-r--r--src/quick/scenegraph/coreapi/qsggeometry.cpp1
-rw-r--r--src/quick/scenegraph/qsgadaptationlayer_p.h2
-rw-r--r--src/quick/scenegraph/qsgthreadedrenderloop.cpp10
-rw-r--r--src/quick/util/qquickanimation.cpp18
-rw-r--r--src/quick/util/qquickanimationcontroller.cpp2
-rw-r--r--src/quick/util/qquickanimator.cpp1
-rw-r--r--src/quick/util/qquickbehavior.cpp2
-rw-r--r--src/quick/util/qquickfontloader.cpp2
-rw-r--r--src/quick/util/qquickpath.cpp14
-rw-r--r--src/quick/util/qquickpath_p.h1
-rw-r--r--src/quick/util/qquickpropertychanges.cpp4
-rw-r--r--src/quick/util/qquickstatechangescript.cpp2
-rw-r--r--src/quick/util/qquickstategroup.cpp2
-rw-r--r--src/quick/util/qquickvaluetypes.cpp3
-rw-r--r--tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp28
-rw-r--r--tests/auto/qml/debugger/qqmlinspector/data/qtquick2.qml5
-rw-r--r--tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp53
-rw-r--r--tests/auto/qml/debugger/shared/qqmlenginedebugclient.cpp4
-rw-r--r--tests/auto/qml/debugger/shared/qqmlenginedebugclient.h2
-rw-r--r--tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp58
-rw-r--r--tests/auto/qml/qqmlapplicationengine/data/LocalComponent.qml6
-rw-r--r--tests/auto/qml/qqmlapplicationengine/data/nonResolvedLocal.qml9
-rw-r--r--tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.cpp24
-rw-r--r--tests/auto/qml/qqmlecmascript/data/signalParameterTypes.qml2
-rw-r--r--tests/auto/qml/qqmlecmascript/testtypes.h1
-rw-r--r--tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp65
-rw-r--r--tests/auto/qml/qqmlinfo/tst_qqmlinfo.cpp58
-rw-r--r--tests/auto/qml/qqmllocale/data/date.qml1
-rw-r--r--tests/auto/qml/qqmllocale/tst_qqmllocale.cpp60
-rw-r--r--tests/auto/qml/qqmlsqldatabase/tst_qqmlsqldatabase.cpp42
-rw-r--r--tests/auto/qmltest/layout/Container.qml (renamed from examples/quick/demos/samegame/content/BBSettings.qml)32
-rw-r--r--tests/auto/qmltest/layout/ContainerUser.qml (renamed from examples/quick/demos/samegame/content/+blackberry/Settings.qml)20
-rw-r--r--tests/auto/qmltest/layout/tst_layout.qml78
-rw-r--r--tests/auto/qmltest/positioners/tst_positioners.qml75
-rw-r--r--tests/auto/qmltest/selftests/tst_createTemporaryObject.qml66
-rw-r--r--tests/auto/quick/examples/tst_examples.cpp6
-rw-r--r--tests/auto/quick/qquickanimations/data/pathLineUnspecifiedXYBug.qml28
-rw-r--r--tests/auto/quick/qquickanimations/data/pathSvgAnimation.qml25
-rw-r--r--tests/auto/quick/qquickanimations/tst_qquickanimations.cpp44
-rw-r--r--tests/auto/quick/qquickflickable/data/overshoot.qml79
-rw-r--r--tests/auto/quick/qquickflickable/data/overshoot_reentrant.qml55
-rw-r--r--tests/auto/quick/qquickflickable/tst_qquickflickable.cpp196
-rw-r--r--tests/auto/quick/qquickgraphicsinfo/tst_qquickgraphicsinfo.cpp2
-rw-r--r--tests/auto/quick/qquickgridview/data/keyNavigationEnabled.qml12
-rw-r--r--tests/auto/quick/qquickgridview/tst_qquickgridview.cpp2
-rw-r--r--tests/auto/quick/qquickimage/tst_qquickimage.cpp16
-rw-r--r--tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp4
-rw-r--r--tests/auto/quick/qquicklayouts/data/tst_rowlayout.qml21
-rw-r--r--tests/auto/quick/qquicklistview/data/flickBothDirections.qml70
-rw-r--r--tests/auto/quick/qquicklistview/data/keyNavigationEnabled.qml14
-rw-r--r--tests/auto/quick/qquicklistview/tst_qquicklistview.cpp81
-rw-r--r--tests/auto/quick/qquickpathview/data/removePath.qml26
-rw-r--r--tests/auto/quick/qquickpathview/tst_qquickpathview.cpp14
-rw-r--r--tests/auto/quick/qquicktext/tst_qquicktext.cpp5
-rw-r--r--tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp52
-rw-r--r--tests/auto/quick/qquickwindow/data/grabContentItemToImage.qml15
-rw-r--r--tests/auto/quick/qquickwindow/qquickwindow.pro3
-rw-r--r--tests/auto/quick/qquickwindow/tst_qquickwindow.cpp19
-rw-r--r--tests/auto/quick/qquickxmllistmodel/qquickxmllistmodel.pro4
-rw-r--r--tests/auto/quick/touchmouse/tst_touchmouse.cpp585
-rw-r--r--tests/manual/text/SignalIndicator.qml66
-rw-r--r--tests/manual/text/main.cpp51
-rw-r--r--tests/manual/text/main.qml56
-rw-r--r--tests/manual/text/qml.qrc7
-rw-r--r--tests/manual/text/text.pro7
-rw-r--r--tests/manual/text/textInputPropertiesAndSignals.qml134
-rw-r--r--tests/manual/touch/mpta-crosshairs.qml85
-rw-r--r--tests/manual/v4/tests.pro2
-rw-r--r--tests/testapplications/textlayout/styledtext-layout.qml2
-rw-r--r--tools/qml/main.cpp30
-rw-r--r--tools/qmlimportscanner/main.cpp36
-rw-r--r--tools/qmlplugindump/main.cpp20
-rw-r--r--tools/qmltime/qmltime.cpp2
220 files changed, 3910 insertions, 1756 deletions
diff --git a/dist/changes-5.8.0 b/dist/changes-5.8.0
new file mode 100644
index 0000000000..2fa4173c2e
--- /dev/null
+++ b/dist/changes-5.8.0
@@ -0,0 +1,172 @@
+Qt 5.8 introduces many new features and improvements as well as bugfixes
+over the 5.7.x series. For more details, refer to the online documentation
+included in this distribution. The documentation is also available online:
+
+ http://doc.qt.io/qt-5/index.html
+
+The Qt version 5.8 series is binary compatible with the 5.7.x series.
+Applications compiled for 5.7 will continue to run with 5.8.
+
+Some of the changes listed in this file include issue tracking numbers
+corresponding to tasks in the Qt Bug Tracker:
+
+ https://bugreports.qt.io/
+
+Each of these identifiers can be entered in the bug tracker to obtain more
+information about a particular change.
+
+****************************************************************************
+* General *
+****************************************************************************
+ - [QTBUG-54982] Add qmlRegisterUncreatableMetaObject convenience function
+ needed to register Q_NAMESPACE QMetaObjects.
+
+****************************************************************************
+* Important Behavior Changes *
+****************************************************************************
+
+ - [QTBUG-52012] When the engine looks for QML modules / extension
+ plugins in statically linked applications, the plugins are not
+ instantiated in the qml loader thread anymore. For this to work
+ however it is necessary for plugins to use
+ Q_PLUGIN_METADATA(IID_QQmlExtensionInterface_iid) in their class
+ declaration instead of hardcoding the interface id as a string literal.
+
+ - A JS null value converted to a QVariant now has type
+ QMetaType::Nullptr rather than QMetaType::VoidStar.
+
+ - To improve the start-up time and reduce memory consumption, the QML engine
+ attempts to cache the code and data structures generated during loading of
+ .qml and .js files. Cache files are - if possible - written to disk in the
+ directory next to the source file with the .qmlc/.jsc extension. If that
+ is not possible, they are written to QStandardPaths::CacheLocation.
+
+
+****************************************************************************
+* Library *
+****************************************************************************
+
+QtQml
+-----
+
+ - [QTBUG-53412] Fix mapping of null JS values to null SQL values instead
+ of empty strings.
+ - [QTBUG-53794] Fix crash when using the "with" statement with an
+ expression that throws an exception.
+ - [QTBUG-54589] Fix assertion when deleting properties of JS objects
+ - [QTBUG-54360] Added exit(int retCode) method to the Qt global object. An
+ application can call Qt.exit to specify a return code of the engine.
+ - QQmlXMLHttpRequest:
+ * [QTBUG-38175] QQmlXMLHttpRequest now supports the PATCH method in HTTP
+ requests.
+ - Fix reading of enum properties from gadgets / value types when the
+ enum was registered with qRegisterMetaType().
+ - Fixed support for using namespaces in property types, signal parameter names
+ and list types
+ - Fixed support for declaring default properties of type list<T>
+
+
+QtQuick
+-------
+
+ - QQuickWindow:
+ * The relevant child item is now sent a hover event when the window
+ receives a QEnterEvent, making sure hovering is recognized without
+ waiting for mouse movement.
+ - [QTBUG-50298] Added Qt.application.font property.
+ - QQuickWidget now properly repaints text on high-DPI screen changes.
+ - [QTBUG-54238] qt.scenegraph.info logging category got renamed to
+ qt.scenegraph.general.
+ - ShaderEffect with OpenGL now supports reading GLSL shader sources from
+ local files and from the resource system. Whenever a fragmentShader or
+ vertexShader property is a valid such URL, the value is treated as a
+ file specification instead of actual source code.
+ - The threaded scene graph renderer does not sleep up to one vsync
+ interval before the first frame anymore.
+ - [QTBUG-48723] Added properties to access color values for the HSV and
+ HSL color models to the basic QML color type.
+ - MouseArea no longer thinks it's pressed when it does not accept the
+ press event. When a press event is not accepted, MouseArea also no
+ longer receives a cancel event.
+ - Touch events are now delivered in a well defined order: New touch points
+ are delivered first to items under the finger which was first touching
+ the screen. Then to items that are under the second finger and finally
+ to common ancestors. This means that items that are "on top" will get a
+ chance to grab touch points before any items in the background.
+ - [QTBUG-39888] Fix crash with QQuickItems created via JavaScript being
+ garbage collected sometimes when they're not assigned to a window.
+
+ - Drag:
+ * [QTBUG-37366] Added imageSource property to attached Drag object: this
+ allows drag sources to specify the pixmap to be drawn next to the
+ mouse cursor when starting a drag and drop operation.
+
+ - Important Behavior Changes:
+ * [QTBUG-54133] QQuickWidget now follows the same behavior as
+ QQuickWindow when it comes to the persistent scenegraph setting
+ controlled by QQuickWindow::setPersistentSceneGraph(). In earlier
+ releases the setting was ignored and the scenegraph was torn down on
+ every hide event. This is not the case anymore.
+ * [QTBUG-54133] QQuickWidget now behaves identically to QOpenGLWidget
+ when it comes to handling window changes when reparenting the widget
+ into a hierarchy belonging to another top-level widget. Previously the
+ OpenGL context always got destroyed and recreated in order to ensure
+ texture resource sharing with the new top-level widget. From now on
+ this is only true when when AA_ShareOpenGLContexts it not set.
+
+ - LayoutMirroring:
+ * [QTBUG-55517] Made it possible to attach LayoutMirroring to a Window.
+
+ - MouseArea:
+ * [QTBUG-40475][QTBUG-42194][QTBUG-33982][QTBUG-42578][QTBUG-52537]
+ Hover state is now updated once per frame. This means that
+ MouseArea::containsMouse property will now be correct even if the
+ mouse is not moving, but items move under the cursor. Likewise the
+ mouse position properties and positionChanged signal will act as if
+ the mouse had moved.
+
+ - QQuickItem:
+ * [QTBUG-31861] Fixed issue with mouse button events being sent even
+ when they were disabled by setAcceptedMouseButtons.
+
+ - QQuickWindow:
+ * QQuickWindow::sendEvent() is deprecated. Use
+ QCoreApplication::sendEvent() directly instead.
+
+ - ShaderEffect:
+ * Add new mesh type BorderImageMesh. BorderImageMesh provides an
+ optimized way to use BorderImage-type images with ShaderEffect.
+
+ - Text:
+ * [QTBUG-52389] Fixed clipping of glyphs that extend beyond font's em
+ square.
+ * [QTBUG-54723] Fixed a performance regression when rendering a rich
+ text item with scaled images.
+ * [QTBUG-43133] Fixed placement of flowing text objects in the start of
+ a right-to-left block.
+
+
+
+QML Elements
+------------
+
+ - Added a LoggingCategory type and added support for it to the console
+ object
+
+ - Binding:
+ * Add delayed property to Binding as a way to avoid potentially expensive
+ or unexpected intermediate values.
+
+ - Text, TextEdit, TextInput:
+ * Added "hintingPreference" property
+
+ - Platform Specific Changes:
+ * [Windows][QTBUG-45321] Worked around an issue with fonts that have corrupt
+ cmap tables.
+
+QtTest
+------
+
+ - TestCase:
+ * [QTBUG-19708] Added tryVerify() function to allow verification of
+ asynchronous conditions that can't be tested using tryCompare().
diff --git a/examples/qml/doc/src/qml-extending.qdoc b/examples/qml/doc/src/qml-extending.qdoc
index e5b364e0bc..b4174426a8 100644
--- a/examples/qml/doc/src/qml-extending.qdoc
+++ b/examples/qml/doc/src/qml-extending.qdoc
@@ -75,9 +75,21 @@ This example builds on:
Shows how to use \l {QQmlEngine::}{qmlRegisterExtendedType()} to provide an \l {Registering
Extension Objects}{extension object} to a \l QLineEdit without modifying or
-subclassing. The QML engine instantiates a \l QLineEdit and sets a property that
-only exists on the extension type. The extension type performs calls on the \l
-QLineEdit that otherwise will not be accessible to the QML engine.
+subclassing.
+
+\snippet referenceexamples/extended/main.cpp 0
+
+The QML engine instantiates a \l QLineEdit
+
+\snippet referenceexamples/extended/main.cpp 1
+
+and sets a property that oly exists on the extension type.
+
+\snippet referenceexamples/extended/example.qml 0
+
+The QML engine instantiates a \l QLineEdit and sets a property that
+only exists on the extension type. The extension type performs calls on the
+\l QLineEdit that otherwise will not be accessible to the QML engine.
*/
@@ -174,7 +186,7 @@ and other types can be coerced to it.
\section2 Define Boy and Girl
-The implementation of Boy and Girl are trivial.
+The implementation of Boy and Girl is trivial.
\snippet referenceexamples/coercion/person.cpp 1
@@ -293,12 +305,20 @@ This example builds on:
This example builds on:
\list
-\li \l {Extending QML - Default Property Example}
\li \l {Extending QML - Inheritance and Coercion Example}
\li \l {Extending QML - Object and List Property Types Example}
\li \l {Extending QML - Adding Types Example}
\endlist
+The Methods Example has an additional method in the \c BirthdayParty class: \c invite().
+\c invite() is declared with \l Q_INVOKABLE so that it can be
+called from QML.
+
+\snippet referenceexamples/methods/birthdayparty.h 0
+
+In \c example.qml, the \c invite() method is called in the \l [QML]{QtQml::Component::completed()}{Component.onCompleted} signal handler:
+
+\snippet referenceexamples/methods/example.qml 0
*/
/*!
diff --git a/examples/qml/referenceexamples/extended/main.cpp b/examples/qml/referenceexamples/extended/main.cpp
index fc11587841..f72cb0d9e2 100644
--- a/examples/qml/referenceexamples/extended/main.cpp
+++ b/examples/qml/referenceexamples/extended/main.cpp
@@ -48,11 +48,15 @@ int main(int argc, char ** argv)
{
QApplication app(argc, argv);
+// ![0]
qmlRegisterExtendedType<QLineEdit, LineEditExtension>("People", 1,0, "QLineEdit");
+// ![0]
+// ![1]
QQmlEngine engine;
QQmlComponent component(&engine, QUrl("qrc:example.qml"));
QLineEdit *edit = qobject_cast<QLineEdit *>(component.create());
+// ![1]
if (edit) {
edit->show();
diff --git a/examples/qml/referenceexamples/methods/example.qml b/examples/qml/referenceexamples/methods/example.qml
index 58985c5d5f..197e6007e1 100644
--- a/examples/qml/referenceexamples/methods/example.qml
+++ b/examples/qml/referenceexamples/methods/example.qml
@@ -38,6 +38,7 @@
**
****************************************************************************/
+// ![0]
import QtQuick 2.0
import People 1.0
@@ -52,7 +53,6 @@ BirthdayParty {
Person { name: "Anne Brown" }
]
-// ![0]
Component.onCompleted: invite("William Green")
-// ![0]
}
+// ![0]
diff --git a/examples/quick/demos/calqlatr/calqlatr.qml b/examples/quick/demos/calqlatr/calqlatr.qml
index 81f95907a6..017d819b01 100644
--- a/examples/quick/demos/calqlatr/calqlatr.qml
+++ b/examples/quick/demos/calqlatr/calqlatr.qml
@@ -128,6 +128,7 @@ Rectangle {
height: parent.height
MouseArea {
+ id: mouseInput
property real startX: 0
property real oldP: 0
property bool rewind: false
@@ -140,7 +141,7 @@ Rectangle {
height: 50
onPositionChanged: {
var reverse = startX > window.width / 2
- var mx = mapToItem(window, mouse.x).x
+ var mx = mapToItem(window, mouseInput.mouseX, mouseInput.mouseY).x
var p = Math.abs((mx - startX) / (window.width - display.width))
if (p < oldP)
rewind = reverse ? false : true
@@ -149,7 +150,7 @@ Rectangle {
controller.progress = reverse ? 1 - p : p
oldP = p
}
- onPressed: startX = mapToItem(window, mouse.x).x
+ onPressed: startX = mapToItem(window, mouseInput.mouseX, mouseInput.mouseY).x
onReleased: {
if (rewind)
controller.completeToBeginning()
diff --git a/examples/quick/demos/samegame/content/qmldir b/examples/quick/demos/samegame/content/qmldir
index 727989d006..3b552ec1f1 100644
--- a/examples/quick/demos/samegame/content/qmldir
+++ b/examples/quick/demos/samegame/content/qmldir
@@ -1,5 +1,4 @@
singleton Settings 1.0 Settings.qml
-BBSettings 1.0 BBSettings.qml
Block 1.0 Block.qml
BlockEmitter 1.0 BlockEmitter.qml
Button 1.0 Button.qml
diff --git a/examples/quick/demos/samegame/samegame.qrc b/examples/quick/demos/samegame/samegame.qrc
index e51d3fae05..348ee109f9 100644
--- a/examples/quick/demos/samegame/samegame.qrc
+++ b/examples/quick/demos/samegame/samegame.qrc
@@ -3,8 +3,6 @@
<file>samegame.qml</file>
<file>content/qmldir</file>
<file>content/Settings.qml</file>
- <file>content/BBSettings.qml</file>
- <file>content/+blackberry/Settings.qml</file>
<file>content/gfx/text-p1-won.png</file>
<file>content/gfx/background-puzzle.png</file>
<file>content/gfx/background.png</file>
diff --git a/examples/quick/localstorage/doc/src/localstorage.qdoc b/examples/quick/localstorage/doc/src/localstorage.qdoc
index 1bfba147e1..8ffcbe9d14 100644
--- a/examples/quick/localstorage/doc/src/localstorage.qdoc
+++ b/examples/quick/localstorage/doc/src/localstorage.qdoc
@@ -28,7 +28,7 @@
\title Qt Quick Examples - Local Storage
\example localstorage
\brief A collection of QML local storage examples.
- \image qml-localstorage-example.png
+ \borderedimage qml-localstorage-example.png
\e{Local Storage} is a collection of small QML examples relating to
Qt Quick's \l{local storage} functionality.
diff --git a/examples/quick/localstorage/localstorage/qml-localstorage-example.png b/examples/quick/localstorage/localstorage/qml-localstorage-example.png
deleted file mode 100644
index 7d7edafe63..0000000000
--- a/examples/quick/localstorage/localstorage/qml-localstorage-example.png
+++ /dev/null
Binary files differ
diff --git a/examples/quick/scenegraph/graph/graph.cpp b/examples/quick/scenegraph/graph/graph.cpp
index 389bd384c2..6048a1032c 100644
--- a/examples/quick/scenegraph/graph/graph.cpp
+++ b/examples/quick/scenegraph/graph/graph.cpp
@@ -102,7 +102,7 @@ QSGNode *Graph::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *)
n->background = new NoisyNode(window());
n->grid = new GridNode();
n->line = new LineNode(10, 0.5, QColor("steelblue"));
- n->shadow = new LineNode(20, 0.2, QColor::fromRgbF(0.2, 0.2, 0.2, 0.4));
+ n->shadow = new LineNode(20, 0.2f, QColor::fromRgbF(0.2, 0.2, 0.2, 0.4));
n->appendChildNode(n->background);
n->appendChildNode(n->grid);
diff --git a/src/3rdparty/masm/assembler/MacroAssemblerCodeRef.h b/src/3rdparty/masm/assembler/MacroAssemblerCodeRef.h
index f03254aa38..e3c77d99e6 100644
--- a/src/3rdparty/masm/assembler/MacroAssemblerCodeRef.h
+++ b/src/3rdparty/masm/assembler/MacroAssemblerCodeRef.h
@@ -66,7 +66,7 @@
#define CALLING_CONVENTION_IS_STDCALL 0
#endif
-#if CPU(X86)
+#if CPU(X86) && !OS(INTEGRITY)
#define HAS_FASTCALL_CALLING_CONVENTION 1
#ifndef FASTCALL
#if COMPILER(MSVC)
diff --git a/src/3rdparty/masm/stubs/ExecutableAllocator.h b/src/3rdparty/masm/stubs/ExecutableAllocator.h
index 5a3939b7b2..8617229b06 100644
--- a/src/3rdparty/masm/stubs/ExecutableAllocator.h
+++ b/src/3rdparty/masm/stubs/ExecutableAllocator.h
@@ -39,11 +39,6 @@
#ifndef MASM_EXECUTABLEALLOCATOR_H
#define MASM_EXECUTABLEALLOCATOR_H
-// Defined via mkspec
-#if _MSC_VER >= 1900
-#include <windows.h>
-#endif
-
#include <RefPtr.h>
#include <RefCounted.h>
#include <wtf/PageBlock.h>
@@ -117,13 +112,11 @@ struct ExecutableAllocator {
DWORD oldProtect;
# if !OS(WINRT)
VirtualProtect(addr, size, PAGE_READWRITE, &oldProtect);
-# elif _MSC_VER >= 1900
+# else
bool hr = VirtualProtectFromApp(addr, size, PAGE_READWRITE, &oldProtect);
if (!hr) {
Q_UNREACHABLE();
}
-# else
- (void)oldProtect;
# endif
# else
int mode = PROT_READ | PROT_WRITE;
@@ -152,13 +145,11 @@ struct ExecutableAllocator {
DWORD oldProtect;
# if !OS(WINRT)
VirtualProtect(addr, size, PAGE_EXECUTE_READ, &oldProtect);
-# elif _MSC_VER >= 1900
+# else
bool hr = VirtualProtectFromApp(addr, size, PAGE_EXECUTE_READ, &oldProtect);
if (!hr) {
Q_UNREACHABLE();
}
-# else
- (void)oldProtect;
# endif
# else
int mode = PROT_READ | PROT_EXEC;
diff --git a/src/3rdparty/masm/wtf/Compiler.h b/src/3rdparty/masm/wtf/Compiler.h
index fc3b5c5c08..da10196cc1 100644
--- a/src/3rdparty/masm/wtf/Compiler.h
+++ b/src/3rdparty/masm/wtf/Compiler.h
@@ -113,6 +113,11 @@
#define GCCE_VERSION_AT_LEAST(major, minor, patch) (GCCE_VERSION >= (major * 10000 + minor * 100 + patch))
#endif
+/* COMPILER(GHS) - Green Hills MULTI Compiler */
+#if defined(__ghs)
+#define WTF_COMPILER_GHS 1
+#endif
+
/* COMPILER(GCC) - GNU Compiler Collection */
/* --gnu option of the RVCT compiler also defines __GNUC__ */
#if defined(__GNUC__) && !COMPILER(RVCT)
diff --git a/src/3rdparty/masm/wtf/OSAllocatorWinRT.cpp b/src/3rdparty/masm/wtf/OSAllocatorWinRT.cpp
index b7ad723f07..0a6eda8b98 100644
--- a/src/3rdparty/masm/wtf/OSAllocatorWinRT.cpp
+++ b/src/3rdparty/masm/wtf/OSAllocatorWinRT.cpp
@@ -32,19 +32,8 @@
#include "windows.h"
#include <wtf/Assertions.h>
-#if _MSC_VER >= 1900
// Try to use JIT by default and fallback to non-JIT on first error
static bool qt_winrt_use_jit = true;
-#else // _MSC_VER < 1900
-# define PAGE_EXECUTE 0x10
-# define PAGE_EXECUTE_READ 0x20
-# define PAGE_EXECUTE_READWRITE 0x40
-# define MEM_RELEASE 0x8000
-inline void* VirtualAllocFromApp(void*, size_t, int, int) { return 0; }
-inline bool VirtualProtectFromApp(void *, size_t, int, DWORD*) { return false; }
-inline bool VirtualFree(void *, size_t, DWORD) { return false; }
-static bool qt_winrt_use_jit = false;
-#endif // _MSC_VER < 1900
namespace WTF {
diff --git a/src/3rdparty/masm/wtf/Platform.h b/src/3rdparty/masm/wtf/Platform.h
index 3f480d344a..bc62c381db 100644
--- a/src/3rdparty/masm/wtf/Platform.h
+++ b/src/3rdparty/masm/wtf/Platform.h
@@ -224,7 +224,8 @@
#elif defined(__ARM_ARCH_7A__) \
|| defined(__ARM_ARCH_7R__) \
- || defined(__ARM_ARCH_7S__)
+ || defined(__ARM_ARCH_7S__) \
+ || defined(__CORE_CORTEXA__) // GHS-specific
#define WTF_ARM_ARCH_VERSION 7
/* MSVC sets _M_ARM */
@@ -268,7 +269,8 @@
|| defined(__ARM_ARCH_7A__) \
|| defined(__ARM_ARCH_7M__) \
|| defined(__ARM_ARCH_7R__) \
- || defined(__ARM_ARCH_7S__)
+ || defined(__ARM_ARCH_7S__) \
+ || defined(__CORE_CORTEXA__) // GHS-specific
#define WTF_THUMB_ARCH_VERSION 4
/* RVCT sets __TARGET_ARCH_THUMB */
@@ -385,6 +387,11 @@
#define WTF_OS_HURD 1
#endif
+/* OS(INTEGRITY) - INTEGRITY */
+#ifdef __INTEGRITY
+#define WTF_OS_INTEGRITY 1
+#endif
+
/* OS(LINUX) - Linux */
#ifdef __linux__
#define WTF_OS_LINUX 1
@@ -433,6 +440,7 @@
|| OS(DARWIN) \
|| OS(FREEBSD) \
|| OS(HURD) \
+ || OS(INTEGRITY) \
|| OS(LINUX) \
|| OS(NETBSD) \
|| OS(OPENBSD) \
@@ -603,7 +611,9 @@
#if OS(UNIX)
#define HAVE_ERRNO_H 1
-#define HAVE_MMAP 1
+#if !OS(INTEGRITY)
+#define HAVE_MMAP 1
+#endif
#define HAVE_SIGNAL_H 1
#define HAVE_STRINGS_H 1
#define HAVE_SYS_PARAM_H 1
diff --git a/src/imports/layouts/qquicklayout.cpp b/src/imports/layouts/qquicklayout.cpp
index 3786d21727..55ee3b63c6 100644
--- a/src/imports/layouts/qquicklayout.cpp
+++ b/src/imports/layouts/qquicklayout.cpp
@@ -42,6 +42,7 @@
#include <QtCore/qcoreapplication.h>
#include <QtCore/private/qnumeric_p.h>
#include <QtCore/qmath.h>
+#include <QtQml/qqmlinfo.h>
#include <limits>
/*!
@@ -678,7 +679,7 @@ QQuickLayout *QQuickLayoutAttached::parentLayout() const
parentItem = parentItem->parentItem();
return qobject_cast<QQuickLayout *>(parentItem);
} else {
- qWarning("Layout must be attached to Item elements");
+ qmlWarning(parent()) << "Layout must be attached to Item elements";
}
return 0;
}
@@ -762,9 +763,11 @@ bool QQuickLayout::shouldIgnoreItem(QQuickItem *child, QQuickLayoutAttached *&in
void QQuickLayout::itemChange(ItemChange change, const ItemChangeData &value)
{
if (change == ItemChildAddedChange) {
+ Q_D(QQuickLayout);
QQuickItem *item = value.item;
qmlobject_connect(item, QQuickItem, SIGNAL(baselineOffsetChanged(qreal)), this, QQuickLayout, SLOT(invalidateSenderItem()));
QQuickItemPrivate::get(item)->addItemChangeListener(this, QQuickItemPrivate::SiblingOrder | QQuickItemPrivate::ImplicitWidth | QQuickItemPrivate::ImplicitHeight | QQuickItemPrivate::Destroyed | QQuickItemPrivate::Visibility);
+ d->m_hasItemChangeListeners = true;
if (isReady())
updateLayoutItems();
} else if (change == ItemChildRemovedChange) {
@@ -802,6 +805,30 @@ bool QQuickLayout::isReady() const
return d_func()->m_isReady;
}
+/*!
+ * \brief QQuickLayout::deactivateRecur
+ * \internal
+ *
+ * Call this from the dtor of the top-level layout.
+ * Otherwise, it will trigger lots of unneeded item change listeners (itemVisibleChanged()) for all its descendants
+ * that will have its impact thrown away.
+ */
+void QQuickLayout::deactivateRecur()
+{
+ if (d_func()->m_hasItemChangeListeners) {
+ for (int i = 0; i < itemCount(); ++i) {
+ QQuickItem *item = itemAt(i);
+ // When deleting a layout with children, there is no reason for the children to inform the layout that their
+ // e.g. visibility got changed. The layout already knows that all its children will eventually become invisible, so
+ // we therefore remove its change listener.
+ QQuickItemPrivate::get(item)->removeItemChangeListener(this, QQuickItemPrivate::SiblingOrder | QQuickItemPrivate::ImplicitWidth | QQuickItemPrivate::ImplicitHeight | QQuickItemPrivate::Destroyed | QQuickItemPrivate::Visibility);
+ if (QQuickLayout *layout = qobject_cast<QQuickLayout*>(item))
+ layout->deactivateRecur();
+ }
+ d_func()->m_hasItemChangeListeners = false;
+ }
+}
+
void QQuickLayout::itemSiblingOrderChanged(QQuickItem *item)
{
Q_UNUSED(item);
diff --git a/src/imports/layouts/qquicklayout_p.h b/src/imports/layouts/qquicklayout_p.h
index eece6f8658..113498eb2b 100644
--- a/src/imports/layouts/qquicklayout_p.h
+++ b/src/imports/layouts/qquicklayout_p.h
@@ -95,6 +95,7 @@ public:
void itemChange(ItemChange change, const ItemChangeData &value) Q_DECL_OVERRIDE;
void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE;
bool isReady() const;
+ void deactivateRecur();
/* QQuickItemChangeListener */
@@ -134,6 +135,7 @@ public:
protected:
unsigned m_isReady : 1;
unsigned m_disableRearrange : 1;
+ unsigned m_hasItemChangeListeners : 1; // if false, we don't need to remove its item change listeners...
mutable QSet<QQuickItem *> m_ignoredItems;
};
diff --git a/src/imports/layouts/qquicklayoutstyleinfo.cpp b/src/imports/layouts/qquicklayoutstyleinfo.cpp
index c33ceffb2d..5c8be8f306 100644
--- a/src/imports/layouts/qquicklayoutstyleinfo.cpp
+++ b/src/imports/layouts/qquicklayoutstyleinfo.cpp
@@ -50,7 +50,7 @@ QQuickLayoutStyleInfo::QQuickLayoutStyleInfo()
qreal QQuickLayoutStyleInfo::spacing(Qt::Orientation /*orientation*/) const
{
-#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS) || defined(Q_OS_BLACKBERRY) || defined(Q_OS_QNX) || defined(Q_OS_WINRT)
+#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS) || defined(Q_OS_QNX) || defined(Q_OS_WINRT)
// On Android and iOS the default spacing between each UI element is 8dp
qreal spacing = 8.0;
#else
diff --git a/src/imports/layouts/qquicklinearlayout.cpp b/src/imports/layouts/qquicklinearlayout.cpp
index 13fdd496c2..887b9b1fa1 100644
--- a/src/imports/layouts/qquicklinearlayout.cpp
+++ b/src/imports/layouts/qquicklinearlayout.cpp
@@ -41,6 +41,7 @@
#include "qquickgridlayoutengine_p.h"
#include "qquicklayoutstyleinfo_p.h"
#include <QtCore/private/qnumeric_p.h>
+#include <QtQml/qqmlinfo.h>
#include "qdebug.h"
#include <limits>
@@ -305,11 +306,7 @@ QQuickGridLayoutBase::~QQuickGridLayoutBase()
// Remove item listeners so we do not act on signalling unnecessarily
// (there is no point, as the layout will be torn down anyway).
- for (int i = 0; i < itemCount(); ++i) {
- QQuickItem *item = itemAt(i);
- QQuickItemPrivate::get(item)->removeItemChangeListener(this, QQuickItemPrivate::SiblingOrder | QQuickItemPrivate::ImplicitWidth | QQuickItemPrivate::ImplicitHeight | QQuickItemPrivate::Destroyed | QQuickItemPrivate::Visibility);
- }
-
+ deactivateRecur();
delete d->styleInfo;
}
@@ -668,34 +665,25 @@ void QQuickGridLayout::insertLayoutItems()
int &columnSpan = span[0];
int &rowSpan = span[1];
- bool invalidRowColumn = false;
if (info) {
if (info->isRowSet() || info->isColumnSet()) {
// If row is specified and column is not specified (or vice versa),
// the unspecified component of the cell position should default to 0
- row = column = 0;
- if (info->isRowSet()) {
- row = info->row();
- invalidRowColumn = row < 0;
- }
- if (info->isColumnSet()) {
- column = info->column();
- invalidRowColumn = column < 0;
- }
- }
- if (invalidRowColumn) {
- qWarning("QQuickGridLayoutBase::insertLayoutItems: invalid row/column: %d",
- row < 0 ? row : column);
- return;
+ // The getters do this for us, as they will return 0 for an
+ // unset (or negative) value.
+ row = info->row();
+ column = info->column();
}
rowSpan = info->rowSpan();
columnSpan = info->columnSpan();
- if (columnSpan < 1 || rowSpan < 1) {
- qWarning("QQuickGridLayoutBase::addItem: invalid row span/column span: %d",
- rowSpan < 1 ? rowSpan : columnSpan);
+ if (columnSpan < 1) {
+ qmlWarning(child) << "Layout: invalid column span: " << columnSpan;
return;
- }
+ } else if (rowSpan < 1) {
+ qmlWarning(child) << "Layout: invalid row span: " << rowSpan;
+ return;
+ }
alignment = info->alignment();
}
diff --git a/src/imports/layouts/qquicklinearlayout_p.h b/src/imports/layouts/qquicklinearlayout_p.h
index b425df0fa4..f796c8a855 100644
--- a/src/imports/layouts/qquicklinearlayout_p.h
+++ b/src/imports/layouts/qquicklinearlayout_p.h
@@ -152,8 +152,8 @@ public:
int rows() const;
void setRows(int rows);
- Q_ENUMS(Flow)
enum Flow { LeftToRight, TopToBottom };
+ Q_ENUM(Flow)
Flow flow() const;
void setFlow(Flow flow);
diff --git a/src/imports/localstorage/plugin.cpp b/src/imports/localstorage/plugin.cpp
index ebffb07346..d3ea93c80a 100644
--- a/src/imports/localstorage/plugin.cpp
+++ b/src/imports/localstorage/plugin.cpp
@@ -640,14 +640,32 @@ Below you will find an example of a database transaction which catches exception
\snippet qml/localstorage/dbtransaction.js 0
+In the example you can see an \c insert statement where values are assigned to the fields,
+and the record is written into the table. That is an \c insert statement with a syntax that is usual
+for a relational database. It is however also possible to work with JSON objects and
+store them in a table.
+
+Let's suppose a simple example where we store trips in JSON format using \c date as the unique key.
+An example of a table that could be used for that purpose:
+
+\snippet qml/localstorage/dbtransaction.js 3
+
+The assignment of values to a JSON object:
+
+\snippet qml/localstorage/dbtransaction.js 4
+
+In that case, the data could be saved in the following way:
+
+\snippet qml/localstorage/dbtransaction.js 5
+
\section3 db.readTransaction(callback(tx))
This method creates a read-only transaction and passed to \e callback. In this function,
-you can call \e executeSql on \e tx to read the database (with SELECT statements).
+you can call \e executeSql on \e tx to read the database (with \c select statements).
\section3 results = tx.executeSql(statement, values)
-This method executes a SQL \e statement, binding the list of \e values to SQL positional parameters ("?").
+This method executes an SQL \e statement, binding the list of \e values to SQL positional parameters ("?").
It returns a results object, with the following properties:
diff --git a/src/imports/statemachine/signaltransition.cpp b/src/imports/statemachine/signaltransition.cpp
index 2e6381fc08..44fbf69431 100644
--- a/src/imports/statemachine/signaltransition.cpp
+++ b/src/imports/statemachine/signaltransition.cpp
@@ -127,7 +127,7 @@ void SignalTransition::setSignal(const QJSValue &signal)
Q_ASSERT(sender);
signalMethod = sender->metaObject()->method(signalObject->signalIndex());
} else {
- qmlInfo(this) << tr("Specified signal does not exist.");
+ qmlWarning(this) << tr("Specified signal does not exist.");
return;
}
diff --git a/src/imports/statemachine/state.cpp b/src/imports/statemachine/state.cpp
index 09d246cc1e..f1294b0de0 100644
--- a/src/imports/statemachine/state.cpp
+++ b/src/imports/statemachine/state.cpp
@@ -54,7 +54,7 @@ void State::componentComplete()
static bool once = false;
if (!once) {
once = true;
- qmlInfo(this) << "No top level StateMachine found. Nothing will run without a StateMachine.";
+ qmlWarning(this) << "No top level StateMachine found. Nothing will run without a StateMachine.";
}
}
}
diff --git a/src/imports/statemachine/statemachine.cpp b/src/imports/statemachine/statemachine.cpp
index 76de01fe94..a9ea5f7a95 100644
--- a/src/imports/statemachine/statemachine.cpp
+++ b/src/imports/statemachine/statemachine.cpp
@@ -69,7 +69,7 @@ void StateMachine::setRunning(bool running)
void StateMachine::componentComplete()
{
if (QStateMachine::initialState() == NULL && childMode() == QState::ExclusiveStates)
- qmlInfo(this) << "No initial state set for StateMachine";
+ qmlWarning(this) << "No initial state set for StateMachine";
// Everything is proper setup, now start the state-machine if we got
// asked to do so.
diff --git a/src/imports/statemachine/timeouttransition.cpp b/src/imports/statemachine/timeouttransition.cpp
index 4bb1df3c28..0d208b919b 100644
--- a/src/imports/statemachine/timeouttransition.cpp
+++ b/src/imports/statemachine/timeouttransition.cpp
@@ -72,7 +72,7 @@ void TimeoutTransition::componentComplete()
{
QState *state = qobject_cast<QState*>(parent());
if (!state) {
- qmlInfo(this) << "Parent needs to be a State";
+ qmlWarning(this) << "Parent needs to be a State";
return;
}
diff --git a/src/imports/testlib/TestCase.qml b/src/imports/testlib/TestCase.qml
index ad7533c550..18c70e1169 100644
--- a/src/imports/testlib/TestCase.qml
+++ b/src/imports/testlib/TestCase.qml
@@ -567,7 +567,7 @@ Item {
\qmlmethod object TestCase::createTemporaryObject(Component component, object parent, object properties)
This function dynamically creates a QML object from the given
- \a component with the specified \a parent and \a properties.
+ \a component with the specified optional \a parent and \a properties.
The returned object will be destroyed (if it was not already) after
\l cleanup() has finished executing, meaning that objects created with
this function are guaranteed to be destroyed after each test,
@@ -589,12 +589,6 @@ Item {
throw new Error("QtQuickTest::fail");
}
- if (!parent && parent !== null) {
- qtest_results.fail("Second argument must be a parent object or null; actual type is " + typeof parent,
- util.callerFile(), util.callerLine());
- throw new Error("QtQuickTest::fail");
- }
-
if (properties && typeof properties !== "object") {
qtest_results.fail("Third argument must be an object; actual type is " + typeof properties,
util.callerFile(), util.callerLine());
@@ -614,7 +608,8 @@ Item {
function qtest_destroyTemporaryObjects() {
for (var i = 0; i < qtest_temporaryObjects.length; ++i) {
var temporaryObject = qtest_temporaryObjects[i];
- if (temporaryObject)
+ // ### the typeof check can be removed when QTBUG-57749 is fixed
+ if (temporaryObject && typeof temporaryObject.destroy === "function")
temporaryObject.destroy();
}
qtest_temporaryObjects = [];
diff --git a/src/imports/xmllistmodel/qqmlxmllistmodel.cpp b/src/imports/xmllistmodel/qqmlxmllistmodel.cpp
index 4306f477e9..61c8665a14 100644
--- a/src/imports/xmllistmodel/qqmlxmllistmodel.cpp
+++ b/src/imports/xmllistmodel/qqmlxmllistmodel.cpp
@@ -596,7 +596,7 @@ void QQuickXmlListModelPrivate::append_role(QQmlListProperty<QQuickXmlListModelR
int i = _this->d_func()->roleObjects.count();
_this->d_func()->roleObjects.append(role);
if (_this->d_func()->roleNames.contains(role->name())) {
- qmlInfo(role) << QQuickXmlListModel::tr("\"%1\" duplicates a previous role name and will be disabled.").arg(role->name());
+ qmlWarning(role) << QQuickXmlListModel::tr("\"%1\" duplicates a previous role name and will be disabled.").arg(role->name());
return;
}
_this->d_func()->roles.insert(i, _this->d_func()->highestRole);
@@ -847,7 +847,7 @@ void QQuickXmlListModel::setQuery(const QString &query)
{
Q_D(QQuickXmlListModel);
if (!query.startsWith(QLatin1Char('/'))) {
- qmlInfo(this) << QCoreApplication::translate("QQuickXmlRoleList", "An XmlListModel query must start with '/' or \"//\"");
+ qmlWarning(this) << QCoreApplication::translate("QQuickXmlRoleList", "An XmlListModel query must start with '/' or \"//\"");
return;
}
@@ -1136,11 +1136,11 @@ void QQuickXmlListModel::queryError(void* object, const QString& error)
Q_D(QQuickXmlListModel);
for (int i=0; i<d->roleObjects.count(); i++) {
if (d->roleObjects.at(i) == static_cast<QQuickXmlListModelRole*>(object)) {
- qmlInfo(d->roleObjects.at(i)) << QQuickXmlListModel::tr("invalid query: \"%1\"").arg(error);
+ qmlWarning(d->roleObjects.at(i)) << QQuickXmlListModel::tr("invalid query: \"%1\"").arg(error);
return;
}
}
- qmlInfo(this) << QQuickXmlListModel::tr("invalid query: \"%1\"").arg(error);
+ qmlWarning(this) << QQuickXmlListModel::tr("invalid query: \"%1\"").arg(error);
}
void QQuickXmlListModel::queryCompleted(const QQuickXmlQueryResult &result)
diff --git a/src/imports/xmllistmodel/qqmlxmllistmodel_p.h b/src/imports/xmllistmodel/qqmlxmllistmodel_p.h
index 3a4487a085..e6a0898bb9 100644
--- a/src/imports/xmllistmodel/qqmlxmllistmodel_p.h
+++ b/src/imports/xmllistmodel/qqmlxmllistmodel_p.h
@@ -79,7 +79,6 @@ class QQuickXmlListModel : public QAbstractListModel, public QQmlParserStatus
{
Q_OBJECT
Q_INTERFACES(QQmlParserStatus)
- Q_ENUMS(Status)
Q_PROPERTY(Status status READ status NOTIFY statusChanged)
Q_PROPERTY(qreal progress READ progress NOTIFY progressChanged)
@@ -119,6 +118,7 @@ public:
Q_INVOKABLE QQmlV4Handle get(int index) const;
enum Status { Null, Ready, Loading, Error };
+ Q_ENUM(Status)
Status status() const;
qreal progress() const;
@@ -177,7 +177,7 @@ public:
void setQuery(const QString &query)
{
if (query.startsWith(QLatin1Char('/'))) {
- qmlInfo(this) << tr("An XmlRole query must not start with '/'");
+ qmlWarning(this) << tr("An XmlRole query must not start with '/'");
return;
}
if (m_query == query)
diff --git a/src/particles/qquickcustomparticle.cpp b/src/particles/qquickcustomparticle.cpp
index c08ae3d9ff..babf13a93c 100644
--- a/src/particles/qquickcustomparticle.cpp
+++ b/src/particles/qquickcustomparticle.cpp
@@ -40,6 +40,7 @@
#include "qquickcustomparticle_p.h"
#include <QtQuick/private/qquickshadereffectmesh_p.h>
#include <QtQuick/private/qsgshadersourcebuilder_p.h>
+#include <QtQml/qqmlinfo.h>
#include <cstdlib>
QT_BEGIN_NAMESPACE
@@ -90,6 +91,7 @@ struct PlainVertices {
\brief For specifying shaders to paint particles
\ingroup qtquick-particles
+ \note The maximum number of custom particles is limited to 16383.
*/
QQuickCustomParticle::QQuickCustomParticle(QQuickItem* parent)
@@ -316,13 +318,14 @@ QQuickOpenGLShaderEffectNode* QQuickCustomParticle::buildCustomNodes()
if (!QOpenGLContext::currentContext())
return 0;
- if (QOpenGLContext::currentContext()->isOpenGLES() && m_count * 4 > 0xffff) {
- printf("CustomParticle: Too many particles... \n");
+ if (m_count * 4 > 0xffff) {
+ // Index data is ushort.
+ qmlInfo(this) << "CustomParticle: Too many particles - maximum 16383 per CustomParticle";
return 0;
}
if (m_count <= 0) {
- printf("CustomParticle: Too few particles... \n");
+ qmlInfo(this) << "CustomParticle: Too few particles";
return 0;
}
diff --git a/src/particles/qquickgravity.cpp b/src/particles/qquickgravity.cpp
index 90f305f336..a2a2ad7e0e 100644
--- a/src/particles/qquickgravity.cpp
+++ b/src/particles/qquickgravity.cpp
@@ -37,6 +37,7 @@
**
****************************************************************************/
+#include <QtQml/qqmlinfo.h>
#include "qquickgravity_p.h"
#include <cmath>
QT_BEGIN_NAMESPACE
@@ -64,16 +65,51 @@ const qreal CONV = 0.017453292520444443;
Pixels per second that objects will be accelerated by.
*/
+void QQuickGravityAffector::setMagnitude(qreal arg)
+{
+ if (m_magnitude != arg) {
+ m_magnitude = arg;
+ m_needRecalc = true;
+ emit magnitudeChanged(arg);
+ }
+}
+
+qreal QQuickGravityAffector::magnitude() const
+{
+ return m_magnitude;
+}
+
+
/*!
\qmlproperty real QtQuick.Particles::Gravity::acceleration
+ \deprecated
- Name changed to magnitude, will be removed soon.
+ \warning The name for this property has changed to magnitude, use it instead.
*/
+void QQuickGravityAffector::setAcceleration(qreal arg)
+{
+ qmlWarning(this) << "The acceleration property is deprecated. Please use magnitude instead.";
+ setMagnitude(arg);
+}
+
/*!
\qmlproperty real QtQuick.Particles::Gravity::angle
Angle of acceleration.
*/
+void QQuickGravityAffector::setAngle(qreal arg)
+{
+ if (m_angle != arg) {
+ m_angle = arg;
+ m_needRecalc = true;
+ emit angleChanged(arg);
+ }
+}
+
+qreal QQuickGravityAffector::angle() const
+{
+ return m_angle;
+}
QQuickGravityAffector::QQuickGravityAffector(QQuickItem *parent) :
QQuickParticleAffector(parent), m_magnitude(-10), m_angle(90), m_needRecalc(true)
@@ -94,4 +130,7 @@ bool QQuickGravityAffector::affectParticle(QQuickParticleData *d, qreal dt)
d->setInstantaneousVY(d->curVY(m_system) + m_dy*dt, m_system);
return true;
}
+
+
+
QT_END_NAMESPACE
diff --git a/src/particles/qquickgravity_p.h b/src/particles/qquickgravity_p.h
index d3a7f6665c..333d3d1534 100644
--- a/src/particles/qquickgravity_p.h
+++ b/src/particles/qquickgravity_p.h
@@ -62,52 +62,20 @@ class QQuickGravityAffector : public QQuickParticleAffector
Q_PROPERTY(qreal angle READ angle WRITE setAngle NOTIFY angleChanged)
public:
explicit QQuickGravityAffector(QQuickItem *parent = 0);
- qreal magnitude() const
- {
- return m_magnitude;
- }
+ qreal magnitude() const;
+ qreal angle() const;
- qreal angle() const
- {
- return m_angle;
- }
protected:
bool affectParticle(QQuickParticleData *d, qreal dt) override;
Q_SIGNALS:
-
void magnitudeChanged(qreal arg);
-
void angleChanged(qreal arg);
public Q_SLOTS:
-void setAcceleration(qreal arg)
-{
- qWarning() << "Gravity::acceleration has been renamed Gravity::magnitude";
- if (m_magnitude != arg) {
- m_magnitude = arg;
- m_needRecalc = true;
- Q_EMIT magnitudeChanged(arg);
- }
-}
-
-void setMagnitude(qreal arg)
-{
- if (m_magnitude != arg) {
- m_magnitude = arg;
- m_needRecalc = true;
- Q_EMIT magnitudeChanged(arg);
- }
-}
-
-void setAngle(qreal arg)
-{
- if (m_angle != arg) {
- m_angle = arg;
- m_needRecalc = true;
- Q_EMIT angleChanged(arg);
- }
-}
+ void setMagnitude(qreal arg);
+ void setAcceleration(qreal arg);
+ void setAngle(qreal arg);
private:
qreal m_magnitude;
diff --git a/src/particles/qquickimageparticle.cpp b/src/particles/qquickimageparticle.cpp
index e6b921792f..ccfebddb0e 100644
--- a/src/particles/qquickimageparticle.cpp
+++ b/src/particles/qquickimageparticle.cpp
@@ -58,12 +58,6 @@
QT_BEGIN_NAMESPACE
-#if defined(Q_OS_BLACKBERRY)
-#define SHADER_PLATFORM_DEFINES "Q_OS_BLACKBERRY\n"
-#else
-#define SHADER_PLATFORM_DEFINES
-#endif
-
//TODO: Make it larger on desktop? Requires fixing up shader code with the same define
#define UNIFORM_ARRAY_SIZE 64
@@ -102,7 +96,6 @@ public:
const bool isES = QOpenGLContext::currentContext()->isOpenGLES();
builder.appendSourceFile(QStringLiteral(":/particles/shaders/imageparticle.vert"));
- builder.addDefinition(QByteArray(SHADER_PLATFORM_DEFINES));
builder.addDefinition(QByteArrayLiteral("TABLE"));
builder.addDefinition(QByteArrayLiteral("DEFORM"));
builder.addDefinition(QByteArrayLiteral("COLOR"));
@@ -113,7 +106,6 @@ public:
builder.clear();
builder.appendSourceFile(QStringLiteral(":/particles/shaders/imageparticle.frag"));
- builder.addDefinition(QByteArray(SHADER_PLATFORM_DEFINES));
builder.addDefinition(QByteArrayLiteral("TABLE"));
builder.addDefinition(QByteArrayLiteral("DEFORM"));
builder.addDefinition(QByteArrayLiteral("COLOR"));
@@ -180,7 +172,6 @@ public:
const bool isES = QOpenGLContext::currentContext()->isOpenGLES();
builder.appendSourceFile(QStringLiteral(":/particles/shaders/imageparticle.vert"));
- builder.addDefinition(QByteArray(SHADER_PLATFORM_DEFINES));
builder.addDefinition(QByteArrayLiteral("DEFORM"));
builder.addDefinition(QByteArrayLiteral("COLOR"));
if (isES)
@@ -190,7 +181,6 @@ public:
builder.clear();
builder.appendSourceFile(QStringLiteral(":/particles/shaders/imageparticle.frag"));
- builder.addDefinition(QByteArray(SHADER_PLATFORM_DEFINES));
builder.addDefinition(QByteArrayLiteral("DEFORM"));
builder.addDefinition(QByteArrayLiteral("COLOR"));
if (isES)
@@ -245,7 +235,6 @@ public:
const bool isES = QOpenGLContext::currentContext()->isOpenGLES();
builder.appendSourceFile(QStringLiteral(":/particles/shaders/imageparticle.vert"));
- builder.addDefinition(QByteArray(SHADER_PLATFORM_DEFINES));
builder.addDefinition(QByteArrayLiteral("SPRITE"));
builder.addDefinition(QByteArrayLiteral("TABLE"));
builder.addDefinition(QByteArrayLiteral("DEFORM"));
@@ -257,7 +246,6 @@ public:
builder.clear();
builder.appendSourceFile(QStringLiteral(":/particles/shaders/imageparticle.frag"));
- builder.addDefinition(QByteArray(SHADER_PLATFORM_DEFINES));
builder.addDefinition(QByteArrayLiteral("SPRITE"));
builder.addDefinition(QByteArrayLiteral("TABLE"));
builder.addDefinition(QByteArrayLiteral("DEFORM"));
@@ -327,7 +315,6 @@ public:
const bool isES = QOpenGLContext::currentContext()->isOpenGLES();
builder.appendSourceFile(QStringLiteral(":/particles/shaders/imageparticle.vert"));
- builder.addDefinition(QByteArray(SHADER_PLATFORM_DEFINES));
builder.addDefinition(QByteArrayLiteral("COLOR"));
if (isES)
builder.removeVersion();
@@ -336,7 +323,6 @@ public:
builder.clear();
builder.appendSourceFile(QStringLiteral(":/particles/shaders/imageparticle.frag"));
- builder.addDefinition(QByteArray(SHADER_PLATFORM_DEFINES));
builder.addDefinition(QByteArrayLiteral("COLOR"));
if (isES)
builder.removeVersion();
@@ -405,7 +391,6 @@ public:
const bool isES = QOpenGLContext::currentContext()->isOpenGLES();
builder.appendSourceFile(QStringLiteral(":/particles/shaders/imageparticle.vert"));
- builder.addDefinition(QByteArray(SHADER_PLATFORM_DEFINES));
if (isES)
builder.removeVersion();
@@ -413,7 +398,6 @@ public:
builder.clear();
builder.appendSourceFile(QStringLiteral(":/particles/shaders/imageparticle.frag"));
- builder.addDefinition(QByteArray(SHADER_PLATFORM_DEFINES));
if (isES)
builder.removeVersion();
@@ -510,6 +494,8 @@ void fillUniformArrayFromImage(float* array, const QImage& img, int size)
So if you explicitly set an attribute affecting color, such as redVariation, and then reset it (by setting redVariation
to undefined), all color data will be reset and it will begin to have an implicit value of any shared color from
other ImageParticles.
+
+ \note The maximum number of image particles is limited to 16383.
*/
/*!
\qmlproperty url QtQuick.Particles::ImageParticle::source
@@ -1240,8 +1226,9 @@ void QQuickImageParticle::finishBuildParticleNodes(QSGNode** node)
if (!QOpenGLContext::currentContext())
return;
- if (QOpenGLContext::currentContext()->isOpenGLES() && m_count * 4 > 0xffff) {
- printf("ImageParticle: Too many particles - maximum 16,000 per ImageParticle.\n");//ES 2 vertex count limit is ushort
+ if (m_count * 4 > 0xffff) {
+ // Index data is ushort.
+ qmlInfo(this) << "ImageParticle: Too many particles - maximum 16383 per ImageParticle";
return;
}
@@ -1344,21 +1331,21 @@ void QQuickImageParticle::finishBuildParticleNodes(QSGNode** node)
if (m_colorTable->pix.isReady())
colortable = m_colorTable->pix.image();
else
- qmlInfo(this) << "Error loading color table: " << m_colorTable->pix.error();
+ qmlWarning(this) << "Error loading color table: " << m_colorTable->pix.error();
}
if (m_sizeTable) {
if (m_sizeTable->pix.isReady())
sizetable = m_sizeTable->pix.image();
else
- qmlInfo(this) << "Error loading size table: " << m_sizeTable->pix.error();
+ qmlWarning(this) << "Error loading size table: " << m_sizeTable->pix.error();
}
if (m_opacityTable) {
if (m_opacityTable->pix.isReady())
opacitytable = m_opacityTable->pix.image();
else
- qmlInfo(this) << "Error loading opacity table: " << m_opacityTable->pix.error();
+ qmlWarning(this) << "Error loading opacity table: " << m_opacityTable->pix.error();
}
if (colortable.isNull()){//###Goes through image just for this
@@ -1380,7 +1367,7 @@ void QQuickImageParticle::finishBuildParticleNodes(QSGNode** node)
if (!imageLoaded) {
if (!m_image || !m_image->pix.isReady()) {
if (m_image)
- qmlInfo(this) << m_image->pix.error();
+ qmlWarning(this) << m_image->pix.error();
delete m_material;
return;
}
diff --git a/src/particles/qquickmaskextruder.cpp b/src/particles/qquickmaskextruder.cpp
index 66d5808c33..7564fa6739 100644
--- a/src/particles/qquickmaskextruder.cpp
+++ b/src/particles/qquickmaskextruder.cpp
@@ -94,7 +94,7 @@ void QQuickMaskExtruder::startMaskLoading()
void QQuickMaskExtruder::finishMaskLoading()
{
if (m_pix.isError())
- qmlInfo(this) << m_pix.error();
+ qmlWarning(this) << m_pix.error();
}
QPointF QQuickMaskExtruder::extrude(const QRectF &r)
diff --git a/src/particles/qquickspritegoal_p.h b/src/particles/qquickspritegoal_p.h
index 2b15d0b8bb..e569603550 100644
--- a/src/particles/qquickspritegoal_p.h
+++ b/src/particles/qquickspritegoal_p.h
@@ -107,7 +107,7 @@ void setSystemStates(bool arg)
{
if (m_systemStates != arg) {
//TODO: GroupGoal was added (and this deprecated) Oct 4 - remove it in a few weeks.
- qmlInfo(this) << "systemStates is deprecated and will be removed soon. Use GroupGoal instead.";
+ qmlWarning(this) << "systemStates is deprecated and will be removed soon. Use GroupGoal instead.";
m_systemStates = arg;
Q_EMIT systemStatesChanged(arg);
}
diff --git a/src/particles/shaders/imageparticle.vert b/src/particles/shaders/imageparticle.vert
index 377f831686..4057a9eb4b 100644
--- a/src/particles/shaders/imageparticle.vert
+++ b/src/particles/shaders/imageparticle.vert
@@ -69,11 +69,7 @@ void main()
fTex = vPosTex.zw;
#endif
highp float currentSize = mix(vData.z, vData.w, t * t);
-#if defined (Q_OS_BLACKBERRY)
- highp float fade = 1.;
-#else
lowp float fade = 1.;
-#endif
highp float fadeIn = min(t * 10., 1.);
highp float fadeOut = 1. - clamp((t - 0.75) * 4.,0., 1.);
@@ -142,4 +138,4 @@ void main()
#endif
}
}
-} \ No newline at end of file
+}
diff --git a/src/particles/shaders/imageparticle_core.vert b/src/particles/shaders/imageparticle_core.vert
index ed9a918eb3..cfa0d57dfd 100644
--- a/src/particles/shaders/imageparticle_core.vert
+++ b/src/particles/shaders/imageparticle_core.vert
@@ -69,11 +69,7 @@ void main()
fTex = vPosTex.zw;
#endif
float currentSize = mix(vData.z, vData.w, t * t);
-#if defined (Q_OS_BLACKBERRY)
float fade = 1.;
-#else
- float fade = 1.;
-#endif
float fadeIn = min(t * 10., 1.);
float fadeOut = 1. - clamp((t - 0.75) * 4.,0., 1.);
@@ -142,4 +138,4 @@ void main()
#endif
}
}
-} \ No newline at end of file
+}
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12threadedrenderloop.cpp b/src/plugins/scenegraph/d3d12/qsgd3d12threadedrenderloop.cpp
index 317471eeec..11cc257103 100644
--- a/src/plugins/scenegraph/d3d12/qsgd3d12threadedrenderloop.cpp
+++ b/src/plugins/scenegraph/d3d12/qsgd3d12threadedrenderloop.cpp
@@ -773,6 +773,11 @@ void QSGD3D12ThreadedRenderLoop::windowDestroyed(QQuickWindow *window)
break;
}
}
+
+ // Now that we altered the window list, we may need to stop the animation
+ // timer even if we didn't via handleObscurity. This covers the case where
+ // we destroy a visible & exposed QQuickWindow.
+ startOrStopAnimationTimer();
}
void QSGD3D12ThreadedRenderLoop::exposureChanged(QQuickWindow *window)
diff --git a/src/plugins/scenegraph/openvg/qsgopenvgrenderloop.cpp b/src/plugins/scenegraph/openvg/qsgopenvgrenderloop.cpp
index 290ee8028c..f7aa704095 100644
--- a/src/plugins/scenegraph/openvg/qsgopenvgrenderloop.cpp
+++ b/src/plugins/scenegraph/openvg/qsgopenvgrenderloop.cpp
@@ -199,7 +199,8 @@ void QSGOpenVGRenderLoop::renderWindow(QQuickWindow *window)
if (profileFrames)
polishTime = renderTimer.nsecsElapsed();
Q_QUICK_SG_PROFILE_SWITCH(QQuickProfiler::SceneGraphPolishFrame,
- QQuickProfiler::SceneGraphRenderLoopFrame);
+ QQuickProfiler::SceneGraphRenderLoopFrame,
+ QQuickProfiler::SceneGraphPolishPolish);
emit window->afterAnimating();
@@ -207,7 +208,8 @@ void QSGOpenVGRenderLoop::renderWindow(QQuickWindow *window)
if (profileFrames)
syncTime = renderTimer.nsecsElapsed();
- Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame);
+ Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame,
+ QQuickProfiler::SceneGraphRenderLoopSync);
// setup coordinate system for window
vgSeti(VG_MATRIX_MODE, VG_MATRIX_PATH_USER_TO_SURFACE);
@@ -219,7 +221,8 @@ void QSGOpenVGRenderLoop::renderWindow(QQuickWindow *window)
if (profileFrames)
renderTime = renderTimer.nsecsElapsed();
- Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame);
+ Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame,
+ QQuickProfiler::SceneGraphRenderLoopRender);
if (data.grabOnly) {
grabContent = vg->readFramebuffer(window->size() * window->effectiveDevicePixelRatio());
@@ -234,7 +237,8 @@ void QSGOpenVGRenderLoop::renderWindow(QQuickWindow *window)
qint64 swapTime = 0;
if (profileFrames)
swapTime = renderTimer.nsecsElapsed();
- Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphRenderLoopFrame);
+ Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphRenderLoopFrame,
+ QQuickProfiler::SceneGraphRenderLoopSwap);
if (QSG_OPENVG_LOG_TIME_RENDERLOOP().isDebugEnabled()) {
static QTime lastFrameTime = QTime::currentTime();
diff --git a/src/qml/compiler/qv4compilationunitmapper_win.cpp b/src/qml/compiler/qv4compilationunitmapper_win.cpp
index 457b702ac3..37cac846a0 100644
--- a/src/qml/compiler/qv4compilationunitmapper_win.cpp
+++ b/src/qml/compiler/qv4compilationunitmapper_win.cpp
@@ -75,7 +75,6 @@ CompiledData::Unit *CompilationUnitMapper::open(const QString &cacheFileName, co
CloseHandle(handle);
});
-#if !defined(Q_OS_WINRT) || _MSC_VER >= 1900
CompiledData::Unit header;
DWORD bytesRead;
if (!ReadFile(handle, reinterpret_cast<char *>(&header), sizeof(header), &bytesRead, nullptr)) {
@@ -115,19 +114,12 @@ CompiledData::Unit *CompilationUnitMapper::open(const QString &cacheFileName, co
}
return reinterpret_cast<CompiledData::Unit*>(dataPtr);
-#else
- Q_UNUSED(sourcePath);
- *errorString = QStringLiteral("Compilation unit mapping not supported on WinRT 8.1");
- return nullptr;
-#endif
}
void CompilationUnitMapper::close()
{
-#if !defined(Q_OS_WINRT) || _MSC_VER >= 1900
if (dataPtr != nullptr)
UnmapViewOfFile(dataPtr);
-#endif
dataPtr = nullptr;
}
diff --git a/src/qml/compiler/qv4compileddata.cpp b/src/qml/compiler/qv4compileddata.cpp
index 8586c84c3d..6aac111897 100644
--- a/src/qml/compiler/qv4compileddata.cpp
+++ b/src/qml/compiler/qv4compileddata.cpp
@@ -407,6 +407,11 @@ bool CompilationUnit::loadFromDisk(const QUrl &url, EvalISelFactory *iselFactory
const Unit * const oldDataPtr = (data && !(data->flags & QV4::CompiledData::Unit::StaticData)) ? data : nullptr;
QScopedValueRollback<const Unit *> dataPtrChange(data, mappedUnit);
+ if (sourcePath != QQmlFile::urlToLocalFileOrQrc(stringAt(data->sourceFileIndex))) {
+ *errorString = QStringLiteral("QML source file has moved to a different location.");
+ return false;
+ }
+
{
const QString foundArchitecture = stringAt(data->architectureIndex);
const QString expectedArchitecture = QSysInfo::buildAbi();
diff --git a/src/qml/compiler/qv4isel_moth.cpp b/src/qml/compiler/qv4isel_moth.cpp
index 1f5c22eb97..9dbebd1128 100644
--- a/src/qml/compiler/qv4isel_moth.cpp
+++ b/src/qml/compiler/qv4isel_moth.cpp
@@ -242,6 +242,11 @@ void InstructionSelection::run(int functionIndex)
addInstruction(set);
}
exceptionHandler = _block->catchBlock;
+ } else if (_block->catchBlock == nullptr && _block->index() != 0 && _block->in.isEmpty()) {
+ exceptionHandler = nullptr;
+ Instruction::SetExceptionHandler set;
+ set.offset = 0;
+ addInstruction(set);
}
for (IR::Stmt *s : _block->statements()) {
diff --git a/src/qml/compiler/qv4ssa.cpp b/src/qml/compiler/qv4ssa.cpp
index 943700de44..1d512711b8 100644
--- a/src/qml/compiler/qv4ssa.cpp
+++ b/src/qml/compiler/qv4ssa.cpp
@@ -2758,7 +2758,7 @@ public:
visit(s);
}
- foreach (const Conversion &conversion, _conversions) {
+ for (const Conversion &conversion : qAsConst(_conversions)) {
IR::Move *move = conversion.stmt->asMove();
// Note: isel only supports move into member when source is a temp, so convert
diff --git a/src/qml/debugger/qqmlprofiler_p.h b/src/qml/debugger/qqmlprofiler_p.h
index 242f26ee0d..3a507bef74 100644
--- a/src/qml/debugger/qqmlprofiler_p.h
+++ b/src/qml/debugger/qqmlprofiler_p.h
@@ -149,40 +149,38 @@ class Q_QML_PRIVATE_EXPORT QQmlProfiler : public QObject, public QQmlProfilerDef
Q_OBJECT
public:
- class BindingRefCount : public QQmlRefCount {
+ class FunctionRefCount : public QQmlRefCount {
public:
- BindingRefCount(QQmlBinding *binding):
- m_binding(binding)
+ FunctionRefCount(QV4::Function *function):
+ m_function(function)
{
- m_binding->ref.ref();
+ m_function->compilationUnit->addref();
}
- BindingRefCount(const BindingRefCount &other) :
- QQmlRefCount(other), m_binding(other.m_binding)
+ FunctionRefCount(const FunctionRefCount &other) :
+ QQmlRefCount(other), m_function(other.m_function)
{
- m_binding->ref.ref();
+ m_function->compilationUnit->addref();
}
- BindingRefCount &operator=(const BindingRefCount &other)
+ FunctionRefCount &operator=(const FunctionRefCount &other)
{
if (this != &other) {
QQmlRefCount::operator=(other);
- other.m_binding->ref.ref();
- if (!m_binding->ref.deref())
- delete m_binding;
- m_binding = other.m_binding;
+ other.m_function->compilationUnit->addref();
+ m_function->compilationUnit->release();
+ m_function = other.m_function;
}
return *this;
}
- ~BindingRefCount()
+ ~FunctionRefCount()
{
- if (!m_binding->ref.deref())
- delete m_binding;
+ m_function->compilationUnit->release();
}
private:
- QQmlBinding *m_binding;
+ QV4::Function *m_function;
};
struct Location {
@@ -199,14 +197,10 @@ public:
RefLocation() : Location(), locationType(MaximumRangeType), ref(nullptr), sent(false)
{}
- RefLocation(QQmlBinding *binding, QV4::FunctionObject *function) :
+ RefLocation(QV4::Function *function) :
Location(function->sourceLocation()), locationType(Binding),
- ref(new BindingRefCount(binding), QQmlRefPointer<QQmlRefCount>::Adopt), sent(false)
- {}
-
- RefLocation(QQmlBinding *binding, QV4::Function *function) :
- Location(function->sourceLocation()), locationType(Binding),
- ref(new BindingRefCount(binding), QQmlRefPointer<QQmlRefCount>::Adopt), sent(false)
+ ref(new FunctionRefCount(function),
+ QQmlRefPointer<QQmlRefCount>::Adopt), sent(false)
{}
RefLocation(QV4::CompiledData::CompilationUnit *ref, const QUrl &url, const QV4::CompiledData::Object *obj,
@@ -236,16 +230,21 @@ public:
typedef QHash<quintptr, Location> LocationHash;
- void startBinding(QQmlBinding *binding, QV4::Function *function)
+ void startBinding(QV4::Function *function)
{
- quintptr locationId(id(binding));
+ // Use the QV4::Function as ID, as that is common among different instances of the same
+ // component. QQmlBinding is per instance.
+ // Add 1 to the ID, to make it different from the IDs the V4 profiler produces. The +1 makes
+ // the pointer point into the middle of the QV4::Function. Thus it still points to valid
+ // memory but we cannot accidentally create a duplicate key from another object.
+ quintptr locationId(id(function) + 1);
m_data.append(QQmlProfilerData(m_timer.nsecsElapsed(),
(1 << RangeStart | 1 << RangeLocation), Binding,
locationId));
RefLocation &location = m_locations[locationId];
if (!location.isValid())
- location = RefLocation(binding, function);
+ location = RefLocation(function);
}
// Have toByteArrays() construct another RangeData event from the same QString later.
@@ -281,7 +280,8 @@ public:
Creating, id(obj)));
}
- void updateCreating(const QV4::CompiledData::Object *obj, QV4::CompiledData::CompilationUnit *ref,
+ void updateCreating(const QV4::CompiledData::Object *obj,
+ QV4::CompiledData::CompilationUnit *ref,
const QUrl &url, const QString &type)
{
quintptr locationId(id(obj));
@@ -330,12 +330,11 @@ struct QQmlProfilerHelper : public QQmlProfilerDefinitions {
};
struct QQmlBindingProfiler : public QQmlProfilerHelper {
- QQmlBindingProfiler(QQmlProfiler *profiler, QQmlBinding *binding,
- QV4::Function *function) :
+ QQmlBindingProfiler(QQmlProfiler *profiler, QV4::Function *function) :
QQmlProfilerHelper(profiler)
{
Q_QML_PROFILE(QQmlProfilerDefinitions::ProfileBinding, profiler,
- startBinding(binding, function));
+ startBinding(function));
}
~QQmlBindingProfiler()
diff --git a/src/qml/doc/src/examples.qdoc b/src/qml/doc/src/examples.qdoc
index f3550ae199..4f12d42f48 100644
--- a/src/qml/doc/src/examples.qdoc
+++ b/src/qml/doc/src/examples.qdoc
@@ -32,4 +32,40 @@
The list of examples demonstrating how to extend C++ to QML or the other way
around.
+
+\noautolist
+
+\table
+ \row
+ \li \l {Extending QML - Adding Types Example}
+ \li Exporting C++ Classes
+ \row
+ \li \l {Extending QML - Object and List Property Types Example}
+ \li Exporting C++ Properties
+ \row
+ \li \l {Extending QML - Extension Objects Example}
+ \li Extension Objects
+ \row
+ \li \l {Extending QML - Inheritance and Coercion Example}
+ \li C++ Inheritance and Coercion
+ \row
+ \li \l {Extending QML - Methods Example}
+ \li Methods Support
+ \row
+ \li \l {Extending QML - Attached Properties Example}
+ \li Attached Properties
+ \row
+ \li \l {Extending QML - Signal Support Example}
+ \li Signal Support
+ \row
+ \li \l {Extending QML - Property Value Source Example}
+ \li Property Value Source
+ \row
+ \li \l {Extending QML - Default Property Example}
+ \li Default Property
+ \row
+ \li \l {Extending QML - Grouped Properties Example}
+ \li Grouped Properties
+\endtable
+
*/
diff --git a/src/qml/doc/src/qmllanguageref/documents/networktransparency.qdoc b/src/qml/doc/src/qmllanguageref/documents/networktransparency.qdoc
index 7fa271c2d9..5cfd80f8a0 100644
--- a/src/qml/doc/src/qmllanguageref/documents/networktransparency.qdoc
+++ b/src/qml/doc/src/qmllanguageref/documents/networktransparency.qdoc
@@ -48,12 +48,8 @@ Image {
}
\endqml
-Network transparency is supported throughout QML, for example:
-
-\list
-\li Fonts - the \c source property of FontLoader is a URL
-\li WebViews - the \c url property of WebView (obviously!)
-\endlist
+Network transparency is supported throughout QML, for example, both the FontLoader
+and Image elements support loading resources from a remote server.
Even QML types themselves can be on the network - if the \l {Prototyping with qmlscene} is used to load
\tt http://example.com/mystuff/Hello.qml and that content refers to a type "World", the engine
diff --git a/src/qml/jit/qv4assembler.cpp b/src/qml/jit/qv4assembler.cpp
index e1acc33f82..018396318e 100644
--- a/src/qml/jit/qv4assembler.cpp
+++ b/src/qml/jit/qv4assembler.cpp
@@ -52,6 +52,8 @@
#include <WTFStubs.h>
#include <iostream>
+#include <QBuffer>
+#include <QCoreApplication>
#if ENABLE(ASSEMBLER)
@@ -146,11 +148,11 @@ bool CompilationUnit::memoryMapCode(QString *errorString)
const Assembler::VoidType Assembler::Void;
-Assembler::Assembler(InstructionSelection *isel, IR::Function* function, QV4::ExecutableAllocator *executableAllocator)
+Assembler::Assembler(QV4::Compiler::JSUnitGenerator *jsGenerator, IR::Function* function, QV4::ExecutableAllocator *executableAllocator)
: _function(function)
, _nextBlock(0)
, _executableAllocator(executableAllocator)
- , _isel(isel)
+ , _jsGenerator(jsGenerator)
{
_addrs.resize(_function->basicBlockCount());
_patches.resize(_function->basicBlockCount());
@@ -301,7 +303,7 @@ Assembler::Pointer Assembler::loadStringAddress(RegisterID reg, const QString &s
loadPtr(Address(Assembler::EngineRegister, qOffsetOf(QV4::ExecutionEngine, current)), Assembler::ScratchRegister);
loadPtr(Address(Assembler::ScratchRegister, qOffsetOf(QV4::Heap::ExecutionContext, compilationUnit)), Assembler::ScratchRegister);
loadPtr(Address(Assembler::ScratchRegister, qOffsetOf(QV4::CompiledData::CompilationUnit, runtimeStrings)), reg);
- const int id = _isel->registerString(string);
+ const int id = _jsGenerator->registerString(string);
return Pointer(reg, id * sizeof(QV4::String*));
}
@@ -314,13 +316,13 @@ Assembler::Address Assembler::loadConstant(const Primitive &v, RegisterID baseRe
{
loadPtr(Address(Assembler::EngineRegister, qOffsetOf(QV4::ExecutionEngine, current)), baseReg);
loadPtr(Address(baseReg, qOffsetOf(QV4::Heap::ExecutionContext, constantTable)), baseReg);
- const int index = _isel->jsUnitGenerator()->registerConstant(v.asReturnedValue());
+ const int index = _jsGenerator->registerConstant(v.asReturnedValue());
return Address(baseReg, index * sizeof(QV4::Value));
}
void Assembler::loadStringRef(RegisterID reg, const QString &string)
{
- const int id = _isel->registerString(string);
+ const int id = _jsGenerator->registerString(string);
move(TrustedImm32(id), reg);
}
@@ -496,4 +498,174 @@ void Assembler::setStackLayout(int maxArgCountForBuiltins, int regularRegistersT
_stackLayout.reset(new StackLayout(_function, maxArgCountForBuiltins, regularRegistersToSave, fpRegistersToSave));
}
+
+namespace {
+class QIODevicePrintStream: public FilePrintStream
+{
+ Q_DISABLE_COPY(QIODevicePrintStream)
+
+public:
+ explicit QIODevicePrintStream(QIODevice *dest)
+ : FilePrintStream(0)
+ , dest(dest)
+ , buf(4096, '0')
+ {
+ Q_ASSERT(dest);
+ }
+
+ ~QIODevicePrintStream()
+ {}
+
+ void vprintf(const char* format, va_list argList) WTF_ATTRIBUTE_PRINTF(2, 0)
+ {
+ const int written = qvsnprintf(buf.data(), buf.size(), format, argList);
+ if (written > 0)
+ dest->write(buf.constData(), written);
+ memset(buf.data(), 0, qMin(written, buf.size()));
+ }
+
+ void flush()
+ {}
+
+private:
+ QIODevice *dest;
+ QByteArray buf;
+};
+} // anonymous namespace
+
+static void printDisassembledOutputWithCalls(QByteArray processedOutput, const QHash<void*, const char*>& functions)
+{
+ for (QHash<void*, const char*>::ConstIterator it = functions.begin(), end = functions.end();
+ it != end; ++it) {
+ const QByteArray ptrString = "0x" + QByteArray::number(quintptr(it.key()), 16);
+ int idx = processedOutput.indexOf(ptrString);
+ if (idx < 0)
+ continue;
+ idx = processedOutput.lastIndexOf('\n', idx);
+ if (idx < 0)
+ continue;
+ processedOutput = processedOutput.insert(idx, QByteArrayLiteral(" ; call ") + it.value());
+ }
+
+ qDebug("%s", processedOutput.constData());
+}
+
+#if defined(Q_OS_LINUX)
+static FILE *pmap;
+
+static void qt_closePmap()
+{
+ if (pmap) {
+ fclose(pmap);
+ pmap = 0;
+ }
+}
+
+#endif
+
+JSC::MacroAssemblerCodeRef Assembler::link(int *codeSize)
+{
+ Label endOfCode = label();
+
+ {
+ for (size_t i = 0, ei = _patches.size(); i != ei; ++i) {
+ Label target = _addrs.at(i);
+ Q_ASSERT(target.isSet());
+ for (Jump jump : qAsConst(_patches.at(i)))
+ jump.linkTo(target, this);
+ }
+ }
+
+ JSC::JSGlobalData dummy(_executableAllocator);
+ JSC::LinkBuffer linkBuffer(dummy, this, 0);
+
+ for (const DataLabelPatch &p : qAsConst(_dataLabelPatches))
+ linkBuffer.patch(p.dataLabel, linkBuffer.locationOf(p.target));
+
+ // link exception handlers
+ for (Jump jump : qAsConst(exceptionPropagationJumps))
+ linkBuffer.link(jump, linkBuffer.locationOf(exceptionReturnLabel));
+
+ {
+ for (size_t i = 0, ei = _labelPatches.size(); i != ei; ++i) {
+ Label target = _addrs.at(i);
+ Q_ASSERT(target.isSet());
+ for (DataLabelPtr label : _labelPatches.at(i))
+ linkBuffer.patch(label, linkBuffer.locationOf(target));
+ }
+ }
+
+ *codeSize = linkBuffer.offsetOf(endOfCode);
+
+ QByteArray name;
+
+ JSC::MacroAssemblerCodeRef codeRef;
+
+ static const bool showCode = qEnvironmentVariableIsSet("QV4_SHOW_ASM");
+ if (showCode) {
+ QHash<void*, const char*> functions;
+#ifndef QT_NO_DEBUG
+ for (CallInfo call : qAsConst(_callInfos))
+ functions[linkBuffer.locationOf(call.label).dataLocation()] = call.functionName;
+#endif
+
+ QBuffer buf;
+ buf.open(QIODevice::WriteOnly);
+ WTF::setDataFile(new QIODevicePrintStream(&buf));
+
+ name = _function->name->toUtf8();
+ if (name.isEmpty())
+ name = "IR::Function(0x" + QByteArray::number(quintptr(_function), 16) + ')';
+ codeRef = linkBuffer.finalizeCodeWithDisassembly("%s", name.data());
+
+ WTF::setDataFile(stderr);
+ printDisassembledOutputWithCalls(buf.data(), functions);
+ } else {
+ codeRef = linkBuffer.finalizeCodeWithoutDisassembly();
+ }
+
+#if defined(Q_OS_LINUX)
+ // This implements writing of JIT'd addresses so that perf can find the
+ // symbol names.
+ //
+ // Perf expects the mapping to be in a certain place and have certain
+ // content, for more information, see:
+ // https://github.com/torvalds/linux/blob/master/tools/perf/Documentation/jit-interface.txt
+ static bool doProfile = !qEnvironmentVariableIsEmpty("QV4_PROFILE_WRITE_PERF_MAP");
+ static bool profileInitialized = false;
+ if (doProfile && !profileInitialized) {
+ profileInitialized = true;
+
+ char pname[PATH_MAX];
+ snprintf(pname, PATH_MAX - 1, "/tmp/perf-%lu.map",
+ (unsigned long)QCoreApplication::applicationPid());
+
+ pmap = fopen(pname, "w");
+ if (!pmap)
+ qWarning("QV4: Can't write %s, call stacks will not contain JavaScript function names", pname);
+
+ // make sure we clean up nicely
+ std::atexit(qt_closePmap);
+ }
+
+ if (pmap) {
+ // this may have been pre-populated, if QV4_SHOW_ASM was on
+ if (name.isEmpty()) {
+ name = _function->name->toUtf8();
+ if (name.isEmpty())
+ name = "IR::Function(0x" + QByteArray::number(quintptr(_function), 16) + ')';
+ }
+
+ fprintf(pmap, "%llx %x %.*s\n",
+ (long long unsigned int)codeRef.code().executableAddress(),
+ *codeSize,
+ name.length(),
+ name.constData());
+ fflush(pmap);
+ }
+#endif
+
+ return codeRef;
+}
+
#endif
diff --git a/src/qml/jit/qv4assembler_p.h b/src/qml/jit/qv4assembler_p.h
index 94478cd9cd..de9c246ed6 100644
--- a/src/qml/jit/qv4assembler_p.h
+++ b/src/qml/jit/qv4assembler_p.h
@@ -111,7 +111,7 @@ class Assembler : public JSC::MacroAssembler, public TargetPlatform
Q_DISABLE_COPY(Assembler)
public:
- Assembler(InstructionSelection *isel, IR::Function* function, QV4::ExecutableAllocator *executableAllocator);
+ Assembler(QV4::Compiler::JSUnitGenerator *jsGenerator, IR::Function* function, QV4::ExecutableAllocator *executableAllocator);
// Explicit type to allow distinguishing between
// pushing an address itself or the value it points
@@ -1092,7 +1092,7 @@ private:
IR::BasicBlock *_nextBlock;
QV4::ExecutableAllocator *_executableAllocator;
- InstructionSelection *_isel;
+ QV4::Compiler::JSUnitGenerator *_jsGenerator;
};
template <typename Result, typename Source>
diff --git a/src/qml/jit/qv4binop.cpp b/src/qml/jit/qv4binop.cpp
index 9c535bb0bb..d2758c4a47 100644
--- a/src/qml/jit/qv4binop.cpp
+++ b/src/qml/jit/qv4binop.cpp
@@ -112,7 +112,7 @@ void Binop::generate(IR::Expr *lhs, IR::Expr *rhs, IR::Expr *target)
return;
}
- Assembler::Jump done;
+ Jump done;
if (lhs->type != IR::StringType && rhs->type != IR::StringType)
done = genInlineBinop(lhs, rhs, target);
@@ -129,13 +129,13 @@ void Binop::generate(IR::Expr *lhs, IR::Expr *rhs, IR::Expr *target)
RuntimeCall context(info.contextImplementation);
if (fallBack.isValid()) {
as->generateFunctionCallImp(info.needsExceptionCheck, target, info.name, fallBack,
- Assembler::PointerToValue(lhs),
- Assembler::PointerToValue(rhs));
+ PointerToValue(lhs),
+ PointerToValue(rhs));
} else if (context.isValid()) {
as->generateFunctionCallImp(info.needsExceptionCheck, target, info.name, context,
Assembler::EngineRegister,
- Assembler::PointerToValue(lhs),
- Assembler::PointerToValue(rhs));
+ PointerToValue(lhs),
+ PointerToValue(rhs));
} else {
Q_ASSERT(!"unreachable");
}
@@ -148,9 +148,9 @@ void Binop::generate(IR::Expr *lhs, IR::Expr *rhs, IR::Expr *target)
void Binop::doubleBinop(IR::Expr *lhs, IR::Expr *rhs, IR::Expr *target)
{
IR::Temp *targetTemp = target->asTemp();
- Assembler::FPRegisterID targetReg;
+ FPRegisterID targetReg;
if (targetTemp && targetTemp->kind == IR::Temp::PhysicalRegister)
- targetReg = (Assembler::FPRegisterID) targetTemp->index;
+ targetReg = (FPRegisterID) targetTemp->index;
else
targetReg = Assembler::FPGpr0;
@@ -162,7 +162,7 @@ void Binop::doubleBinop(IR::Expr *lhs, IR::Expr *rhs, IR::Expr *target)
#if CPU(X86)
if (IR::Const *c = rhs->asConst()) { // Y = X + constant -> Y = X; Y += [constant-address]
as->moveDouble(as->toDoubleRegister(lhs, targetReg), targetReg);
- Assembler::Address addr = as->loadConstant(c, Assembler::ScratchRegister);
+ Address addr = as->loadConstant(c, Assembler::ScratchRegister);
as->addDouble(addr, targetReg);
break;
}
@@ -184,7 +184,7 @@ void Binop::doubleBinop(IR::Expr *lhs, IR::Expr *rhs, IR::Expr *target)
#if CPU(X86)
if (IR::Const *c = rhs->asConst()) { // Y = X * constant -> Y = X; Y *= [constant-address]
as->moveDouble(as->toDoubleRegister(lhs, targetReg), targetReg);
- Assembler::Address addr = as->loadConstant(c, Assembler::ScratchRegister);
+ Address addr = as->loadConstant(c, Assembler::ScratchRegister);
as->mulDouble(addr, targetReg);
break;
}
@@ -203,7 +203,7 @@ void Binop::doubleBinop(IR::Expr *lhs, IR::Expr *rhs, IR::Expr *target)
#if CPU(X86)
if (IR::Const *c = rhs->asConst()) { // Y = X - constant -> Y = X; Y -= [constant-address]
as->moveDouble(as->toDoubleRegister(lhs, targetReg), targetReg);
- Assembler::Address addr = as->loadConstant(c, Assembler::ScratchRegister);
+ Address addr = as->loadConstant(c, Assembler::ScratchRegister);
as->subDouble(addr, targetReg);
break;
}
@@ -231,7 +231,7 @@ void Binop::doubleBinop(IR::Expr *lhs, IR::Expr *rhs, IR::Expr *target)
#if CPU(X86)
if (IR::Const *c = rhs->asConst()) { // Y = X / constant -> Y = X; Y /= [constant-address]
as->moveDouble(as->toDoubleRegister(lhs, targetReg), targetReg);
- Assembler::Address addr = as->loadConstant(c, Assembler::ScratchRegister);
+ Address addr = as->loadConstant(c, Assembler::ScratchRegister);
as->divDouble(addr, targetReg);
break;
}
@@ -258,9 +258,9 @@ void Binop::doubleBinop(IR::Expr *lhs, IR::Expr *rhs, IR::Expr *target)
default: {
Q_ASSERT(target->type == IR::BoolType);
- Assembler::Jump trueCase = as->branchDouble(false, op, lhs, rhs);
+ Jump trueCase = as->branchDouble(false, op, lhs, rhs);
as->storeBool(false, target);
- Assembler::Jump done = as->jump();
+ Jump done = as->jump();
trueCase.link(as);
as->storeBool(true, target);
done.link(as);
@@ -305,13 +305,13 @@ bool Binop::int32Binop(IR::Expr *leftSource, IR::Expr *rightSource, IR::Expr *ta
bool inplaceOpWithAddress = false;
IR::Temp *targetTemp = target->asTemp();
- Assembler::RegisterID targetReg = Assembler::ReturnValueRegister;
+ RegisterID targetReg = Assembler::ReturnValueRegister;
if (targetTemp && targetTemp->kind == IR::Temp::PhysicalRegister) {
IR::Temp *rhs = rightSource->asTemp();
if (!rhs || rhs->kind != IR::Temp::PhysicalRegister || rhs->index != targetTemp->index) {
// We try to load leftSource into the target's register, but we can't do that if
// the target register is the same as rightSource.
- targetReg = (Assembler::RegisterID) targetTemp->index;
+ targetReg = (RegisterID) targetTemp->index;
} else if (rhs && rhs->kind == IR::Temp::PhysicalRegister && targetTemp->index == rhs->index) {
// However, if the target register is the same as the rightSource register, we can flip
// the operands for certain operations.
@@ -323,7 +323,7 @@ bool Binop::int32Binop(IR::Expr *leftSource, IR::Expr *rightSource, IR::Expr *ta
case IR::OpMul:
// X = Y op X -> X = X op Y (or rephrased: X op= Y (so an in-place operation))
std::swap(leftSource, rightSource);
- targetReg = (Assembler::RegisterID) targetTemp->index;
+ targetReg = (RegisterID) targetTemp->index;
break;
case IR::OpLShift:
@@ -368,7 +368,7 @@ bool Binop::int32Binop(IR::Expr *leftSource, IR::Expr *rightSource, IR::Expr *ta
&& targetTemp->kind == IR::Temp::PhysicalRegister
&& targetTemp->index == rightSource->asTemp()->index) {
// X = Y - X -> Tmp = X; X = Y; X -= Tmp
- targetReg = (Assembler::RegisterID) targetTemp->index;
+ targetReg = (RegisterID) targetTemp->index;
as->move(targetReg, Assembler::ScratchRegister);
as->move(as->toInt32Register(leftSource, targetReg), targetReg);
as->sub32(Assembler::ScratchRegister, targetReg);
@@ -384,7 +384,7 @@ bool Binop::int32Binop(IR::Expr *leftSource, IR::Expr *rightSource, IR::Expr *ta
case IR::OpURShift:
if (IR::Const *c = rightSource->asConst()) {
if ((QV4::Primitive::toUInt32(c->value) & 0x1f) == 0) {
- Assembler::RegisterID r = as->toInt32Register(leftSource, targetReg);
+ RegisterID r = as->toInt32Register(leftSource, targetReg);
as->storeInt32(r, target);
return true;
}
@@ -395,10 +395,10 @@ bool Binop::int32Binop(IR::Expr *leftSource, IR::Expr *rightSource, IR::Expr *ta
break;
}
- Assembler::RegisterID l = as->toInt32Register(leftSource, targetReg);
+ RegisterID l = as->toInt32Register(leftSource, targetReg);
if (IR::Const *c = rightSource->asConst()) { // All cases of Y = X op Const
- Assembler::TrustedImm32 r(int(c->value));
- Assembler::TrustedImm32 ur(QV4::Primitive::toUInt32(c->value) & 0x1f);
+ TrustedImm32 r(int(c->value));
+ TrustedImm32 ur(QV4::Primitive::toUInt32(c->value) & 0x1f);
switch (op) {
case IR::OpBitAnd: as->and32(r, l, targetReg); break;
@@ -419,7 +419,7 @@ bool Binop::int32Binop(IR::Expr *leftSource, IR::Expr *rightSource, IR::Expr *ta
return false;
}
} else if (inplaceOpWithAddress) { // All cases of X = X op [address-of-Y]
- Assembler::Pointer rhsAddr = as->loadAddress(Assembler::ScratchRegister, rightSource);
+ Pointer rhsAddr = as->loadAddress(Assembler::ScratchRegister, rightSource);
switch (op) {
case IR::OpBitAnd: as->and32(rhsAddr, targetReg); break;
case IR::OpBitOr: as->or32 (rhsAddr, targetReg); break;
@@ -433,7 +433,7 @@ bool Binop::int32Binop(IR::Expr *leftSource, IR::Expr *rightSource, IR::Expr *ta
return false;
}
} else { // All cases of Z = X op Y
- Assembler::RegisterID r = as->toInt32Register(rightSource, Assembler::ScratchRegister);
+ RegisterID r = as->toInt32Register(rightSource, Assembler::ScratchRegister);
switch (op) {
case IR::OpBitAnd: as->and32(l, r, targetReg); break;
case IR::OpBitOr: as->or32 (l, r, targetReg); break;
@@ -452,10 +452,10 @@ bool Binop::int32Binop(IR::Expr *leftSource, IR::Expr *rightSource, IR::Expr *ta
// Not all CPUs accept shifts over more than 31 bits, and some CPUs (like ARM) will do
// surprising stuff when shifting over 0 bits.
#define CHECK_RHS(op) { \
- as->and32(Assembler::TrustedImm32(0x1f), r, Assembler::ScratchRegister); \
- Assembler::Jump notZero = as->branch32(Assembler::NotEqual, Assembler::ScratchRegister, Assembler::TrustedImm32(0)); \
+ as->and32(TrustedImm32(0x1f), r, Assembler::ScratchRegister); \
+ Jump notZero = as->branch32(RelationalCondition::NotEqual, Assembler::ScratchRegister, TrustedImm32(0)); \
as->move(l, targetReg); \
- Assembler::Jump done = as->jump(); \
+ Jump done = as->jump(); \
notZero.link(as); \
op; \
done.link(as); \
@@ -493,7 +493,7 @@ static inline Assembler::FPRegisterID getFreeFPReg(IR::Expr *shouldNotOverlap, u
Assembler::Jump Binop::genInlineBinop(IR::Expr *leftSource, IR::Expr *rightSource, IR::Expr *target)
{
- Assembler::Jump done;
+ Jump done;
// Try preventing a call for a few common binary operations. This is used in two cases:
// - no register allocation was performed (not available for the platform, or the IR was
@@ -505,10 +505,10 @@ Assembler::Jump Binop::genInlineBinop(IR::Expr *leftSource, IR::Expr *rightSourc
// register.
switch (op) {
case IR::OpAdd: {
- Assembler::FPRegisterID lReg = getFreeFPReg(rightSource, 2);
- Assembler::FPRegisterID rReg = getFreeFPReg(leftSource, 4);
- Assembler::Jump leftIsNoDbl = as->genTryDoubleConversion(leftSource, lReg);
- Assembler::Jump rightIsNoDbl = as->genTryDoubleConversion(rightSource, rReg);
+ FPRegisterID lReg = getFreeFPReg(rightSource, 2);
+ FPRegisterID rReg = getFreeFPReg(leftSource, 4);
+ Jump leftIsNoDbl = as->genTryDoubleConversion(leftSource, lReg);
+ Jump rightIsNoDbl = as->genTryDoubleConversion(rightSource, rReg);
as->addDouble(rReg, lReg);
as->storeDouble(lReg, target);
@@ -520,10 +520,10 @@ Assembler::Jump Binop::genInlineBinop(IR::Expr *leftSource, IR::Expr *rightSourc
rightIsNoDbl.link(as);
} break;
case IR::OpMul: {
- Assembler::FPRegisterID lReg = getFreeFPReg(rightSource, 2);
- Assembler::FPRegisterID rReg = getFreeFPReg(leftSource, 4);
- Assembler::Jump leftIsNoDbl = as->genTryDoubleConversion(leftSource, lReg);
- Assembler::Jump rightIsNoDbl = as->genTryDoubleConversion(rightSource, rReg);
+ FPRegisterID lReg = getFreeFPReg(rightSource, 2);
+ FPRegisterID rReg = getFreeFPReg(leftSource, 4);
+ Jump leftIsNoDbl = as->genTryDoubleConversion(leftSource, lReg);
+ Jump rightIsNoDbl = as->genTryDoubleConversion(rightSource, rReg);
as->mulDouble(rReg, lReg);
as->storeDouble(lReg, target);
@@ -535,10 +535,10 @@ Assembler::Jump Binop::genInlineBinop(IR::Expr *leftSource, IR::Expr *rightSourc
rightIsNoDbl.link(as);
} break;
case IR::OpSub: {
- Assembler::FPRegisterID lReg = getFreeFPReg(rightSource, 2);
- Assembler::FPRegisterID rReg = getFreeFPReg(leftSource, 4);
- Assembler::Jump leftIsNoDbl = as->genTryDoubleConversion(leftSource, lReg);
- Assembler::Jump rightIsNoDbl = as->genTryDoubleConversion(rightSource, rReg);
+ FPRegisterID lReg = getFreeFPReg(rightSource, 2);
+ FPRegisterID rReg = getFreeFPReg(leftSource, 4);
+ Jump leftIsNoDbl = as->genTryDoubleConversion(leftSource, lReg);
+ Jump rightIsNoDbl = as->genTryDoubleConversion(rightSource, rReg);
as->subDouble(rReg, lReg);
as->storeDouble(lReg, target);
@@ -550,10 +550,10 @@ Assembler::Jump Binop::genInlineBinop(IR::Expr *leftSource, IR::Expr *rightSourc
rightIsNoDbl.link(as);
} break;
case IR::OpDiv: {
- Assembler::FPRegisterID lReg = getFreeFPReg(rightSource, 2);
- Assembler::FPRegisterID rReg = getFreeFPReg(leftSource, 4);
- Assembler::Jump leftIsNoDbl = as->genTryDoubleConversion(leftSource, lReg);
- Assembler::Jump rightIsNoDbl = as->genTryDoubleConversion(rightSource, rReg);
+ FPRegisterID lReg = getFreeFPReg(rightSource, 2);
+ FPRegisterID rReg = getFreeFPReg(leftSource, 4);
+ Jump leftIsNoDbl = as->genTryDoubleConversion(leftSource, lReg);
+ Jump rightIsNoDbl = as->genTryDoubleConversion(rightSource, rReg);
as->divDouble(rReg, lReg);
as->storeDouble(lReg, target);
diff --git a/src/qml/jit/qv4binop_p.h b/src/qml/jit/qv4binop_p.h
index 37601f54ba..3742e99e5a 100644
--- a/src/qml/jit/qv4binop_p.h
+++ b/src/qml/jit/qv4binop_p.h
@@ -67,13 +67,23 @@ struct Binop {
, op(operation)
{}
+ using Jump = Assembler::Jump;
+ using Address = Assembler::Address;
+ using RegisterID = Assembler::RegisterID;
+ using FPRegisterID = Assembler::FPRegisterID;
+ using TrustedImm32 = Assembler::TrustedImm32;
+ using ResultCondition = Assembler::ResultCondition;
+ using RelationalCondition = Assembler::RelationalCondition;
+ using Pointer = Assembler::Pointer;
+ using PointerToValue = Assembler::PointerToValue;
+
void generate(IR::Expr *lhs, IR::Expr *rhs, IR::Expr *target);
void doubleBinop(IR::Expr *lhs, IR::Expr *rhs, IR::Expr *target);
bool int32Binop(IR::Expr *leftSource, IR::Expr *rightSource, IR::Expr *target);
- Assembler::Jump genInlineBinop(IR::Expr *leftSource, IR::Expr *rightSource, IR::Expr *target);
+ Jump genInlineBinop(IR::Expr *leftSource, IR::Expr *rightSource, IR::Expr *target);
- typedef Assembler::Jump (Binop::*MemRegOp)(Assembler::Address, Assembler::RegisterID);
- typedef Assembler::Jump (Binop::*ImmRegOp)(Assembler::TrustedImm32, Assembler::RegisterID);
+ typedef Jump (Binop::*MemRegOp)(Address, RegisterID);
+ typedef Jump (Binop::*ImmRegOp)(TrustedImm32, RegisterID);
struct OpInfo {
const char *name;
@@ -88,97 +98,97 @@ struct Binop {
static const OpInfo &operation(IR::AluOp operation)
{ return operations[operation]; }
- Assembler::Jump inline_add32(Assembler::Address addr, Assembler::RegisterID reg)
+ Jump inline_add32(Address addr, RegisterID reg)
{
#if HAVE(ALU_OPS_WITH_MEM_OPERAND)
- return as->branchAdd32(Assembler::Overflow, addr, reg);
+ return as->branchAdd32(ResultCondition::Overflow, addr, reg);
#else
as->load32(addr, Assembler::ScratchRegister);
- return as->branchAdd32(Assembler::Overflow, Assembler::ScratchRegister, reg);
+ return as->branchAdd32(ResultCondition::Overflow, Assembler::ScratchRegister, reg);
#endif
}
- Assembler::Jump inline_add32(Assembler::TrustedImm32 imm, Assembler::RegisterID reg)
+ Jump inline_add32(TrustedImm32 imm, RegisterID reg)
{
- return as->branchAdd32(Assembler::Overflow, imm, reg);
+ return as->branchAdd32(ResultCondition::Overflow, imm, reg);
}
- Assembler::Jump inline_sub32(Assembler::Address addr, Assembler::RegisterID reg)
+ Jump inline_sub32(Address addr, RegisterID reg)
{
#if HAVE(ALU_OPS_WITH_MEM_OPERAND)
- return as->branchSub32(Assembler::Overflow, addr, reg);
+ return as->branchSub32(ResultCondition::Overflow, addr, reg);
#else
as->load32(addr, Assembler::ScratchRegister);
- return as->branchSub32(Assembler::Overflow, Assembler::ScratchRegister, reg);
+ return as->branchSub32(ResultCondition::Overflow, Assembler::ScratchRegister, reg);
#endif
}
- Assembler::Jump inline_sub32(Assembler::TrustedImm32 imm, Assembler::RegisterID reg)
+ Jump inline_sub32(TrustedImm32 imm, RegisterID reg)
{
- return as->branchSub32(Assembler::Overflow, imm, reg);
+ return as->branchSub32(ResultCondition::Overflow, imm, reg);
}
- Assembler::Jump inline_mul32(Assembler::Address addr, Assembler::RegisterID reg)
+ Jump inline_mul32(Address addr, RegisterID reg)
{
#if HAVE(ALU_OPS_WITH_MEM_OPERAND)
return as->branchMul32(Assembler::Overflow, addr, reg);
#else
as->load32(addr, Assembler::ScratchRegister);
- return as->branchMul32(Assembler::Overflow, Assembler::ScratchRegister, reg);
+ return as->branchMul32(ResultCondition::Overflow, Assembler::ScratchRegister, reg);
#endif
}
- Assembler::Jump inline_mul32(Assembler::TrustedImm32 imm, Assembler::RegisterID reg)
+ Jump inline_mul32(TrustedImm32 imm, RegisterID reg)
{
- return as->branchMul32(Assembler::Overflow, imm, reg, reg);
+ return as->branchMul32(ResultCondition::Overflow, imm, reg, reg);
}
- Assembler::Jump inline_shl32(Assembler::Address addr, Assembler::RegisterID reg)
+ Jump inline_shl32(Address addr, RegisterID reg)
{
as->load32(addr, Assembler::ScratchRegister);
- as->and32(Assembler::TrustedImm32(0x1f), Assembler::ScratchRegister);
+ as->and32(TrustedImm32(0x1f), Assembler::ScratchRegister);
as->lshift32(Assembler::ScratchRegister, reg);
- return Assembler::Jump();
+ return Jump();
}
- Assembler::Jump inline_shl32(Assembler::TrustedImm32 imm, Assembler::RegisterID reg)
+ Jump inline_shl32(TrustedImm32 imm, RegisterID reg)
{
imm.m_value &= 0x1f;
as->lshift32(imm, reg);
- return Assembler::Jump();
+ return Jump();
}
- Assembler::Jump inline_shr32(Assembler::Address addr, Assembler::RegisterID reg)
+ Jump inline_shr32(Address addr, RegisterID reg)
{
as->load32(addr, Assembler::ScratchRegister);
- as->and32(Assembler::TrustedImm32(0x1f), Assembler::ScratchRegister);
+ as->and32(TrustedImm32(0x1f), Assembler::ScratchRegister);
as->rshift32(Assembler::ScratchRegister, reg);
- return Assembler::Jump();
+ return Jump();
}
- Assembler::Jump inline_shr32(Assembler::TrustedImm32 imm, Assembler::RegisterID reg)
+ Jump inline_shr32(TrustedImm32 imm, RegisterID reg)
{
imm.m_value &= 0x1f;
as->rshift32(imm, reg);
- return Assembler::Jump();
+ return Jump();
}
- Assembler::Jump inline_ushr32(Assembler::Address addr, Assembler::RegisterID reg)
+ Jump inline_ushr32(Address addr, RegisterID reg)
{
as->load32(addr, Assembler::ScratchRegister);
- as->and32(Assembler::TrustedImm32(0x1f), Assembler::ScratchRegister);
+ as->and32(TrustedImm32(0x1f), Assembler::ScratchRegister);
as->urshift32(Assembler::ScratchRegister, reg);
- return as->branchTest32(Assembler::Signed, reg, reg);
+ return as->branchTest32(ResultCondition::Signed, reg, reg);
}
- Assembler::Jump inline_ushr32(Assembler::TrustedImm32 imm, Assembler::RegisterID reg)
+ Jump inline_ushr32(TrustedImm32 imm, RegisterID reg)
{
imm.m_value &= 0x1f;
as->urshift32(imm, reg);
- return as->branchTest32(Assembler::Signed, reg, reg);
+ return as->branchTest32(ResultCondition::Signed, reg, reg);
}
- Assembler::Jump inline_and32(Assembler::Address addr, Assembler::RegisterID reg)
+ Jump inline_and32(Address addr, RegisterID reg)
{
#if HAVE(ALU_OPS_WITH_MEM_OPERAND)
as->and32(addr, reg);
@@ -186,16 +196,16 @@ struct Binop {
as->load32(addr, Assembler::ScratchRegister);
as->and32(Assembler::ScratchRegister, reg);
#endif
- return Assembler::Jump();
+ return Jump();
}
- Assembler::Jump inline_and32(Assembler::TrustedImm32 imm, Assembler::RegisterID reg)
+ Jump inline_and32(TrustedImm32 imm, RegisterID reg)
{
as->and32(imm, reg);
- return Assembler::Jump();
+ return Jump();
}
- Assembler::Jump inline_or32(Assembler::Address addr, Assembler::RegisterID reg)
+ Jump inline_or32(Address addr, RegisterID reg)
{
#if HAVE(ALU_OPS_WITH_MEM_OPERAND)
as->or32(addr, reg);
@@ -203,16 +213,16 @@ struct Binop {
as->load32(addr, Assembler::ScratchRegister);
as->or32(Assembler::ScratchRegister, reg);
#endif
- return Assembler::Jump();
+ return Jump();
}
- Assembler::Jump inline_or32(Assembler::TrustedImm32 imm, Assembler::RegisterID reg)
+ Jump inline_or32(TrustedImm32 imm, RegisterID reg)
{
as->or32(imm, reg);
- return Assembler::Jump();
+ return Jump();
}
- Assembler::Jump inline_xor32(Assembler::Address addr, Assembler::RegisterID reg)
+ Jump inline_xor32(Address addr, RegisterID reg)
{
#if HAVE(ALU_OPS_WITH_MEM_OPERAND)
as->xor32(addr, reg);
@@ -220,13 +230,13 @@ struct Binop {
as->load32(addr, Assembler::ScratchRegister);
as->xor32(Assembler::ScratchRegister, reg);
#endif
- return Assembler::Jump();
+ return Jump();
}
- Assembler::Jump inline_xor32(Assembler::TrustedImm32 imm, Assembler::RegisterID reg)
+ Jump inline_xor32(TrustedImm32 imm, RegisterID reg)
{
as->xor32(imm, reg);
- return Assembler::Jump();
+ return Jump();
}
diff --git a/src/qml/jit/qv4isel_masm.cpp b/src/qml/jit/qv4isel_masm.cpp
index c5d612ae65..20752b5c34 100644
--- a/src/qml/jit/qv4isel_masm.cpp
+++ b/src/qml/jit/qv4isel_masm.cpp
@@ -68,175 +68,6 @@ using namespace QV4;
using namespace QV4::JIT;
-namespace {
-class QIODevicePrintStream: public FilePrintStream
-{
- Q_DISABLE_COPY(QIODevicePrintStream)
-
-public:
- explicit QIODevicePrintStream(QIODevice *dest)
- : FilePrintStream(0)
- , dest(dest)
- , buf(4096, '0')
- {
- Q_ASSERT(dest);
- }
-
- ~QIODevicePrintStream()
- {}
-
- void vprintf(const char* format, va_list argList) WTF_ATTRIBUTE_PRINTF(2, 0)
- {
- const int written = qvsnprintf(buf.data(), buf.size(), format, argList);
- if (written > 0)
- dest->write(buf.constData(), written);
- memset(buf.data(), 0, qMin(written, buf.size()));
- }
-
- void flush()
- {}
-
-private:
- QIODevice *dest;
- QByteArray buf;
-};
-} // anonymous namespace
-
-static void printDisassembledOutputWithCalls(QByteArray processedOutput, const QHash<void*, const char*>& functions)
-{
- for (QHash<void*, const char*>::ConstIterator it = functions.begin(), end = functions.end();
- it != end; ++it) {
- const QByteArray ptrString = "0x" + QByteArray::number(quintptr(it.key()), 16);
- int idx = processedOutput.indexOf(ptrString);
- if (idx < 0)
- continue;
- idx = processedOutput.lastIndexOf('\n', idx);
- if (idx < 0)
- continue;
- processedOutput = processedOutput.insert(idx, QByteArrayLiteral(" ; call ") + it.value());
- }
-
- qDebug("%s", processedOutput.constData());
-}
-
-#if defined(Q_OS_LINUX)
-static FILE *pmap;
-
-static void qt_closePmap()
-{
- if (pmap) {
- fclose(pmap);
- pmap = 0;
- }
-}
-
-#endif
-
-JSC::MacroAssemblerCodeRef Assembler::link(int *codeSize)
-{
- Label endOfCode = label();
-
- {
- for (size_t i = 0, ei = _patches.size(); i != ei; ++i) {
- Label target = _addrs.at(i);
- Q_ASSERT(target.isSet());
- for (Jump jump : qAsConst(_patches.at(i)))
- jump.linkTo(target, this);
- }
- }
-
- JSC::JSGlobalData dummy(_executableAllocator);
- JSC::LinkBuffer linkBuffer(dummy, this, 0);
-
- for (const DataLabelPatch &p : qAsConst(_dataLabelPatches))
- linkBuffer.patch(p.dataLabel, linkBuffer.locationOf(p.target));
-
- // link exception handlers
- for (Jump jump : qAsConst(exceptionPropagationJumps))
- linkBuffer.link(jump, linkBuffer.locationOf(exceptionReturnLabel));
-
- {
- for (size_t i = 0, ei = _labelPatches.size(); i != ei; ++i) {
- Label target = _addrs.at(i);
- Q_ASSERT(target.isSet());
- for (DataLabelPtr label : _labelPatches.at(i))
- linkBuffer.patch(label, linkBuffer.locationOf(target));
- }
- }
-
- *codeSize = linkBuffer.offsetOf(endOfCode);
-
- QByteArray name;
-
- JSC::MacroAssemblerCodeRef codeRef;
-
- static const bool showCode = qEnvironmentVariableIsSet("QV4_SHOW_ASM");
- if (showCode) {
- QHash<void*, const char*> functions;
-#ifndef QT_NO_DEBUG
- for (CallInfo call : qAsConst(_callInfos))
- functions[linkBuffer.locationOf(call.label).dataLocation()] = call.functionName;
-#endif
-
- QBuffer buf;
- buf.open(QIODevice::WriteOnly);
- WTF::setDataFile(new QIODevicePrintStream(&buf));
-
- name = _function->name->toUtf8();
- if (name.isEmpty())
- name = "IR::Function(0x" + QByteArray::number(quintptr(_function), 16) + ')';
- codeRef = linkBuffer.finalizeCodeWithDisassembly("%s", name.data());
-
- WTF::setDataFile(stderr);
- printDisassembledOutputWithCalls(buf.data(), functions);
- } else {
- codeRef = linkBuffer.finalizeCodeWithoutDisassembly();
- }
-
-#if defined(Q_OS_LINUX)
- // This implements writing of JIT'd addresses so that perf can find the
- // symbol names.
- //
- // Perf expects the mapping to be in a certain place and have certain
- // content, for more information, see:
- // https://github.com/torvalds/linux/blob/master/tools/perf/Documentation/jit-interface.txt
- static bool doProfile = !qEnvironmentVariableIsEmpty("QV4_PROFILE_WRITE_PERF_MAP");
- static bool profileInitialized = false;
- if (doProfile && !profileInitialized) {
- profileInitialized = true;
-
- char pname[PATH_MAX];
- snprintf(pname, PATH_MAX - 1, "/tmp/perf-%lu.map",
- (unsigned long)QCoreApplication::applicationPid());
-
- pmap = fopen(pname, "w");
- if (!pmap)
- qWarning("QV4: Can't write %s, call stacks will not contain JavaScript function names", pname);
-
- // make sure we clean up nicely
- std::atexit(qt_closePmap);
- }
-
- if (pmap) {
- // this may have been pre-populated, if QV4_SHOW_ASM was on
- if (name.isEmpty()) {
- name = _function->name->toUtf8();
- if (name.isEmpty())
- name = "IR::Function(0x" + QByteArray::number(quintptr(_function), 16) + ')';
- }
-
- fprintf(pmap, "%llx %x %.*s\n",
- (long long unsigned int)codeRef.code().executableAddress(),
- *codeSize,
- name.length(),
- name.constData());
- fflush(pmap);
- }
-#endif
-
- return codeRef;
-}
-
InstructionSelection::InstructionSelection(QQmlEnginePrivate *qmlEngine, QV4::ExecutableAllocator *execAllocator, IR::Module *module, Compiler::JSUnitGenerator *jsGenerator, EvalISelFactory *iselFactory)
: EvalInstructionSelection(execAllocator, module, jsGenerator, iselFactory)
, _block(0)
@@ -278,7 +109,7 @@ void InstructionSelection::run(int functionIndex)
qSwap(_removableJumps, removableJumps);
Assembler* oldAssembler = _as;
- _as = new Assembler(this, _function, executableAllocator);
+ _as = new Assembler(jsGenerator, _function, executableAllocator);
_as->setStackLayout(6, // 6 == max argc for calls to built-ins with an argument array
regularRegistersToSave.size(),
fpRegistersToSave.size());
diff --git a/src/qml/jit/qv4regalloc.cpp b/src/qml/jit/qv4regalloc.cpp
index 63d542b5c8..3fb0815299 100644
--- a/src/qml/jit/qv4regalloc.cpp
+++ b/src/qml/jit/qv4regalloc.cpp
@@ -1087,12 +1087,12 @@ private:
if (_info->def(it->temp()) != successorStart && !it->isSplitFromInterval()) {
const int successorEnd = successor->terminator()->id();
const int idx = successor->in.indexOf(predecessor);
- foreach (const Use &use, _info->uses(it->temp())) {
+ for (const Use &use : _info->uses(it->temp)) {
if (use.pos == static_cast<unsigned>(successorStart)) {
// only check the current edge, not all other possible ones. This is
// important for phi nodes: they have uses that are only valid when
// coming in over a specific edge.
- foreach (Stmt *s, successor->statements()) {
+ for (Stmt *s : successor->statements()) {
if (Phi *phi = s->asPhi()) {
Q_ASSERT(it->temp().index != phi->targetTemp->index);
Q_ASSERT(phi->d->incoming[idx]->asTemp() == 0
diff --git a/src/qml/jsapi/qjsvalue.cpp b/src/qml/jsapi/qjsvalue.cpp
index b473e96286..bab2e633a7 100644
--- a/src/qml/jsapi/qjsvalue.cpp
+++ b/src/qml/jsapi/qjsvalue.cpp
@@ -73,7 +73,8 @@
For the object-based types (including Date and RegExp), use the
newT() functions in QJSEngine (e.g. QJSEngine::newObject())
to create a QJSValue of the desired type. For the primitive types,
- use one of the QJSValue constructor overloads.
+ use one of the QJSValue constructor overloads. For other types, e.g.
+ registered gadget types such as QPoint, you can use QJSEngine::toScriptValue.
The methods named isT() (e.g. isBool(), isUndefined()) can be
used to test if a value is of a certain type. The methods named
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp
index 8f2c5174da..a11f7f0875 100644
--- a/src/qml/jsruntime/qv4engine.cpp
+++ b/src/qml/jsruntime/qv4engine.cpp
@@ -158,8 +158,6 @@ ExecutionEngine::ExecutionEngine(EvalISelFactory *factory)
}
Q_ASSERT(maxCallDepth > 0);
- MemoryManager::GCBlocker gcBlocker(memoryManager);
-
if (!factory) {
#if QT_CONFIG(qml_interpreter)
bool jitDisabled = true;
diff --git a/src/qml/jsruntime/qv4global_p.h b/src/qml/jsruntime/qv4global_p.h
index c37ad1668d..1dbc538be2 100644
--- a/src/qml/jsruntime/qv4global_p.h
+++ b/src/qml/jsruntime/qv4global_p.h
@@ -97,19 +97,19 @@ inline double trunc(double d) { return d > 0 ? floor(d) : ceil(d); }
//
// NOTE: This should match the logic in qv4targetplatform_p.h!
-#if defined(Q_PROCESSOR_X86) && !defined(__ILP32__) \
+#if defined(Q_PROCESSOR_X86) && (QT_POINTER_SIZE == 4) \
&& (defined(Q_OS_WIN) || defined(Q_OS_LINUX) || defined(Q_OS_QNX) || defined(Q_OS_FREEBSD))
# define V4_ENABLE_JIT
-#elif defined(Q_PROCESSOR_X86_64) && !defined(__ILP32__) \
+#elif defined(Q_PROCESSOR_X86_64) && (QT_POINTER_SIZE == 8) \
&& (defined(Q_OS_WIN) || defined(Q_OS_LINUX) || defined(Q_OS_MAC) || defined(Q_OS_FREEBSD))
# define V4_ENABLE_JIT
-#elif defined(Q_PROCESSOR_ARM_32)
+#elif defined(Q_PROCESSOR_ARM_32) && (QT_POINTER_SIZE == 4)
# if defined(thumb2) || defined(__thumb2__) || ((defined(__thumb) || defined(__thumb__)) && __TARGET_ARCH_THUMB-0 == 4)
# define V4_ENABLE_JIT
# elif defined(__ARM_ARCH_ISA_THUMB) && __ARM_ARCH_ISA_THUMB == 2 // clang 3.5 and later will set this if the core supports the Thumb-2 ISA.
# define V4_ENABLE_JIT
# endif
-#elif defined(Q_PROCESSOR_ARM_64)
+#elif defined(Q_PROCESSOR_ARM_64) && (QT_POINTER_SIZE == 8)
# if defined(Q_OS_LINUX)
# define V4_ENABLE_JIT
# endif
diff --git a/src/qml/jsruntime/qv4profiling_p.h b/src/qml/jsruntime/qv4profiling_p.h
index d27e853343..f75ac4d33a 100644
--- a/src/qml/jsruntime/qv4profiling_p.h
+++ b/src/qml/jsruntime/qv4profiling_p.h
@@ -158,12 +158,11 @@ public:
FunctionCall &operator=(const FunctionCall &other) {
if (&other != this) {
- if (m_function)
- m_function->compilationUnit->release();
+ other.m_function->compilationUnit->addref();
+ m_function->compilationUnit->release();
m_function = other.m_function;
m_start = other.m_start;
m_end = other.m_end;
- m_function->compilationUnit->addref();
}
return *this;
}
diff --git a/src/qml/jsruntime/qv4regexpobject.cpp b/src/qml/jsruntime/qv4regexpobject.cpp
index 218695624b..41d8010fef 100644
--- a/src/qml/jsruntime/qv4regexpobject.cpp
+++ b/src/qml/jsruntime/qv4regexpobject.cpp
@@ -307,7 +307,8 @@ void RegExpCtor::markObjects(Heap::Base *that, ExecutionEngine *e)
{
RegExpCtor::Data *This = static_cast<RegExpCtor::Data *>(that);
This->lastMatch.mark(e);
- This->lastInput->mark(e);
+ if (This->lastInput)
+ This->lastInput->mark(e);
FunctionObject::markObjects(that, e);
}
diff --git a/src/qml/jsruntime/qv4runtime.cpp b/src/qml/jsruntime/qv4runtime.cpp
index d6c55926b1..023a739e33 100644
--- a/src/qml/jsruntime/qv4runtime.cpp
+++ b/src/qml/jsruntime/qv4runtime.cpp
@@ -499,6 +499,7 @@ Heap::String *RuntimeHelpers::convertToString(ExecutionEngine *engine, const Val
{
Scope scope(engine);
ScopedValue prim(scope, RuntimeHelpers::toPrimitive(value, STRING_HINT));
+ Q_ASSERT(!prim->isManaged() || prim->isString());
return RuntimeHelpers::convertToString(engine, prim);
}
case Value::Integer_Type:
diff --git a/src/qml/jsruntime/qv4script.cpp b/src/qml/jsruntime/qv4script.cpp
index b54177bee9..62145f36cc 100644
--- a/src/qml/jsruntime/qv4script.cpp
+++ b/src/qml/jsruntime/qv4script.cpp
@@ -88,8 +88,6 @@ void Script::parse()
ExecutionEngine *v4 = scope->engine();
Scope valueScope(v4);
- MemoryManager::GCBlocker gcBlocker(v4->memoryManager);
-
IR::Module module(v4->debugger() != 0);
QQmlJS::Engine ee, *engine = &ee;
diff --git a/src/qml/jsruntime/qv4string.cpp b/src/qml/jsruntime/qv4string.cpp
index 1efd8cb714..cde2131aab 100644
--- a/src/qml/jsruntime/qv4string.cpp
+++ b/src/qml/jsruntime/qv4string.cpp
@@ -102,6 +102,7 @@ void Heap::String::init(MemoryManager *mm, String *l, String *r)
stringHash = UINT_MAX;
largestSubLength = qMax(l->largestSubLength, r->largestSubLength);
len = l->len + r->len;
+ Q_ASSERT(largestSubLength <= len);
if (!l->largestSubLength && l->len > largestSubLength)
largestSubLength = l->len;
@@ -113,6 +114,15 @@ void Heap::String::init(MemoryManager *mm, String *l, String *r)
simplifyString();
}
+void Heap::String::destroy() {
+ if (!largestSubLength) {
+ mm->changeUnmanagedHeapSizeUsage(qptrdiff(-text->size) * (int)sizeof(QChar));
+ if (!text->ref.deref())
+ QStringData::deallocate(text);
+ }
+ Base::destroy();
+}
+
uint String::toUInt(bool *ok) const
{
*ok = true;
@@ -151,7 +161,7 @@ void Heap::String::simplifyString() const
text->ref.ref();
identifier = 0;
largestSubLength = 0;
- mm->growUnmanagedHeapSizeUsage(size_t(text->size) * sizeof(QChar));
+ mm->changeUnmanagedHeapSizeUsage(qptrdiff(text->size) * (qptrdiff)sizeof(QChar));
}
void Heap::String::append(const String *data, QChar *ch)
diff --git a/src/qml/jsruntime/qv4string_p.h b/src/qml/jsruntime/qv4string_p.h
index 4890a85724..5b0fd292d6 100644
--- a/src/qml/jsruntime/qv4string_p.h
+++ b/src/qml/jsruntime/qv4string_p.h
@@ -73,11 +73,7 @@ struct Q_QML_PRIVATE_EXPORT String : Base {
#ifndef V4_BOOTSTRAP
void init(MemoryManager *mm, const QString &text);
void init(MemoryManager *mm, String *l, String *n);
- void destroy() {
- if (!largestSubLength && !text->ref.deref())
- QStringData::deallocate(text);
- Base::destroy();
- }
+ void destroy();
void simplifyString() const;
int length() const {
Q_ASSERT((largestSubLength &&
diff --git a/src/qml/memory/qv4mm.cpp b/src/qml/memory/qv4mm.cpp
index 606d3ec162..51eb82059a 100644
--- a/src/qml/memory/qv4mm.cpp
+++ b/src/qml/memory/qv4mm.cpp
@@ -194,10 +194,8 @@ struct MemoryManager::Data
namespace {
-bool sweepChunk(MemoryManager::Data::ChunkHeader *header, uint *itemsInUse, ExecutionEngine *engine, std::size_t *unmanagedHeapSize)
+bool sweepChunk(MemoryManager::Data::ChunkHeader *header, uint *itemsInUse, ExecutionEngine *engine)
{
- Q_ASSERT(unmanagedHeapSize);
-
bool isEmpty = true;
Heap::Base *tail = &header->freeItems;
// qDebug("chunkStart @ %p, size=%x, pos=%x", header->itemStart, header->itemSize, header->itemSize>>4);
@@ -222,13 +220,6 @@ bool sweepChunk(MemoryManager::Data::ChunkHeader *header, uint *itemsInUse, Exec
#ifdef V4_USE_VALGRIND
VALGRIND_ENABLE_ERROR_REPORTING;
#endif
- if (std::size_t(header->itemSize) == MemoryManager::align(sizeof(Heap::String)) && m->vtable()->isString) {
- std::size_t heapBytes = static_cast<Heap::String *>(m)->retainedTextSize();
- Q_ASSERT(*unmanagedHeapSize >= heapBytes);
-// qDebug() << "-- it's a string holding on to" << heapBytes << "bytes";
- *unmanagedHeapSize -= heapBytes;
- }
-
if (m->vtable()->destroy) {
m->vtable()->destroy(m);
m->_checkIsDestroyed();
@@ -502,7 +493,7 @@ void MemoryManager::sweep(bool lastSweep)
for (size_t i = 0; i < m_d->heapChunks.size(); ++i) {
Data::ChunkHeader *header = reinterpret_cast<Data::ChunkHeader *>(m_d->heapChunks[i].base());
- chunkIsEmpty[i] = sweepChunk(header, &itemsInUse[header->itemSize >> 4], engine, &m_d->unmanagedHeapSize);
+ chunkIsEmpty[i] = sweepChunk(header, &itemsInUse[header->itemSize >> 4], engine);
}
std::vector<PageAllocation>::iterator chunkIter = m_d->heapChunks.begin();
@@ -565,16 +556,6 @@ void MemoryManager::sweep(bool lastSweep)
}
}
-bool MemoryManager::isGCBlocked() const
-{
- return m_d->gcBlocked;
-}
-
-void MemoryManager::setGCBlocked(bool blockGC)
-{
- m_d->gcBlocked = blockGC;
-}
-
void MemoryManager::runGC()
{
if (m_d->gcBlocked) {
@@ -652,7 +633,7 @@ size_t MemoryManager::getLargeItemsMem() const
return total;
}
-void MemoryManager::growUnmanagedHeapSizeUsage(size_t delta)
+void MemoryManager::changeUnmanagedHeapSizeUsage(qptrdiff delta)
{
m_d->unmanagedHeapSize += delta;
}
diff --git a/src/qml/memory/qv4mm_p.h b/src/qml/memory/qv4mm_p.h
index dfa0d85dff..e6417cb2e0 100644
--- a/src/qml/memory/qv4mm_p.h
+++ b/src/qml/memory/qv4mm_p.h
@@ -76,26 +76,6 @@ class Q_QML_EXPORT MemoryManager
public:
struct Data;
- class GCBlocker
- {
- public:
- GCBlocker(MemoryManager *mm)
- : mm(mm)
- , wasBlocked(mm->isGCBlocked())
- {
- mm->setGCBlocked(true);
- }
-
- ~GCBlocker()
- {
- mm->setGCBlocked(wasBlocked);
- }
-
- private:
- MemoryManager *mm;
- bool wasBlocked;
- };
-
public:
MemoryManager(ExecutionEngine *engine);
~MemoryManager();
@@ -309,8 +289,6 @@ public:
return t->d();
}
- bool isGCBlocked() const;
- void setGCBlocked(bool blockGC);
void runGC();
void dumpStats() const;
@@ -319,7 +297,7 @@ public:
size_t getAllocatedMem() const;
size_t getLargeItemsMem() const;
- void growUnmanagedHeapSizeUsage(size_t delta); // called when a JS object grows itself. Specifically: Heap::String::append
+ void changeUnmanagedHeapSizeUsage(qptrdiff delta); // called when a JS object grows itself. Specifically: Heap::String::append
protected:
/// expects size to be aligned
diff --git a/src/qml/qml.pro b/src/qml/qml.pro
index 826a074701..8f9e4b7f83 100644
--- a/src/qml/qml.pro
+++ b/src/qml/qml.pro
@@ -14,6 +14,8 @@ solaris-cc*:QMAKE_CXXFLAGS_RELEASE -= -O2
# Ensure this gcc optimization is switched off for mips platforms to avoid trouble with JIT.
gcc:isEqual(QT_ARCH, "mips"): QMAKE_CXXFLAGS += -fno-reorder-blocks
+DEFINES += QT_NO_FOREACH
+
exists("qqml_enable_gcov") {
QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage -fno-elide-constructors
LIBS_PRIVATE += -lgcov
diff --git a/src/qml/qml/qqmlabstractbinding.cpp b/src/qml/qml/qqmlabstractbinding.cpp
index 39d609454f..b1c320afd4 100644
--- a/src/qml/qml/qqmlabstractbinding.cpp
+++ b/src/qml/qml/qqmlabstractbinding.cpp
@@ -191,7 +191,7 @@ void QQmlAbstractBinding::removeFromObject()
void QQmlAbstractBinding::printBindingLoopError(QQmlProperty &prop)
{
- qmlInfo(prop.object()) << QString(QLatin1String("Binding loop detected for property \"%1\"")).arg(prop.name());
+ qmlWarning(prop.object()) << QString(QLatin1String("Binding loop detected for property \"%1\"")).arg(prop.name());
}
QString QQmlAbstractBinding::expression() const
diff --git a/src/qml/qml/qqmlabstracturlinterceptor.h b/src/qml/qml/qqmlabstracturlinterceptor.h
index dfb8a46027..665b37fb3a 100644
--- a/src/qml/qml/qqmlabstracturlinterceptor.h
+++ b/src/qml/qml/qqmlabstracturlinterceptor.h
@@ -47,7 +47,6 @@ QT_BEGIN_NAMESPACE
class Q_QML_EXPORT QQmlAbstractUrlInterceptor
{
- Q_FLAGS(InterceptionPoint)
public:
enum DataType { //Matches QQmlDataBlob::Type
QmlFile = 0,
diff --git a/src/qml/qml/qqmlapplicationengine.cpp b/src/qml/qml/qqmlapplicationengine.cpp
index 8a97b7eba7..2a96d96302 100644
--- a/src/qml/qml/qqmlapplicationengine.cpp
+++ b/src/qml/qml/qqmlapplicationengine.cpp
@@ -190,9 +190,14 @@ void QQmlApplicationEnginePrivate::_q_finishLoad(QObject *o)
/*!
\fn QQmlApplicationEngine::objectCreated(QObject *object, const QUrl &url)
- This signal is emitted when an object finishes loading. If loading was successful, \a object contains a pointer to the loaded object.
- Otherwise the pointer is NULL. The \a url loaded is also provided, note that if a QString file path was initially passed to the
- QQmlApplicationEngine, this url will be the equivalent of QUrl::fromLocalFile(filePath).
+ This signal is emitted when an object finishes loading. If loading was
+ successful, \a object contains a pointer to the loaded object, otherwise
+ the pointer is NULL.
+
+ The \a url to the component the \a object came from is also provided.
+
+ \note If the path to the component was provided as a QString containing a
+ relative path, the \a url will contain a fully resolved path to the file.
*/
/*!
@@ -226,7 +231,7 @@ QQmlApplicationEngine::QQmlApplicationEngine(const QUrl &url, QObject *parent)
This is provided as a convenience, and is the same as using the empty constructor and calling load afterwards.
*/
QQmlApplicationEngine::QQmlApplicationEngine(const QString &filePath, QObject *parent)
- : QQmlApplicationEngine(QUrl::fromLocalFile(filePath), parent)
+ : QQmlApplicationEngine(QUrl::fromUserInput(filePath, QLatin1String("."), QUrl::AssumeLocalFile), parent)
{
}
@@ -265,7 +270,7 @@ void QQmlApplicationEngine::load(const QUrl &url)
void QQmlApplicationEngine::load(const QString &filePath)
{
Q_D(QQmlApplicationEngine);
- d->startLoad(QUrl::fromLocalFile(filePath));
+ d->startLoad(QUrl::fromUserInput(filePath, QLatin1String("."), QUrl::AssumeLocalFile));
}
/*!
diff --git a/src/qml/qml/qqmlbinding.cpp b/src/qml/qml/qqmlbinding.cpp
index 284ae1f36f..62288a5845 100644
--- a/src/qml/qml/qqmlbinding.cpp
+++ b/src/qml/qml/qqmlbinding.cpp
@@ -163,7 +163,7 @@ void QQmlBinding::update(QQmlPropertyData::WriteFlags flags)
if (canUseAccessor())
flags.setFlag(QQmlPropertyData::BypassInterceptor);
- QQmlBindingProfiler prof(ep->profiler, this, function());
+ QQmlBindingProfiler prof(ep->profiler, function());
doUpdate(watcher, flags, scope);
if (!watcher.wasDeleted())
diff --git a/src/qml/qml/qqmlboundsignal.cpp b/src/qml/qml/qqmlboundsignal.cpp
index 254d5e1907..4fbd828307 100644
--- a/src/qml/qml/qqmlboundsignal.cpp
+++ b/src/qml/qml/qqmlboundsignal.cpp
@@ -91,7 +91,7 @@ QQmlBoundSignalExpression::QQmlBoundSignalExpression(QObject *target, int index,
function += QQmlPropertyCache::signalParameterStringForJS(v4, signal.parameterNames(), &error);
if (!error.isEmpty()) {
- qmlInfo(scopeObject()) << error;
+ qmlWarning(scopeObject()) << error;
return;
}
} else
@@ -129,7 +129,7 @@ QQmlBoundSignalExpression::QQmlBoundSignalExpression(QObject *target, int index,
QString error;
QQmlPropertyCache::signalParameterStringForJS(engine, signalParameters, &error);
if (!error.isEmpty()) {
- qmlInfo(scopeObject()) << error;
+ qmlWarning(scopeObject()) << error;
return;
}
runtimeFunction->updateInternalClass(engine, signalParameters);
@@ -199,7 +199,10 @@ void QQmlBoundSignalExpression::evaluate(void **a)
// for several cases (such as QVariant type and QObject-derived types)
//args[ii] = engine->metaTypeToJS(type, a[ii + 1]);
if (type == qMetaTypeId<QJSValue>()) {
- callData->args[ii] = *QJSValuePrivate::getValue(reinterpret_cast<QJSValue *>(a[ii + 1]));
+ if (QV4::Value *v4Value = QJSValuePrivate::getValue(reinterpret_cast<QJSValue *>(a[ii + 1])))
+ callData->args[ii] = *v4Value;
+ else
+ callData->args[ii] = QV4::Encode::undefined();
} else if (type == QMetaType::QVariant) {
callData->args[ii] = scope.engine->fromVariant(*((QVariant *)a[ii + 1]));
} else if (type == QMetaType::Int) {
diff --git a/src/qml/qml/qqmlcomponent.cpp b/src/qml/qml/qqmlcomponent.cpp
index 6ebcd142fb..50ed58e63d 100644
--- a/src/qml/qml/qqmlcomponent.cpp
+++ b/src/qml/qml/qqmlcomponent.cpp
@@ -47,8 +47,6 @@
#include "qqml.h"
#include "qqmlengine.h"
#include "qqmlbinding_p.h"
-#include <private/qqmldebugconnector_p.h>
-#include <private/qqmldebugserviceinterfaces_p.h>
#include "qqmlincubator.h"
#include "qqmlincubator_p.h"
#include <private/qqmljavascriptexpression_p.h>
@@ -876,15 +874,6 @@ QQmlComponentPrivate::beginCreate(QQmlContextData *context)
depthIncreased = false;
}
- if (rv) {
- if (QQmlEngineDebugService *service =
- QQmlDebugConnector::service<QQmlEngineDebugService>()) {
- if (!context->isInternal)
- context->asQQmlContextPrivate()->instances.append(rv);
- service->objectCreated(engine, rv);
- }
- }
-
return rv;
}
@@ -1244,7 +1233,7 @@ void QQmlComponent::createObject(QQmlV4Function *args)
if (args->length() >= 2) {
QV4::ScopedValue v(scope, (*args)[1]);
if (!v->as<QV4::Object>() || v->as<QV4::ArrayObject>()) {
- qmlInfo(this) << tr("createObject: value is not an object");
+ qmlWarning(this) << tr("createObject: value is not an object");
args->setReturnValue(QV4::Encode::null());
return;
}
@@ -1361,7 +1350,7 @@ void QQmlComponent::incubateObject(QQmlV4Function *args)
QV4::ScopedValue v(scope, (*args)[1]);
if (v->isNull()) {
} else if (!v->as<QV4::Object>() || v->as<QV4::ArrayObject>()) {
- qmlInfo(this) << tr("createObject: value is not an object");
+ qmlWarning(this) << tr("createObject: value is not an object");
args->setReturnValue(QV4::Encode::null());
return;
} else {
diff --git a/src/qml/qml/qqmlcustomparser.cpp b/src/qml/qml/qqmlcustomparser.cpp
index 85c91a592a..0b0bbef795 100644
--- a/src/qml/qml/qqmlcustomparser.cpp
+++ b/src/qml/qml/qqmlcustomparser.cpp
@@ -83,7 +83,7 @@ QT_BEGIN_NAMESPACE
by \a data, which is a block of data previously returned by a call
to compile().
- Errors should be reported using qmlInfo(object).
+ Errors should be reported using qmlWarning(object).
The \a object will be an instance of the TypeClass specified by QML_REGISTER_CUSTOM_TYPE.
*/
diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp
index c2915c840b..e1fa97b52f 100644
--- a/src/qml/qml/qqmlengine.cpp
+++ b/src/qml/qml/qqmlengine.cpp
@@ -436,7 +436,6 @@ The following functions are also on the Qt object.
\list
\li \c "android" - Android
- \li \c "blackberry" - BlackBerry OS
\li \c "ios" - iOS
\li \c "tvos" - tvOS
\li \c "linux" - Linux
@@ -444,7 +443,6 @@ The following functions are also on the Qt object.
\li \c "unix" - Other Unix-based OS
\li \c "windows" - Windows
\li \c "winrt" - WinRT / UWP
- \li \c "winphone" - Windows Phone
\endlist
\endtable
*/
@@ -1914,9 +1912,29 @@ void QQmlEnginePrivate::sendExit(int retCode)
static void dumpwarning(const QQmlError &error)
{
- QMessageLogger(error.url().toString().toLatin1().constData(),
- error.line(), 0).warning().nospace()
- << qPrintable(error.toString());
+ switch (error.messageType()) {
+ case QtDebugMsg:
+ QMessageLogger(error.url().toString().toLatin1().constData(),
+ error.line(), 0).debug().nospace()
+ << qPrintable(error.toString());
+ break;
+ case QtInfoMsg:
+ QMessageLogger(error.url().toString().toLatin1().constData(),
+ error.line(), 0).info().nospace()
+ << qPrintable(error.toString());
+ break;
+ case QtWarningMsg:
+ case QtFatalMsg: // fatal does not support streaming, and furthermore, is actually fatal. Probably not desirable for QML.
+ QMessageLogger(error.url().toString().toLatin1().constData(),
+ error.line(), 0).warning().nospace()
+ << qPrintable(error.toString());
+ break;
+ case QtCriticalMsg:
+ QMessageLogger(error.url().toString().toLatin1().constData(),
+ error.line(), 0).critical().nospace()
+ << qPrintable(error.toString());
+ break;
+ }
}
static void dumpwarning(const QList<QQmlError> &errors)
@@ -2129,8 +2147,7 @@ bool QQmlEngine::importPlugin(const QString &filePath, const QString &uri, QList
Returns the directory where SQL and other offline
storage is placed.
- QQuickWebView and the SQL databases created with openDatabase()
- are stored here.
+ The SQL databases created with openDatabase() are stored here.
The default is QML/OfflineStorage in the platform-standard
user application data directory.
diff --git a/src/qml/qml/qqmlerror.cpp b/src/qml/qml/qqmlerror.cpp
index 0a6c7b4960..7a1e02eec6 100644
--- a/src/qml/qml/qqmlerror.cpp
+++ b/src/qml/qml/qqmlerror.cpp
@@ -85,11 +85,12 @@ public:
QString description;
quint16 line;
quint16 column;
+ QtMsgType messageType;
QObject *object;
};
QQmlErrorPrivate::QQmlErrorPrivate()
-: line(0), column(0), object()
+: line(0), column(0), messageType(QtMsgType::QtWarningMsg), object()
{
}
@@ -119,12 +120,14 @@ QQmlError &QQmlError::operator=(const QQmlError &other)
delete d;
d = 0;
} else {
- if (!d) d = new QQmlErrorPrivate;
+ if (!d)
+ d = new QQmlErrorPrivate;
d->url = other.d->url;
d->description = other.d->description;
d->line = other.d->line;
d->column = other.d->column;
d->object = other.d->object;
+ d->messageType = other.d->messageType;
}
return *this;
}
@@ -150,8 +153,9 @@ bool QQmlError::isValid() const
*/
QUrl QQmlError::url() const
{
- if (d) return d->url;
- else return QUrl();
+ if (d)
+ return d->url;
+ return QUrl();
}
/*!
@@ -159,7 +163,8 @@ QUrl QQmlError::url() const
*/
void QQmlError::setUrl(const QUrl &url)
{
- if (!d) d = new QQmlErrorPrivate;
+ if (!d)
+ d = new QQmlErrorPrivate;
d->url = url;
}
@@ -168,8 +173,9 @@ void QQmlError::setUrl(const QUrl &url)
*/
QString QQmlError::description() const
{
- if (d) return d->description;
- else return QString();
+ if (d)
+ return d->description;
+ return QString();
}
/*!
@@ -177,7 +183,8 @@ QString QQmlError::description() const
*/
void QQmlError::setDescription(const QString &description)
{
- if (!d) d = new QQmlErrorPrivate;
+ if (!d)
+ d = new QQmlErrorPrivate;
d->description = description;
}
@@ -186,8 +193,9 @@ void QQmlError::setDescription(const QString &description)
*/
int QQmlError::line() const
{
- if (d) return qmlSourceCoordinate(d->line);
- else return -1;
+ if (d)
+ return qmlSourceCoordinate(d->line);
+ return -1;
}
/*!
@@ -195,7 +203,8 @@ int QQmlError::line() const
*/
void QQmlError::setLine(int line)
{
- if (!d) d = new QQmlErrorPrivate;
+ if (!d)
+ d = new QQmlErrorPrivate;
d->line = qmlSourceCoordinate(line);
}
@@ -204,8 +213,9 @@ void QQmlError::setLine(int line)
*/
int QQmlError::column() const
{
- if (d) return qmlSourceCoordinate(d->column);
- else return -1;
+ if (d)
+ return qmlSourceCoordinate(d->column);
+ return -1;
}
/*!
@@ -213,7 +223,8 @@ int QQmlError::column() const
*/
void QQmlError::setColumn(int column)
{
- if (!d) d = new QQmlErrorPrivate;
+ if (!d)
+ d = new QQmlErrorPrivate;
d->column = qmlSourceCoordinate(column);
}
@@ -225,8 +236,9 @@ void QQmlError::setColumn(int column)
*/
QObject *QQmlError::object() const
{
- if (d) return d->object;
- else return 0;
+ if (d)
+ return d->object;
+ return 0;
}
/*!
@@ -234,11 +246,37 @@ QObject *QQmlError::object() const
*/
void QQmlError::setObject(QObject *object)
{
- if (!d) d = new QQmlErrorPrivate;
+ if (!d)
+ d = new QQmlErrorPrivate;
d->object = object;
}
/*!
+ \since 5.9
+
+ Returns the message type.
+ */
+QtMsgType QQmlError::messageType() const
+{
+ if (d)
+ return d->messageType;
+ return QtMsgType::QtWarningMsg;
+}
+
+/*!
+ \since 5.9
+
+ Sets the \a messageType for this message. The message type determines which
+ QDebug handlers are responsible for recieving the message.
+ */
+void QQmlError::setMessageType(QtMsgType messageType)
+{
+ if (!d)
+ d = new QQmlErrorPrivate;
+ d->messageType = messageType;
+}
+
+/*!
Returns the error as a human readable string.
*/
QString QQmlError::toString() const
diff --git a/src/qml/qml/qqmlerror.h b/src/qml/qml/qqmlerror.h
index e4c42223cf..ef529e3828 100644
--- a/src/qml/qml/qqmlerror.h
+++ b/src/qml/qml/qqmlerror.h
@@ -47,6 +47,7 @@
QT_BEGIN_NAMESPACE
+// ### Qt 6: should this be called QQmlMessage, since it can have a message type?
class QDebug;
class QQmlErrorPrivate;
class Q_QML_EXPORT QQmlError
@@ -69,6 +70,8 @@ public:
void setColumn(int);
QObject *object() const;
void setObject(QObject *);
+ QtMsgType messageType() const;
+ void setMessageType(QtMsgType messageType);
QString toString() const;
private:
diff --git a/src/qml/qml/qqmlextensionplugin.cpp b/src/qml/qml/qqmlextensionplugin.cpp
index ca19691e93..097fa71200 100644
--- a/src/qml/qml/qqmlextensionplugin.cpp
+++ b/src/qml/qml/qqmlextensionplugin.cpp
@@ -117,4 +117,14 @@ void QQmlExtensionPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
Q_UNUSED(uri);
}
+/*!
+ \class QQmlExtensionInterface
+ \internal
+ \inmodule QtQml
+
+ \class QQmlTypesExtensionInterface
+ \internal
+ \inmodule QtQml
+*/
+
QT_END_NAMESPACE
diff --git a/src/qml/qml/qqmlinfo.cpp b/src/qml/qml/qqmlinfo.cpp
index 5b6e02d5b1..dae15e2eca 100644
--- a/src/qml/qml/qqmlinfo.cpp
+++ b/src/qml/qml/qqmlinfo.cpp
@@ -50,13 +50,45 @@
QT_BEGIN_NAMESPACE
/*!
+ \fn QQmlInfo QtQml::qmlDebug(const QObject *object)
+ \relates QQmlEngine
+ \since 5.9
+
+ Prints debug messages that include the file and line number for the
+ specified QML \a object.
+
+ When QML types produce logging messages, it improves traceability
+ if they include the QML file and line number on which the
+ particular instance was instantiated.
+
+ To include the file and line number, an object must be passed. If
+ the file and line number is not available for that instance
+ (either it was not instantiated by the QML engine or location
+ information is disabled), "unknown location" will be used instead.
+
+ For example,
+
+ \code
+ qmlDebug(object) << "Internal state: 42";
+ \endcode
+
+ prints
+
+ \code
+ QML MyCustomType (unknown location): Internal state: 42
+ \endcode
+
+ \sa QtQml::qmlInfo, QtQml::qmlWarning
+*/
+
+/*!
\fn QQmlInfo QtQml::qmlInfo(const QObject *object)
\relates QQmlEngine
- Prints warning messages that include the file and line number for the
+ Prints informational messages that include the file and line number for the
specified QML \a object.
- When QML types display warning messages, it improves traceability
+ When QML types produce logging messages, it improves traceability
if they include the QML file and line number on which the
particular instance was instantiated.
@@ -76,14 +108,58 @@ QT_BEGIN_NAMESPACE
\code
QML MyCustomType (unknown location): component property is a write-once property
\endcode
+
+ \note In versions prior to Qt 5.9, qmlInfo reported messages using a warning
+ QtMsgType. For Qt 5.9 and above, qmlInfo uses an info QtMsgType. To send
+ warnings, use qmlWarning.
+
+ \sa QtQml::qmlDebug, QtQml::qmlWarning
+*/
+
+
+/*!
+ \fn QQmlInfo QtQml::qmlWarning(const QObject *object)
+ \relates QQmlEngine
+ \since 5.9
+
+ Prints warning messages that include the file and line number for the
+ specified QML \a object.
+
+ When QML types produce logging messages, it improves traceability
+ if they include the QML file and line number on which the
+ particular instance was instantiated.
+
+ To include the file and line number, an object must be passed. If
+ the file and line number is not available for that instance
+ (either it was not instantiated by the QML engine or location
+ information is disabled), "unknown location" will be used instead.
+
+ For example,
+
+ \code
+ qmlInfo(object) << tr("property cannot be set to 0");
+ \endcode
+
+ prints
+
+ \code
+ QML MyCustomType (unknown location): property cannot be set to 0
+ \endcode
+
+ \sa QtQml::qmlDebug, QtQml::qmlInfo
*/
class QQmlInfoPrivate
{
public:
- QQmlInfoPrivate() : ref (1), object(0) {}
+ QQmlInfoPrivate(QtMsgType type)
+ : ref (1)
+ , msgType(type)
+ , object(nullptr)
+ {}
int ref;
+ QtMsgType msgType;
const QObject *object;
QString buffer;
QList<QQmlError> errors;
@@ -110,6 +186,7 @@ QQmlInfo::~QQmlInfo()
if (!d->buffer.isEmpty()) {
QQmlError error;
+ error.setMessageType(d->msgType);
QObject *object = const_cast<QObject *>(d->object);
@@ -139,28 +216,32 @@ QQmlInfo::~QQmlInfo()
namespace QtQml {
-QQmlInfo qmlInfo(const QObject *me)
-{
- QQmlInfoPrivate *d = new QQmlInfoPrivate;
- d->object = me;
- return QQmlInfo(d);
-}
+#define MESSAGE_FUNCS(FuncName, MessageLevel) \
+ QQmlInfo FuncName(const QObject *me) \
+ { \
+ QQmlInfoPrivate *d = new QQmlInfoPrivate(MessageLevel); \
+ d->object = me; \
+ return QQmlInfo(d); \
+ } \
+ QQmlInfo FuncName(const QObject *me, const QQmlError &error) \
+ { \
+ QQmlInfoPrivate *d = new QQmlInfoPrivate(MessageLevel); \
+ d->object = me; \
+ d->errors << error; \
+ return QQmlInfo(d); \
+ } \
+ QQmlInfo FuncName(const QObject *me, const QList<QQmlError> &errors) \
+ { \
+ QQmlInfoPrivate *d = new QQmlInfoPrivate(MessageLevel); \
+ d->object = me; \
+ d->errors = errors; \
+ return QQmlInfo(d); \
+ }
-QQmlInfo qmlInfo(const QObject *me, const QQmlError &error)
-{
- QQmlInfoPrivate *d = new QQmlInfoPrivate;
- d->object = me;
- d->errors << error;
- return QQmlInfo(d);
-}
+MESSAGE_FUNCS(qmlDebug, QtMsgType::QtDebugMsg)
+MESSAGE_FUNCS(qmlInfo, QtMsgType::QtInfoMsg)
+MESSAGE_FUNCS(qmlWarning, QtMsgType::QtWarningMsg)
-QQmlInfo qmlInfo(const QObject *me, const QList<QQmlError> &errors)
-{
- QQmlInfoPrivate *d = new QQmlInfoPrivate;
- d->object = me;
- d->errors = errors;
- return QQmlInfo(d);
-}
} // namespace QtQml
diff --git a/src/qml/qml/qqmlinfo.h b/src/qml/qml/qqmlinfo.h
index ab0281a688..673125632e 100644
--- a/src/qml/qml/qqmlinfo.h
+++ b/src/qml/qml/qqmlinfo.h
@@ -48,11 +48,19 @@ QT_BEGIN_NAMESPACE
class QQmlInfo;
+// declared in namespace to avoid symbol conflicts with QtDeclarative
namespace QtQml {
- // declared in namespace to avoid symbol conflicts with QtDeclarative
+ Q_QML_EXPORT QQmlInfo qmlDebug(const QObject *me);
+ Q_QML_EXPORT QQmlInfo qmlDebug(const QObject *me, const QQmlError &error);
+ Q_QML_EXPORT QQmlInfo qmlDebug(const QObject *me, const QList<QQmlError> &errors);
+
Q_QML_EXPORT QQmlInfo qmlInfo(const QObject *me);
Q_QML_EXPORT QQmlInfo qmlInfo(const QObject *me, const QQmlError &error);
Q_QML_EXPORT QQmlInfo qmlInfo(const QObject *me, const QList<QQmlError> &errors);
+
+ Q_QML_EXPORT QQmlInfo qmlWarning(const QObject *me);
+ Q_QML_EXPORT QQmlInfo qmlWarning(const QObject *me, const QQmlError &error);
+ Q_QML_EXPORT QQmlInfo qmlWarning(const QObject *me, const QList<QQmlError> &errors);
}
QT_WARNING_PUSH
QT_WARNING_DISABLE_CLANG("-Wheader-hygiene")
@@ -93,9 +101,15 @@ public:
#endif
private:
+ friend Q_QML_EXPORT QQmlInfo QtQml::qmlDebug(const QObject *me);
+ friend Q_QML_EXPORT QQmlInfo QtQml::qmlDebug(const QObject *me, const QQmlError &error);
+ friend Q_QML_EXPORT QQmlInfo QtQml::qmlDebug(const QObject *me, const QList<QQmlError> &errors);
friend Q_QML_EXPORT QQmlInfo QtQml::qmlInfo(const QObject *me);
friend Q_QML_EXPORT QQmlInfo QtQml::qmlInfo(const QObject *me, const QQmlError &error);
friend Q_QML_EXPORT QQmlInfo QtQml::qmlInfo(const QObject *me, const QList<QQmlError> &errors);
+ friend Q_QML_EXPORT QQmlInfo QtQml::qmlWarning(const QObject *me);
+ friend Q_QML_EXPORT QQmlInfo QtQml::qmlWarning(const QObject *me, const QQmlError &error);
+ friend Q_QML_EXPORT QQmlInfo QtQml::qmlWarning(const QObject *me, const QList<QQmlError> &errors);
QQmlInfo(QQmlInfoPrivate *);
QQmlInfoPrivate *d;
diff --git a/src/qml/qml/qqmllist.cpp b/src/qml/qml/qqmllist.cpp
index a719956483..edd93ef03d 100644
--- a/src/qml/qml/qqmllist.cpp
+++ b/src/qml/qml/qqmllist.cpp
@@ -335,7 +335,7 @@ int QQmlListReference::count() const
\since 5.0
\inmodule QtQml
\brief The QQmlListProperty class allows applications to expose list-like
-properties to QML.
+properties of QObject-derived classes to QML.
QML has many list properties, where more than one object value can be assigned.
The use of a list property from QML looks like this:
@@ -369,7 +369,8 @@ QML list properties are type-safe - in this case \c {Fruit} is a QObject type th
The \l {Qt Quick 1} version of this class is named QDeclarativeListProperty.
-\note QQmlListProperty can only be used for lists of QObject-derived object pointers.
+\sa {Extending QML - Object and List Property Types Example}
+
*/
/*!
diff --git a/src/qml/qml/qqmlloggingcategory.cpp b/src/qml/qml/qqmlloggingcategory.cpp
index 70e59db07b..764b874131 100644
--- a/src/qml/qml/qqmlloggingcategory.cpp
+++ b/src/qml/qml/qqmlloggingcategory.cpp
@@ -112,13 +112,13 @@ void QQmlLoggingCategory::componentComplete()
{
m_initialized = true;
if (m_name.isNull())
- qmlInfo(this) << QLatin1String("Declaring the name of the LoggingCategory is mandatory and cannot be changed later !");
+ qmlWarning(this) << QLatin1String("Declaring the name of the LoggingCategory is mandatory and cannot be changed later !");
}
void QQmlLoggingCategory::setName(const QString &name)
{
if (m_initialized) {
- qmlInfo(this) << QLatin1String("The name of a LoggingCategory cannot be changed after the Item is created");
+ qmlWarning(this) << QLatin1String("The name of a LoggingCategory cannot be changed after the Item is created");
return;
}
diff --git a/src/qml/qml/qqmlobjectcreator.cpp b/src/qml/qml/qqmlobjectcreator.cpp
index 2e2a3fb303..09936f6e7a 100644
--- a/src/qml/qml/qqmlobjectcreator.cpp
+++ b/src/qml/qml/qqmlobjectcreator.cpp
@@ -53,6 +53,8 @@
#include <private/qqmlscriptstring_p.h>
#include <private/qqmlpropertyvalueinterceptor_p.h>
#include <private/qqmlvaluetypeproxybinding_p.h>
+#include <private/qqmldebugconnector_p.h>
+#include <private/qqmldebugserviceinterfaces_p.h>
QT_USE_NAMESPACE
@@ -216,6 +218,17 @@ QObject *QQmlObjectCreator::create(int subComponentIndex, QObject *parent, QQmlI
phase = ObjectsCreated;
+ if (instance) {
+ if (QQmlEngineDebugService *service
+ = QQmlDebugConnector::service<QQmlEngineDebugService>()) {
+ if (!parentContext->isInternal)
+ parentContext->asQQmlContextPrivate()->instances.append(instance);
+ service->objectCreated(engine, instance);
+ } else if (!parentContext->isInternal && QQmlDebugConnector::service<QV4DebugService>()) {
+ parentContext->asQQmlContextPrivate()->instances.append(instance);
+ }
+ }
+
return instance;
}
diff --git a/src/qml/qml/qqmlplatform.cpp b/src/qml/qml/qqmlplatform.cpp
index a47a0ab4a4..64ca208f1b 100644
--- a/src/qml/qml/qqmlplatform.cpp
+++ b/src/qml/qml/qqmlplatform.cpp
@@ -59,16 +59,12 @@ QString QQmlPlatform::os()
{
#if defined(Q_OS_ANDROID)
return QStringLiteral("android");
-#elif defined(Q_OS_BLACKBERRY)
- return QStringLiteral("blackberry");
#elif defined(Q_OS_IOS)
return QStringLiteral("ios");
#elif defined(Q_OS_TVOS)
return QStringLiteral("tvos");
#elif defined(Q_OS_MAC)
return QStringLiteral("osx");
-#elif defined(Q_OS_WINPHONE)
- return QStringLiteral("winphone");
#elif defined(Q_OS_WINRT)
return QStringLiteral("winrt");
#elif defined(Q_OS_WIN)
diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp
index 76ac15e2f1..ac993a1037 100644
--- a/src/qml/qml/qqmltypeloader.cpp
+++ b/src/qml/qml/qqmltypeloader.cpp
@@ -2428,7 +2428,7 @@ void QQmlTypeData::continueLoadFromIR()
QList<QQmlError> errors;
- foreach (const QV4::CompiledData::Import *import, m_document->imports) {
+ for (const QV4::CompiledData::Import *import : qAsConst(m_document->imports)) {
if (!addImport(import, &errors)) {
Q_ASSERT(errors.size());
QQmlError error(errors.takeFirst());
diff --git a/src/qml/types/qqmlbind.cpp b/src/qml/types/qqmlbind.cpp
index a545fe57ca..2ded9c13c8 100644
--- a/src/qml/types/qqmlbind.cpp
+++ b/src/qml/types/qqmlbind.cpp
@@ -82,12 +82,12 @@ void QQmlBindPrivate::validate(QObject *binding) const
return;
if (!prop.isValid()) {
- qmlInfo(binding) << "Property '" << propName << "' does not exist on " << QQmlMetaType::prettyTypeName(obj) << ".";
+ qmlWarning(binding) << "Property '" << propName << "' does not exist on " << QQmlMetaType::prettyTypeName(obj) << ".";
return;
}
if (!prop.isWritable()) {
- qmlInfo(binding) << "Property '" << propName << "' on " << QQmlMetaType::prettyTypeName(obj) << " is read-only.";
+ qmlWarning(binding) << "Property '" << propName << "' on " << QQmlMetaType::prettyTypeName(obj) << " is read-only.";
return;
}
}
diff --git a/src/qml/types/qqmlconnections.cpp b/src/qml/types/qqmlconnections.cpp
index 2aed4d9972..870aeaa6e2 100644
--- a/src/qml/types/qqmlconnections.cpp
+++ b/src/qml/types/qqmlconnections.cpp
@@ -168,7 +168,7 @@ void QQmlConnections::setTarget(QObject *obj)
if (d->targetSet && d->target == obj)
return;
d->targetSet = true; // even if setting to 0, it is *set*
- foreach (QQmlBoundSignal *s, d->boundsignals) {
+ for (QQmlBoundSignal *s : qAsConst(d->boundsignals)) {
// It is possible that target is being changed due to one of our signal
// handlers -> use deleteLater().
if (s->isNotifying())
@@ -278,7 +278,7 @@ void QQmlConnections::connectSignals()
QQmlContextData *ctxtdata = ddata ? ddata->outerContext : 0;
const QV4::CompiledData::Unit *qmlUnit = d->compilationUnit->data;
- foreach (const QV4::CompiledData::Binding *binding, d->bindings) {
+ for (const QV4::CompiledData::Binding *binding : qAsConst(d->bindings)) {
Q_ASSERT(binding->type == QV4::CompiledData::Binding::Type_Script);
QString propName = qmlUnit->stringAt(binding->propertyNameIndex);
@@ -295,7 +295,7 @@ void QQmlConnections::connectSignals()
d->boundsignals += signal;
} else {
if (!d->ignoreUnknownSignals)
- qmlInfo(this) << tr("Cannot assign to non-existent property \"%1\"").arg(propName);
+ qmlWarning(this) << tr("Cannot assign to non-existent property \"%1\"").arg(propName);
}
}
}
diff --git a/src/qml/types/qqmldelegatemodel.cpp b/src/qml/types/qqmldelegatemodel.cpp
index be10b270ae..c0d75cae33 100644
--- a/src/qml/types/qqmldelegatemodel.cpp
+++ b/src/qml/types/qqmldelegatemodel.cpp
@@ -264,7 +264,7 @@ QQmlDelegateModel::~QQmlDelegateModel()
{
Q_D(QQmlDelegateModel);
- foreach (QQmlDelegateModelItem *cacheItem, d->m_cache) {
+ for (QQmlDelegateModelItem *cacheItem : qAsConst(d->m_cache)) {
if (cacheItem->object) {
delete cacheItem->object;
@@ -310,7 +310,7 @@ void QQmlDelegateModel::componentComplete()
--d->m_groupCount;
--i;
} else if (name.at(0).isUpper()) {
- qmlInfo(d->m_groups[i]) << QQmlDelegateModelGroup::tr("Group names must start with a lower case letter");
+ qmlWarning(d->m_groups[i]) << QQmlDelegateModelGroup::tr("Group names must start with a lower case letter");
d->m_groups[i] = d->m_groups[d->m_groupCount - 1];
--d->m_groupCount;
--i;
@@ -404,7 +404,7 @@ void QQmlDelegateModel::setDelegate(QQmlComponent *delegate)
{
Q_D(QQmlDelegateModel);
if (d->m_transaction) {
- qmlInfo(this) << tr("The delegate of a DelegateModel cannot be changed within onUpdated.");
+ qmlWarning(this) << tr("The delegate of a DelegateModel cannot be changed within onUpdated.");
return;
}
bool wasValid = d->m_delegate != 0;
@@ -610,7 +610,7 @@ void QQmlDelegateModelPrivate::group_append(
if (d->m_complete)
return;
if (d->m_groupCount == Compositor::MaximumGroupCount) {
- qmlInfo(d->q_func()) << QQmlDelegateModel::tr("The maximum number of supported DelegateModelGroups is 8");
+ qmlWarning(d->q_func()) << QQmlDelegateModel::tr("The maximum number of supported DelegateModelGroups is 8");
return;
}
d->m_groups[d->m_groupCount] = group;
@@ -719,7 +719,7 @@ void QQmlDelegateModel::setFilterGroup(const QString &group)
Q_D(QQmlDelegateModel);
if (d->m_transaction) {
- qmlInfo(this) << tr("The group of a DelegateModel cannot be changed within onChanged");
+ qmlWarning(this) << tr("The group of a DelegateModel cannot be changed within onChanged");
return;
}
@@ -764,7 +764,8 @@ void QQmlDelegateModelPrivate::updateFilterGroup()
emit q->countChanged();
if (m_parts) {
- foreach (QQmlPartsModel *model, m_parts->models)
+ auto partsCopy = m_parts->models; // deliberate; this may alter m_parts
+ for (QQmlPartsModel *model : qAsConst(partsCopy))
model->updateFilterGroup(m_compositorGroup, changeSet);
}
}
@@ -889,7 +890,7 @@ void QQmlDelegateModelPrivate::incubatorStatusChanged(QQDMIncubationTask *incuba
emitCreatedItem(incubationTask, cacheItem->object);
cacheItem->releaseObject();
} else if (status == QQmlIncubator::Error) {
- qmlInfo(q, m_delegate->errors()) << "Error creating delegate";
+ qmlWarning(q, m_delegate->errors()) << "Error creating delegate";
}
if (!cacheItem->isObjectReferenced()) {
@@ -1472,7 +1473,8 @@ void QQmlDelegateModelPrivate::emitChanges()
for (int i = 1; i < m_groupCount; ++i)
QQmlDelegateModelGroupPrivate::get(m_groups[i])->emitModelUpdated(reset);
- foreach (QQmlDelegateModelItem *cacheItem, m_cache) {
+ auto cacheCopy = m_cache; // deliberate; emitChanges may alter m_cache
+ for (QQmlDelegateModelItem *cacheItem : qAsConst(cacheCopy)) {
if (cacheItem->attached)
cacheItem->attached->emitChanges();
}
@@ -2459,7 +2461,7 @@ QQmlV4Handle QQmlDelegateModelGroup::get(int index)
if (!model->m_context || !model->m_context->isValid()) {
return QQmlV4Handle(QV4::Encode::undefined());
} else if (index < 0 || index >= model->m_compositor.count(d->group)) {
- qmlInfo(this) << tr("get: index out of range");
+ qmlWarning(this) << tr("get: index out of range");
return QQmlV4Handle(QV4::Encode::undefined());
}
@@ -2552,7 +2554,7 @@ void QQmlDelegateModelGroup::insert(QQmlV4Function *args)
QV4::ScopedValue v(scope, (*args)[i]);
if (d->parseIndex(v, &index, &group)) {
if (index < 0 || index > model->m_compositor.count(group)) {
- qmlInfo(this) << tr("insert: index out of range");
+ qmlWarning(this) << tr("insert: index out of range");
return;
}
if (++i == args->length())
@@ -2637,7 +2639,7 @@ void QQmlDelegateModelGroup::create(QQmlV4Function *args)
}
}
if (index < 0 || index >= model->m_compositor.count(group)) {
- qmlInfo(this) << tr("create: index out of range");
+ qmlWarning(this) << tr("create: index out of range");
return;
}
@@ -2690,22 +2692,22 @@ void QQmlDelegateModelGroup::resolve(QQmlV4Function *args)
QV4::ScopedValue v(scope, (*args)[0]);
if (d->parseIndex(v, &from, &fromGroup)) {
if (from < 0 || from >= model->m_compositor.count(fromGroup)) {
- qmlInfo(this) << tr("resolve: from index out of range");
+ qmlWarning(this) << tr("resolve: from index out of range");
return;
}
} else {
- qmlInfo(this) << tr("resolve: from index invalid");
+ qmlWarning(this) << tr("resolve: from index invalid");
return;
}
v = (*args)[1];
if (d->parseIndex(v, &to, &toGroup)) {
if (to < 0 || to >= model->m_compositor.count(toGroup)) {
- qmlInfo(this) << tr("resolve: to index out of range");
+ qmlWarning(this) << tr("resolve: to index out of range");
return;
}
} else {
- qmlInfo(this) << tr("resolve: to index invalid");
+ qmlWarning(this) << tr("resolve: to index invalid");
return;
}
@@ -2713,11 +2715,11 @@ void QQmlDelegateModelGroup::resolve(QQmlV4Function *args)
Compositor::iterator toIt = model->m_compositor.find(toGroup, to);
if (!fromIt->isUnresolved()) {
- qmlInfo(this) << tr("resolve: from is not an unresolved item");
+ qmlWarning(this) << tr("resolve: from is not an unresolved item");
return;
}
if (!toIt->list) {
- qmlInfo(this) << tr("resolve: to is not a model item");
+ qmlWarning(this) << tr("resolve: to is not a model item");
return;
}
@@ -2787,7 +2789,7 @@ void QQmlDelegateModelGroup::remove(QQmlV4Function *args)
QV4::Scope scope(args->v4engine());
QV4::ScopedValue v(scope, (*args)[0]);
if (!d->parseIndex(v, &index, &group)) {
- qmlInfo(this) << tr("remove: invalid index");
+ qmlWarning(this) << tr("remove: invalid index");
return;
}
@@ -2799,11 +2801,11 @@ void QQmlDelegateModelGroup::remove(QQmlV4Function *args)
QQmlDelegateModelPrivate *model = QQmlDelegateModelPrivate::get(d->model);
if (index < 0 || index >= model->m_compositor.count(group)) {
- qmlInfo(this) << tr("remove: index out of range");
+ qmlWarning(this) << tr("remove: index out of range");
} else if (count != 0) {
Compositor::iterator it = model->m_compositor.find(group, index);
if (count < 0 || count > model->m_compositor.count(d->group) - it.index[d->group]) {
- qmlInfo(this) << tr("remove: invalid count");
+ qmlWarning(this) << tr("remove: invalid count");
} else {
model->removeGroups(it, count, d->group, 1 << d->group);
}
@@ -2858,11 +2860,11 @@ void QQmlDelegateModelGroup::addGroups(QQmlV4Function *args)
QQmlDelegateModelPrivate *model = QQmlDelegateModelPrivate::get(d->model);
if (index < 0 || index >= model->m_compositor.count(group)) {
- qmlInfo(this) << tr("addGroups: index out of range");
+ qmlWarning(this) << tr("addGroups: index out of range");
} else if (count != 0) {
Compositor::iterator it = model->m_compositor.find(group, index);
if (count < 0 || count > model->m_compositor.count(d->group) - it.index[d->group]) {
- qmlInfo(this) << tr("addGroups: invalid count");
+ qmlWarning(this) << tr("addGroups: invalid count");
} else {
model->addGroups(it, count, d->group, groups);
}
@@ -2888,11 +2890,11 @@ void QQmlDelegateModelGroup::removeGroups(QQmlV4Function *args)
QQmlDelegateModelPrivate *model = QQmlDelegateModelPrivate::get(d->model);
if (index < 0 || index >= model->m_compositor.count(group)) {
- qmlInfo(this) << tr("removeGroups: index out of range");
+ qmlWarning(this) << tr("removeGroups: index out of range");
} else if (count != 0) {
Compositor::iterator it = model->m_compositor.find(group, index);
if (count < 0 || count > model->m_compositor.count(d->group) - it.index[d->group]) {
- qmlInfo(this) << tr("removeGroups: invalid count");
+ qmlWarning(this) << tr("removeGroups: invalid count");
} else {
model->removeGroups(it, count, d->group, groups);
}
@@ -2918,11 +2920,11 @@ void QQmlDelegateModelGroup::setGroups(QQmlV4Function *args)
QQmlDelegateModelPrivate *model = QQmlDelegateModelPrivate::get(d->model);
if (index < 0 || index >= model->m_compositor.count(group)) {
- qmlInfo(this) << tr("setGroups: index out of range");
+ qmlWarning(this) << tr("setGroups: index out of range");
} else if (count != 0) {
Compositor::iterator it = model->m_compositor.find(group, index);
if (count < 0 || count > model->m_compositor.count(d->group) - it.index[d->group]) {
- qmlInfo(this) << tr("setGroups: invalid count");
+ qmlWarning(this) << tr("setGroups: invalid count");
} else {
model->setGroups(it, count, d->group, groups);
}
@@ -2957,13 +2959,13 @@ void QQmlDelegateModelGroup::move(QQmlV4Function *args)
QV4::Scope scope(args->v4engine());
QV4::ScopedValue v(scope, (*args)[0]);
if (!d->parseIndex(v, &from, &fromGroup)) {
- qmlInfo(this) << tr("move: invalid from index");
+ qmlWarning(this) << tr("move: invalid from index");
return;
}
v = (*args)[1];
if (!d->parseIndex(v, &to, &toGroup)) {
- qmlInfo(this) << tr("move: invalid to index");
+ qmlWarning(this) << tr("move: invalid to index");
return;
}
@@ -2976,11 +2978,11 @@ void QQmlDelegateModelGroup::move(QQmlV4Function *args)
QQmlDelegateModelPrivate *model = QQmlDelegateModelPrivate::get(d->model);
if (count < 0) {
- qmlInfo(this) << tr("move: invalid count");
+ qmlWarning(this) << tr("move: invalid count");
} else if (from < 0 || from + count > model->m_compositor.count(fromGroup)) {
- qmlInfo(this) << tr("move: from index out of range");
+ qmlWarning(this) << tr("move: from index out of range");
} else if (!model->m_compositor.verifyMoveTo(fromGroup, from, toGroup, to, count, d->group)) {
- qmlInfo(this) << tr("move: to index out of range");
+ qmlWarning(this) << tr("move: to index out of range");
} else if (count > 0) {
QVector<Compositor::Remove> removes;
QVector<Compositor::Insert> inserts;
@@ -3038,7 +3040,7 @@ QString QQmlPartsModel::filterGroup() const
void QQmlPartsModel::setFilterGroup(const QString &group)
{
if (QQmlDelegateModelPrivate::get(m_model)->m_transaction) {
- qmlInfo(this) << tr("The group of a DelegateModel cannot be changed within onChanged");
+ qmlWarning(this) << tr("The group of a DelegateModel cannot be changed within onChanged");
return;
}
@@ -3151,7 +3153,7 @@ QObject *QQmlPartsModel::object(int index, bool asynchronous)
model->release(object);
if (!model->m_delegateValidated) {
if (object)
- qmlInfo(model->m_delegate) << tr("Delegate component must be Package type.");
+ qmlWarning(model->m_delegate) << tr("Delegate component must be Package type.");
model->m_delegateValidated = true;
}
diff --git a/src/qml/types/qqmllistmodel.cpp b/src/qml/types/qqmllistmodel.cpp
index 1a2e4c7f6f..cc4ccbaeb1 100644
--- a/src/qml/types/qqmllistmodel.cpp
+++ b/src/qml/types/qqmllistmodel.cpp
@@ -99,7 +99,7 @@ const ListLayout::Role &ListLayout::getRoleOrCreate(const QString &key, Role::Da
if (node) {
const Role &r = *node->value;
if (type != r.type)
- qmlInfo(0) << QStringLiteral("Can't assign to existing role '%1' of different type [%2 -> %3]").arg(r.name).arg(roleTypeName(type)).arg(roleTypeName(r.type));
+ qmlWarning(0) << QStringLiteral("Can't assign to existing role '%1' of different type [%2 -> %3]").arg(r.name).arg(roleTypeName(type)).arg(roleTypeName(r.type));
return r;
}
@@ -112,7 +112,7 @@ const ListLayout::Role &ListLayout::getRoleOrCreate(QV4::String *key, Role::Data
if (node) {
const Role &r = *node->value;
if (type != r.type)
- qmlInfo(0) << QStringLiteral("Can't assign to existing role '%1' of different type [%2 -> %3]").arg(r.name).arg(roleTypeName(type)).arg(roleTypeName(r.type));
+ qmlWarning(0) << QStringLiteral("Can't assign to existing role '%1' of different type [%2 -> %3]").arg(r.name).arg(roleTypeName(type)).arg(roleTypeName(r.type));
return r;
}
@@ -226,7 +226,7 @@ const ListLayout::Role *ListLayout::getRoleOrCreate(const QString &key, const QV
}
if (type == Role::Invalid) {
- qmlInfo(0) << "Can't create role for unsupported data type";
+ qmlWarning(0) << "Can't create role for unsupported data type";
return 0;
}
@@ -1201,7 +1201,7 @@ int ListElement::setJsProperty(const ListLayout::Role &role, const QV4::Value &d
}
roleIndex = setListProperty(role, subModel);
} else {
- qmlInfo(0) << QStringLiteral("Can't assign to existing role '%1' of different type [%2 -> %3]").arg(role.name).arg(roleTypeName(role.type)).arg(roleTypeName(ListLayout::Role::List));
+ qmlWarning(0) << QStringLiteral("Can't assign to existing role '%1' of different type [%2 -> %3]").arg(role.name).arg(roleTypeName(role.type)).arg(roleTypeName(ListLayout::Role::List));
}
} else if (d.isBoolean()) {
roleIndex = setBoolProperty(role, d.booleanValue());
@@ -1267,10 +1267,12 @@ void ModelNodeMetaObject::updateValues()
{
const int roleCount = m_model->m_listModel->roleCount();
if (!m_initialized) {
- int *changedRoles = reinterpret_cast<int *>(alloca(roleCount * sizeof(int)));
- for (int i = 0; i < roleCount; ++i)
- changedRoles[i] = i;
- emitDirectNotifies(changedRoles, roleCount);
+ if (roleCount) {
+ int *changedRoles = reinterpret_cast<int *>(alloca(roleCount * sizeof(int)));
+ for (int i = 0; i < roleCount; ++i)
+ changedRoles[i] = i;
+ emitDirectNotifies(changedRoles, roleCount);
+ }
return;
}
for (int i=0 ; i < roleCount ; ++i) {
@@ -1984,18 +1986,18 @@ void QQmlListModel::setDynamicRoles(bool enableDynamicRoles)
if (m_mainThread && m_agent == 0) {
if (enableDynamicRoles) {
if (m_layout->roleCount())
- qmlInfo(this) << tr("unable to enable dynamic roles as this model is not empty!");
+ qmlWarning(this) << tr("unable to enable dynamic roles as this model is not empty!");
else
m_dynamicRoles = true;
} else {
if (m_roles.count()) {
- qmlInfo(this) << tr("unable to enable static roles as this model is not empty!");
+ qmlWarning(this) << tr("unable to enable static roles as this model is not empty!");
} else {
m_dynamicRoles = false;
}
}
} else {
- qmlInfo(this) << tr("dynamic role setting must be made from the main thread, before any worker scripts are created");
+ qmlWarning(this) << tr("dynamic role setting must be made from the main thread, before any worker scripts are created");
}
}
@@ -2048,7 +2050,7 @@ void QQmlListModel::remove(QQmlV4Function *args)
int removeCount = (argLength == 2 ? QV4::ScopedValue(scope, (*args)[1])->toInt32() : 1);
if (index < 0 || index+removeCount > count() || removeCount <= 0) {
- qmlInfo(this) << tr("remove: indices [%1 - %2] out of range [0 - %3]").arg(index).arg(index+removeCount).arg(count());
+ qmlWarning(this) << tr("remove: indices [%1 - %2] out of range [0 - %3]").arg(index).arg(index+removeCount).arg(count());
return;
}
@@ -2064,7 +2066,7 @@ void QQmlListModel::remove(QQmlV4Function *args)
emitItemsRemoved(index, removeCount);
} else {
- qmlInfo(this) << tr("remove: incorrect number of arguments");
+ qmlWarning(this) << tr("remove: incorrect number of arguments");
}
}
@@ -2092,7 +2094,7 @@ void QQmlListModel::insert(QQmlV4Function *args)
int index = arg0->toInt32();
if (index < 0 || index > count()) {
- qmlInfo(this) << tr("insert: index %1 out of range").arg(index);
+ qmlWarning(this) << tr("insert: index %1 out of range").arg(index);
return;
}
@@ -2124,10 +2126,10 @@ void QQmlListModel::insert(QQmlV4Function *args)
emitItemsInserted(index, 1);
} else {
- qmlInfo(this) << tr("insert: value is not an object");
+ qmlWarning(this) << tr("insert: value is not an object");
}
} else {
- qmlInfo(this) << tr("insert: value is not an object");
+ qmlWarning(this) << tr("insert: value is not an object");
}
}
@@ -2150,7 +2152,7 @@ void QQmlListModel::move(int from, int to, int n)
if (n==0 || from==to)
return;
if (!canMove(from, to, n)) {
- qmlInfo(this) << tr("move: out of range");
+ qmlWarning(this) << tr("move: out of range");
return;
}
@@ -2239,10 +2241,10 @@ void QQmlListModel::append(QQmlV4Function *args)
emitItemsInserted(index, 1);
} else {
- qmlInfo(this) << tr("append: value is not an object");
+ qmlWarning(this) << tr("append: value is not an object");
}
} else {
- qmlInfo(this) << tr("append: value is not an object");
+ qmlWarning(this) << tr("append: value is not an object");
}
}
@@ -2321,11 +2323,11 @@ void QQmlListModel::set(int index, const QQmlV4Handle &handle)
QV4::ScopedObject object(scope, handle);
if (!object) {
- qmlInfo(this) << tr("set: value is not an object");
+ qmlWarning(this) << tr("set: value is not an object");
return;
}
if (index > count() || index < 0) {
- qmlInfo(this) << tr("set: index %1 out of range").arg(index);
+ qmlWarning(this) << tr("set: index %1 out of range").arg(index);
return;
}
@@ -2371,7 +2373,7 @@ void QQmlListModel::set(int index, const QQmlV4Handle &handle)
void QQmlListModel::setProperty(int index, const QString& property, const QVariant& value)
{
if (count() == 0 || index >= count() || index < 0) {
- qmlInfo(this) << tr("set: index %1 out of range").arg(index);
+ qmlWarning(this) << tr("set: index %1 out of range").arg(index);
return;
}
@@ -2401,7 +2403,7 @@ void QQmlListModel::sync()
// This is just a dummy method to make it look like sync() exists in
// ListModel (and not just QQmlListModelWorkerAgent) and to let
// us document sync().
- qmlInfo(this) << "List sync() can only be called from a WorkerScript";
+ qmlWarning(this) << "List sync() can only be called from a WorkerScript";
}
bool QQmlListModelParser::verifyProperty(const QV4::CompiledData::Unit *qmlUnit, const QV4::CompiledData::Binding *binding)
@@ -2543,7 +2545,7 @@ void QQmlListModelParser::applyBindings(QObject *obj, QV4::CompiledData::Compila
}
if (setRoles == false)
- qmlInfo(obj) << "All ListElement declarations are empty, no roles can be created unless dynamicRoles is set.";
+ qmlWarning(obj) << "All ListElement declarations are empty, no roles can be created unless dynamicRoles is set.";
}
bool QQmlListModelParser::definesEmptyList(const QString &s)
diff --git a/src/qml/types/qqmlobjectmodel.cpp b/src/qml/types/qqmlobjectmodel.cpp
index 695043b592..21205f4490 100644
--- a/src/qml/types/qqmlobjectmodel.cpp
+++ b/src/qml/types/qqmlobjectmodel.cpp
@@ -373,7 +373,7 @@ void QQmlObjectModel::insert(int index, QObject *object)
{
Q_D(QQmlObjectModel);
if (index < 0 || index > count()) {
- qmlInfo(this) << tr("insert: index %1 out of range").arg(index);
+ qmlWarning(this) << tr("insert: index %1 out of range").arg(index);
return;
}
d->insert(index, object);
@@ -400,7 +400,7 @@ void QQmlObjectModel::move(int from, int to, int n)
if (n <= 0 || from == to)
return;
if (from < 0 || to < 0 || from + n > count() || to + n > count()) {
- qmlInfo(this) << tr("move: out of range");
+ qmlWarning(this) << tr("move: out of range");
return;
}
d->move(from, to, n);
@@ -418,7 +418,7 @@ void QQmlObjectModel::remove(int index, int n)
{
Q_D(QQmlObjectModel);
if (index < 0 || n <= 0 || index + n > count()) {
- qmlInfo(this) << tr("remove: indices [%1 - %2] out of range [0 - %3]").arg(index).arg(index+n).arg(count());
+ qmlWarning(this) << tr("remove: indices [%1 - %2] out of range [0 - %3]").arg(index).arg(index+n).arg(count());
return;
}
d->remove(index, n);
diff --git a/src/qmltest/quicktest.cpp b/src/qmltest/quicktest.cpp
index 70733da121..f62f66170e 100644
--- a/src/qmltest/quicktest.cpp
+++ b/src/qmltest/quicktest.cpp
@@ -373,9 +373,6 @@ int quick_test_main(int argc, char **argv, const char *name, const char *sourceD
// and then wait for quit indication.
view->setFramePosition(QPoint(50, 50));
if (view->size().isEmpty()) { // Avoid hangs with empty windows.
- qWarning().nospace()
- << "Test '" << QDir::toNativeSeparators(path) << "' has invalid size "
- << view->size() << ", resizing.";
view->resize(200, 200);
}
view->show();
diff --git a/src/quick/doc/images/qml-localstorage-example.png b/src/quick/doc/images/qml-localstorage-example.png
index e128574683..64e1cb0315 100644
--- a/src/quick/doc/images/qml-localstorage-example.png
+++ b/src/quick/doc/images/qml-localstorage-example.png
Binary files differ
diff --git a/src/quick/doc/images/touchpoint-metrics.png b/src/quick/doc/images/touchpoint-metrics.png
new file mode 100644
index 0000000000..9b0bf22e25
--- /dev/null
+++ b/src/quick/doc/images/touchpoint-metrics.png
Binary files differ
diff --git a/src/quick/doc/snippets/qml/listview/listview.qml b/src/quick/doc/snippets/qml/listview/listview.qml
index 31896626a4..ecb5fea076 100644
--- a/src/quick/doc/snippets/qml/listview/listview.qml
+++ b/src/quick/doc/snippets/qml/listview/listview.qml
@@ -146,4 +146,19 @@ ListView {
}
//![isCurrentItem]
+//![flickBothDirections]
+ListView {
+ width: 180; height: 200
+
+ contentWidth: 320
+ flickableDirection: Flickable.AutoFlickDirection
+
+ model: ContactModel {}
+ delegate: Row {
+ Text { text: '<b>Name:</b> ' + name; width: 160 }
+ Text { text: '<b>Number:</b> ' + number; width: 160 }
+ }
+}
+//![flickBothDirections]
+
}
diff --git a/src/quick/doc/snippets/qml/localstorage/dbtransaction.js b/src/quick/doc/snippets/qml/localstorage/dbtransaction.js
index 40eb6d2804..38733a8e2c 100644
--- a/src/quick/doc/snippets/qml/localstorage/dbtransaction.js
+++ b/src/quick/doc/snippets/qml/localstorage/dbtransaction.js
@@ -43,11 +43,11 @@ var db = LocalStorage.openDatabaseSync("ActivityTrackDB", "", "Database tracking
db.transaction(
try {
function(tx) {
- tx.executeSql('INSERT INTO trip_log VALUES(?, ?, ?)',
- [ '01/10/2016','Sylling - Vikersund', '53' ]);
+ tx.executeSql("INSERT INTO trip_log VALUES(?, ?, ?)",
+ [ "01/10/2016","Sylling - Vikersund", "53" ]);
}
} catch (err) {
- console.log("Error inserting into table Greeting: " + err);
+ console.log("Error inserting into table trip_log: " + err);
}
)
//![0]
@@ -60,11 +60,11 @@ function db_distance_select(Pdistance)
var db = LocalStorage.openDatabaseSync("ActivityTrackDB", "", "Database tracking sports activities", 1000000);
db.transaction(
function(tx) {
- var results = tx.executeSql('SELECT rowid,
+ var results = tx.executeSql("SELECT rowid,
date,
trip_desc,
distance FROM trip_log
- where distance >= ?',[Pdistance]');
+ where distance >= ?",[Pdistance]);
for (var i = 0; i < results.rows.length; i++) {
listModel.append({"id": results.rows.item(i).rowid,
"date": results.rows.item(i).date,
@@ -76,10 +76,22 @@ db.transaction(
//![1]
//![2]
var db = LocalStorage.openDatabaseSync("ActivityTrackDB", "", "Database tracking sports activities", 1000000);
-if (db.version == '0.1') {
- db.changeVersion('0.1', '0.2', function(tx) {
- tx.executeSql('INSERT INTO trip_log VALUES(?, ?, ?)',
- [ '01/10/2016','Sylling - Vikersund', '53' ]);
+if (db.version == "0.1") {
+ db.changeVersion("0.1", "0.2", function(tx) {
+ tx.executeSql("INSERT INTO trip_log VALUES(?, ?, ?)",
+ [ "01/10/2016","Sylling - Vikersund", "53" ]);
}
});
//![2]
+//![3]
+create table trip_log(date text, data text)
+//![3]
+//![4]
+var obj = {description = "Vikersund - Noresund", distance = "60"}
+//![4]
+//![5]
+db.transaction(function(tx) {
+ result = tx.executeSQL("insert into trip_log values (?,?)",
+ ["01/11/2016", JSON.stringify(obj)])
+}
+//![5]
diff --git a/src/quick/items/checksync.pl b/src/quick/items/checksync.pl
deleted file mode 100755
index c9771bb10c..0000000000
--- a/src/quick/items/checksync.pl
+++ /dev/null
@@ -1,106 +0,0 @@
-#!/usr/bin/perl
-#############################################################################
-##
-## Copyright (C) 2016 The Qt Company Ltd.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of the Declarative 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 The Qt Company. For licensing terms
-## and conditions see https://www.qt.io/terms-conditions. For further
-## information use the contact form at https://www.qt.io/contact-us.
-##
-## GNU Lesser General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU Lesser
-## General Public License version 3 as published by the Free Software
-## Foundation and appearing in the file LICENSE.LGPL3 included in the
-## packaging of this file. Please review the following information to
-## ensure the GNU Lesser General Public License version 3 requirements
-## will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-##
-## GNU General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU
-## General Public License version 2.0 or (at your option) the GNU General
-## Public license version 3 or any later version approved by the KDE Free
-## Qt Foundation. The licenses are as published by the Free Software
-## Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-## included in the packaging of this file. Please review the following
-## information to ensure the GNU General Public License requirements will
-## be met: https://www.gnu.org/licenses/gpl-2.0.html and
-## https://www.gnu.org/licenses/gpl-3.0.html.
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-use strict;
-use warnings;
-
-die "Usage: $0 <QML directory>" if (@ARGV != 1);
-
-my @excludes;
-open (SYNCEXCLUDES, "<", "syncexcludes");
-while (<SYNCEXCLUDES>) {
- if (/^([a-zA-Z0-9\._]+)/) {
- my $exclude = $1;
- push (@excludes, $exclude);
- }
-}
-
-my $portdir = ".";
-my $qmldir = $ARGV[0];
-
-opendir (PORTDIR, $portdir) or die "Cannot open port directory";
-opendir (QMLDIR, $qmldir) or die "Cannot open QML directory";
-
-my @portfiles = readdir(PORTDIR);
-my @qmlfiles = readdir(QMLDIR);
-
-closedir(PORTDIR);
-closedir(QMLDIR);
-
-foreach my $qmlfile (@qmlfiles) {
- if ($qmlfile =~ /^qdeclarative.*\.cpp$/ or $qmlfile =~ /qdeclarative.*\.h$/) {
-
- if (grep { $_ eq $qmlfile} @excludes) {
- next;
- }
-
- my $portfile = $qmlfile;
- $portfile =~ s/^qdeclarative/qsg/;
-
- if (grep { $_ eq $portfile} @portfiles) {
-
- open (PORTFILE, "<", "$portdir/$portfile") or die("Cannot open $portdir/$portfile for reading");
-
- my $firstline = <PORTFILE>;
-
- close (PORTFILE);
-
- if ($firstline and $firstline =~ /^\/\/ Commit: ([a-z0-9]+)/) {
- my $sha1 = $1;
- my $commitSha1 = "";
-
- my $output = `cd $qmldir; git log $qmlfile | head -n 1`;
- if ($output =~ /commit ([a-z0-9]+)/) {
- $commitSha1 = $1;
- }
-
- if ($commitSha1 eq $sha1) {
- print ("$portfile: OK\n");
- } else {
- print ("$portfile: OUT OF DATE\n");
- }
- } else {
- print ("$portfile: OUT OF DATE\n");
- }
- } else {
- print ("$portfile: MISSING\n");
- }
- }
-}
diff --git a/src/quick/items/context2d/qquickcanvasitem.cpp b/src/quick/items/context2d/qquickcanvasitem.cpp
index 78db92ba8a..b772ed97d2 100644
--- a/src/quick/items/context2d/qquickcanvasitem.cpp
+++ b/src/quick/items/context2d/qquickcanvasitem.cpp
@@ -354,7 +354,7 @@ void QQuickCanvasItem::setContextType(const QString &contextType)
return;
if (d->context) {
- qmlInfo(this) << "Canvas already initialized with a different context type";
+ qmlWarning(this) << "Canvas already initialized with a different context type";
return;
}
@@ -517,7 +517,7 @@ void QQuickCanvasItem::setRenderTarget(QQuickCanvasItem::RenderTarget target)
Q_D(QQuickCanvasItem);
if (d->renderTarget != target) {
if (d->context) {
- qmlInfo(this) << "Canvas:renderTarget not changeble once context is active.";
+ qmlWarning(this) << "Canvas:renderTarget not changeble once context is active.";
return;
}
@@ -561,7 +561,7 @@ void QQuickCanvasItem::setRenderStrategy(QQuickCanvasItem::RenderStrategy strate
Q_D(QQuickCanvasItem);
if (d->renderStrategy != strategy) {
if (d->context) {
- qmlInfo(this) << "Canvas:renderStrategy not changeable once context is active.";
+ qmlWarning(this) << "Canvas:renderStrategy not changeable once context is active.";
return;
}
d->renderStrategy = strategy;
@@ -766,7 +766,6 @@ QSGNode *QQuickCanvasItem::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData
if (!texture) {
delete node;
d->node = 0;
- delete d->nodeTexture;
d->nodeTexture = 0;
if (d->textureProvider) {
d->textureProvider->tex = 0;
@@ -840,13 +839,13 @@ void QQuickCanvasItem::getContext(QQmlV4Function *args)
QV4::Scope scope(args->v4engine());
QV4::ScopedString str(scope, (*args)[0]);
if (!str) {
- qmlInfo(this) << "getContext should be called with a string naming the required context type";
+ qmlWarning(this) << "getContext should be called with a string naming the required context type";
args->setReturnValue(QV4::Encode::null());
return;
}
if (!d->available) {
- qmlInfo(this) << "Unable to use getContext() at this time, please wait for available: true";
+ qmlWarning(this) << "Unable to use getContext() at this time, please wait for available: true";
args->setReturnValue(QV4::Encode::null());
return;
}
@@ -859,7 +858,7 @@ void QQuickCanvasItem::getContext(QQmlV4Function *args)
return;
}
- qmlInfo(this) << "Canvas already initialized with a different context type";
+ qmlWarning(this) << "Canvas already initialized with a different context type";
args->setReturnValue(QV4::Encode::null());
return;
}
@@ -882,7 +881,7 @@ void QQuickCanvasItem::requestAnimationFrame(QQmlV4Function *args)
QV4::Scope scope(args->v4engine());
QV4::ScopedFunctionObject f(scope, (*args)[0]);
if (!f) {
- qmlInfo(this) << "requestAnimationFrame should be called with an animation callback function";
+ qmlWarning(this) << "requestAnimationFrame should be called with an animation callback function";
args->setReturnValue(QV4::Encode::null());
return;
}
@@ -910,7 +909,7 @@ void QQuickCanvasItem::cancelRequestAnimationFrame(QQmlV4Function *args)
QV4::Scope scope(args->v4engine());
QV4::ScopedValue v(scope, (*args)[0]);
if (!v->isInteger()) {
- qmlInfo(this) << "cancelRequestAnimationFrame should be called with an animation callback id";
+ qmlWarning(this) << "cancelRequestAnimationFrame should be called with an animation callback id";
args->setReturnValue(QV4::Encode::null());
return;
}
diff --git a/src/quick/items/qquickanchors.cpp b/src/quick/items/qquickanchors.cpp
index 4162314cd3..c0bec7d716 100644
--- a/src/quick/items/qquickanchors.cpp
+++ b/src/quick/items/qquickanchors.cpp
@@ -214,7 +214,7 @@ void QQuickAnchorsPrivate::fillChanged()
--updatingFill;
} else {
// ### Make this certain :)
- qmlInfo(item) << QQuickAnchors::tr("Possible anchor loop detected on fill.");
+ qmlWarning(item) << QQuickAnchors::tr("Possible anchor loop detected on fill.");
}
}
@@ -243,7 +243,7 @@ void QQuickAnchorsPrivate::centerInChanged()
--updatingCenterIn;
} else {
// ### Make this certain :)
- qmlInfo(item) << QQuickAnchors::tr("Possible anchor loop detected on centerIn.");
+ qmlWarning(item) << QQuickAnchors::tr("Possible anchor loop detected on centerIn.");
}
}
@@ -529,7 +529,7 @@ void QQuickAnchors::setFill(QQuickItem *f)
return;
}
if (f != readParentItem(d->item) && readParentItem(f) != readParentItem(d->item)){
- qmlInfo(d->item) << tr("Cannot anchor to an item that isn't a parent or sibling.");
+ qmlWarning(d->item) << tr("Cannot anchor to an item that isn't a parent or sibling.");
return;
}
QQuickItem *oldFill = d->fill;
@@ -565,7 +565,7 @@ void QQuickAnchors::setCenterIn(QQuickItem* c)
return;
}
if (c != readParentItem(d->item) && readParentItem(c) != readParentItem(d->item)){
- qmlInfo(d->item) << tr("Cannot anchor to an item that isn't a parent or sibling.");
+ qmlWarning(d->item) << tr("Cannot anchor to an item that isn't a parent or sibling.");
return;
}
QQuickItem *oldCI = d->centerIn;
@@ -619,7 +619,7 @@ void QQuickAnchorsPrivate::updateVerticalAnchors()
if (Q_UNLIKELY(updatingVerticalAnchor > 1)) {
// ### Make this certain :)
- qmlInfo(item) << QQuickAnchors::tr("Possible anchor loop detected on vertical anchor.");
+ qmlWarning(item) << QQuickAnchors::tr("Possible anchor loop detected on vertical anchor.");
return;
}
@@ -794,7 +794,7 @@ void QQuickAnchorsPrivate::updateHorizontalAnchors()
--updatingHorizontalAnchor;
} else {
// ### Make this certain :)
- qmlInfo(item) << QQuickAnchors::tr("Possible anchor loop detected on horizontal anchor.");
+ qmlWarning(item) << QQuickAnchors::tr("Possible anchor loop detected on horizontal anchor.");
}
}
@@ -1329,7 +1329,7 @@ bool QQuickAnchorsPrivate::checkHValid() const
if (usedAnchors & QQuickAnchors::LeftAnchor &&
usedAnchors & QQuickAnchors::RightAnchor &&
usedAnchors & QQuickAnchors::HCenterAnchor) {
- qmlInfo(item) << QQuickAnchors::tr("Cannot specify left, right, and horizontalCenter anchors at the same time.");
+ qmlWarning(item) << QQuickAnchors::tr("Cannot specify left, right, and horizontalCenter anchors at the same time.");
return false;
}
@@ -1339,17 +1339,17 @@ bool QQuickAnchorsPrivate::checkHValid() const
bool QQuickAnchorsPrivate::checkHAnchorValid(QQuickAnchorLine anchor) const
{
if (!anchor.item) {
- qmlInfo(item) << QQuickAnchors::tr("Cannot anchor to a null item.");
+ qmlWarning(item) << QQuickAnchors::tr("Cannot anchor to a null item.");
return false;
} else if (anchor.anchorLine & QQuickAnchors::Vertical_Mask) {
- qmlInfo(item) << QQuickAnchors::tr("Cannot anchor a horizontal edge to a vertical edge.");
+ qmlWarning(item) << QQuickAnchors::tr("Cannot anchor a horizontal edge to a vertical edge.");
return false;
} else if (anchor.item != readParentItem(item)
&& readParentItem(anchor.item) != readParentItem(item)) {
- qmlInfo(item) << QQuickAnchors::tr("Cannot anchor to an item that isn't a parent or sibling.");
+ qmlWarning(item) << QQuickAnchors::tr("Cannot anchor to an item that isn't a parent or sibling.");
return false;
} else if (anchor.item == item) {
- qmlInfo(item) << QQuickAnchors::tr("Cannot anchor item to self.");
+ qmlWarning(item) << QQuickAnchors::tr("Cannot anchor item to self.");
return false;
}
@@ -1361,13 +1361,13 @@ bool QQuickAnchorsPrivate::checkVValid() const
if (usedAnchors & QQuickAnchors::TopAnchor &&
usedAnchors & QQuickAnchors::BottomAnchor &&
usedAnchors & QQuickAnchors::VCenterAnchor) {
- qmlInfo(item) << QQuickAnchors::tr("Cannot specify top, bottom, and verticalCenter anchors at the same time.");
+ qmlWarning(item) << QQuickAnchors::tr("Cannot specify top, bottom, and verticalCenter anchors at the same time.");
return false;
} else if (usedAnchors & QQuickAnchors::BaselineAnchor &&
(usedAnchors & QQuickAnchors::TopAnchor ||
usedAnchors & QQuickAnchors::BottomAnchor ||
usedAnchors & QQuickAnchors::VCenterAnchor)) {
- qmlInfo(item) << QQuickAnchors::tr("Baseline anchor cannot be used in conjunction with top, bottom, or verticalCenter anchors.");
+ qmlWarning(item) << QQuickAnchors::tr("Baseline anchor cannot be used in conjunction with top, bottom, or verticalCenter anchors.");
return false;
}
@@ -1377,17 +1377,17 @@ bool QQuickAnchorsPrivate::checkVValid() const
bool QQuickAnchorsPrivate::checkVAnchorValid(QQuickAnchorLine anchor) const
{
if (!anchor.item) {
- qmlInfo(item) << QQuickAnchors::tr("Cannot anchor to a null item.");
+ qmlWarning(item) << QQuickAnchors::tr("Cannot anchor to a null item.");
return false;
} else if (anchor.anchorLine & QQuickAnchors::Horizontal_Mask) {
- qmlInfo(item) << QQuickAnchors::tr("Cannot anchor a vertical edge to a horizontal edge.");
+ qmlWarning(item) << QQuickAnchors::tr("Cannot anchor a vertical edge to a horizontal edge.");
return false;
} else if (anchor.item != readParentItem(item)
&& readParentItem(anchor.item) != readParentItem(item)) {
- qmlInfo(item) << QQuickAnchors::tr("Cannot anchor to an item that isn't a parent or sibling.");
+ qmlWarning(item) << QQuickAnchors::tr("Cannot anchor to an item that isn't a parent or sibling.");
return false;
} else if (anchor.item == item){
- qmlInfo(item) << QQuickAnchors::tr("Cannot anchor item to self.");
+ qmlWarning(item) << QQuickAnchors::tr("Cannot anchor item to self.");
return false;
}
diff --git a/src/quick/items/qquickanimatedimage.cpp b/src/quick/items/qquickanimatedimage.cpp
index 81c649dbd5..a1833081c8 100644
--- a/src/quick/items/qquickanimatedimage.cpp
+++ b/src/quick/items/qquickanimatedimage.cpp
@@ -371,7 +371,7 @@ void QQuickAnimatedImage::movieRequestFinished()
#endif
if (!d->_movie->isValid()) {
- qmlInfo(this) << "Error Reading Animated Image File " << d->url.toString();
+ qmlWarning(this) << "Error Reading Animated Image File " << d->url.toString();
delete d->_movie;
d->_movie = 0;
d->setImage(QImage());
diff --git a/src/quick/items/qquickanimatedsprite.cpp b/src/quick/items/qquickanimatedsprite.cpp
index 8aeef4ef4a..76c2146ddb 100644
--- a/src/quick/items/qquickanimatedsprite.cpp
+++ b/src/quick/items/qquickanimatedsprite.cpp
@@ -626,7 +626,7 @@ QSGSpriteNode* QQuickAnimatedSprite::initNode()
Q_D(QQuickAnimatedSprite);
if (!d->m_spriteEngine) {
- qmlInfo(this) << "No sprite engine...";
+ qmlWarning(this) << "No sprite engine...";
return nullptr;
} else if (d->m_spriteEngine->status() == QQuickPixmap::Null) {
d->m_spriteEngine->startAssemblingImage();
diff --git a/src/quick/items/qquickborderimage.cpp b/src/quick/items/qquickborderimage.cpp
index 67b99bfbc6..28d834f9e2 100644
--- a/src/quick/items/qquickborderimage.cpp
+++ b/src/quick/items/qquickborderimage.cpp
@@ -515,7 +515,7 @@ void QQuickBorderImage::requestFinished()
QSize impsize = d->pix.implicitSize();
if (d->pix.isError()) {
d->status = Error;
- qmlInfo(this) << d->pix.error();
+ qmlWarning(this) << d->pix.error();
if (d->progress != 0) {
d->progress = 0;
emit progressChanged(d->progress);
diff --git a/src/quick/items/qquickdrag.cpp b/src/quick/items/qquickdrag.cpp
index 7a112e840a..e5969eed7f 100644
--- a/src/quick/items/qquickdrag.cpp
+++ b/src/quick/items/qquickdrag.cpp
@@ -307,7 +307,7 @@ void QQuickDragAttached::setActive(bool active)
Q_D(QQuickDragAttached);
if (d->active != active) {
if (d->inEvent)
- qmlInfo(this) << "active cannot be changed from within a drag event handler";
+ qmlWarning(this) << "active cannot be changed from within a drag event handler";
else if (active) {
if (d->dragType == QQuickDrag::Internal) {
d->start(d->supportedActions);
@@ -629,7 +629,7 @@ void QQuickDragAttached::start(QQmlV4Function *args)
{
Q_D(QQuickDragAttached);
if (d->inEvent) {
- qmlInfo(this) << "start() cannot be called from within a drag event handler";
+ qmlWarning(this) << "start() cannot be called from within a drag event handler";
return;
}
@@ -675,7 +675,7 @@ int QQuickDragAttached::drop()
Qt::DropAction acceptedAction = Qt::IgnoreAction;
if (d->inEvent) {
- qmlInfo(this) << "drop() cannot be called from within a drag event handler";
+ qmlWarning(this) << "drop() cannot be called from within a drag event handler";
return acceptedAction;
}
@@ -722,7 +722,7 @@ void QQuickDragAttached::cancel()
Q_D(QQuickDragAttached);
if (d->inEvent) {
- qmlInfo(this) << "cancel() cannot be called from within a drag event handler";
+ qmlWarning(this) << "cancel() cannot be called from within a drag event handler";
return;
}
@@ -809,12 +809,12 @@ void QQuickDragAttached::startDrag(QQmlV4Function *args)
Q_D(QQuickDragAttached);
if (d->inEvent) {
- qmlInfo(this) << "startDrag() cannot be called from within a drag event handler";
+ qmlWarning(this) << "startDrag() cannot be called from within a drag event handler";
return;
}
if (!d->active) {
- qmlInfo(this) << "startDrag() drag must be active";
+ qmlWarning(this) << "startDrag() drag must be active";
return;
}
diff --git a/src/quick/items/qquickevents.cpp b/src/quick/items/qquickevents.cpp
index 42588fd058..b6c45c40a8 100644
--- a/src/quick/items/qquickevents.cpp
+++ b/src/quick/items/qquickevents.cpp
@@ -137,6 +137,7 @@ Item {
\li Qt.AltModifier - An Alt key on the keyboard is pressed.
\li Qt.MetaModifier - A Meta key on the keyboard is pressed.
\li Qt.KeypadModifier - A keypad button is pressed.
+ \li Qt.GroupSwitchModifier - X11 only. A Mode_switch key on the keyboard is pressed.
\endlist
For example, to react to a Shift key + Enter key combination:
@@ -552,7 +553,7 @@ void QQuickEventTouchPoint::reset(const QTouchEvent::TouchPoint &tp, ulong times
QQuickEventPoint::reset(tp.state(), tp.scenePos(), tp.id(), timestamp);
m_rotation = tp.rotation();
m_pressure = tp.pressure();
-// m_uniqueId = tp.uniqueId();
+ m_uniqueId = tp.uniqueId();
}
/*!
diff --git a/src/quick/items/qquickevents_p_p.h b/src/quick/items/qquickevents_p_p.h
index 6179791413..7b281623fe 100644
--- a/src/quick/items/qquickevents_p_p.h
+++ b/src/quick/items/qquickevents_p_p.h
@@ -302,8 +302,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickEventTouchPoint : public QQuickEventPoint
Q_OBJECT
Q_PROPERTY(qreal rotation READ rotation)
Q_PROPERTY(qreal pressure READ pressure)
-// TODO rename to QPointingDeviceUniqueId
-// Q_PROPERTY(QPointerUniqueId uniqueId READ uniqueId)
+ Q_PROPERTY(QPointingDeviceUniqueId uniqueId READ uniqueId)
public:
QQuickEventTouchPoint(QQuickPointerTouchEvent *parent);
@@ -312,12 +311,12 @@ public:
qreal rotation() const { return m_rotation; }
qreal pressure() const { return m_pressure; }
-// QPointerUniqueId uniqueId() const { return m_uniqueId; }
+ QPointingDeviceUniqueId uniqueId() const { return m_uniqueId; }
private:
qreal m_rotation;
qreal m_pressure;
-// QPointerUniqueId m_uniqueId;
+ QPointingDeviceUniqueId m_uniqueId;
Q_DISABLE_COPY(QQuickEventTouchPoint)
};
@@ -451,7 +450,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPointerDevice : public QObject
Q_PROPERTY(int maximumTouchPoints READ maximumTouchPoints CONSTANT)
Q_PROPERTY(int buttonCount READ buttonCount CONSTANT)
Q_PROPERTY(QString name READ name CONSTANT)
- Q_PROPERTY(qint64 uniqueId READ uniqueId CONSTANT)
+ Q_PROPERTY(QPointingDeviceUniqueId uniqueId READ uniqueId CONSTANT)
public:
enum DeviceType {
@@ -498,7 +497,8 @@ public:
QQuickPointerDevice(DeviceType devType, PointerType pType, Capabilities caps, int maxPoints, int buttonCount, const QString &name, qint64 uniqueId = 0)
: m_deviceType(devType), m_pointerType(pType), m_capabilities(caps)
- , m_maximumTouchPoints(maxPoints), m_buttonCount(buttonCount), m_name(name), m_uniqueId(uniqueId), m_event(nullptr)
+ , m_maximumTouchPoints(maxPoints), m_buttonCount(buttonCount), m_name(name)
+ , m_uniqueId(QPointingDeviceUniqueId::fromNumericId(uniqueId)), m_event(nullptr)
{
if (m_deviceType == Mouse) {
m_event = new QQuickPointerMouseEvent;
@@ -517,7 +517,7 @@ public:
int maximumTouchPoints() const { return m_maximumTouchPoints; }
int buttonCount() const { return m_buttonCount; }
QString name() const { return m_name; }
- qint64 uniqueId() const { return m_uniqueId; }
+ QPointingDeviceUniqueId uniqueId() const { return m_uniqueId; }
QQuickPointerEvent *pointerEvent() const { return m_event; }
static QQuickPointerDevice *touchDevice(QTouchDevice *d);
@@ -532,7 +532,7 @@ private:
int m_maximumTouchPoints;
int m_buttonCount;
QString m_name;
- qint64 m_uniqueId;
+ QPointingDeviceUniqueId m_uniqueId;
// the device-specific event instance which is reused during event delivery
QQuickPointerEvent *m_event;
@@ -555,7 +555,7 @@ QML_DECLARE_TYPE(QQuickMouseEvent)
QML_DECLARE_TYPE(QQuickWheelEvent)
QML_DECLARE_TYPE(QQuickCloseEvent)
QML_DECLARE_TYPE(QQuickPointerDevice)
-//QML_DECLARE_TYPE(QPointerUniqueId)
+QML_DECLARE_TYPE(QPointingDeviceUniqueId)
QML_DECLARE_TYPE(QQuickPointerEvent)
#endif // QQUICKEVENTS_P_P_H
diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp
index 00a1306627..4ab604b30f 100644
--- a/src/quick/items/qquickflickable.cpp
+++ b/src/quick/items/qquickflickable.cpp
@@ -1570,12 +1570,52 @@ void QQuickFlickablePrivate::replayDelayedPress()
//XXX pixelAligned ignores the global position of the Flickable, i.e. assumes Flickable itself is pixel aligned.
void QQuickFlickablePrivate::setViewportX(qreal x)
{
- contentItem->setX(pixelAligned ? -Round(-x) : x);
+ Q_Q(QQuickFlickable);
+ if (pixelAligned)
+ x = -Round(-x);
+
+ contentItem->setX(x);
+ if (contentItem->x() != x)
+ return; // reentered
+
+ const qreal maxX = q->maxXExtent();
+ const qreal minX = q->minXExtent();
+
+ qreal overshoot = 0.0;
+ if (x <= maxX)
+ overshoot = maxX - x;
+ else if (x >= minX)
+ overshoot = minX - x;
+
+ if (overshoot != hData.overshoot) {
+ hData.overshoot = overshoot;
+ emit q->horizontalOvershootChanged();
+ }
}
void QQuickFlickablePrivate::setViewportY(qreal y)
{
- contentItem->setY(pixelAligned ? -Round(-y) : y);
+ Q_Q(QQuickFlickable);
+ if (pixelAligned)
+ y = -Round(-y);
+
+ contentItem->setY(y);
+ if (contentItem->y() != y)
+ return; // reentered
+
+ const qreal maxY = q->maxYExtent();
+ const qreal minY = q->minYExtent();
+
+ qreal overshoot = 0.0;
+ if (y <= maxY)
+ overshoot = maxY - y;
+ else if (y >= minY)
+ overshoot = minY - y;
+
+ if (overshoot != vData.overshoot) {
+ vData.overshoot = overshoot;
+ emit q->verticalOvershootChanged();
+ }
}
void QQuickFlickable::timerEvent(QTimerEvent *event)
@@ -1841,6 +1881,8 @@ QQmlListProperty<QQuickItem> QQuickFlickable::flickableChildren()
beyond the boundary of the Flickable, and can overshoot the
boundary when flicked.
\endlist
+
+ \sa horizontalOvershoot, verticalOvershoot
*/
QQuickFlickable::BoundsBehavior QQuickFlickable::boundsBehavior() const
{
@@ -2638,4 +2680,38 @@ void QQuickFlickablePrivate::updateVelocity()
emit q->verticalVelocityChanged();
}
+/*!
+ \qmlproperty real QtQuick::Flickable::horizontalOvershoot
+ \since 5.9
+
+ This property holds the horizontal overshoot, that is, the horizontal distance by
+ which the contents has been dragged or flicked past the bounds of the flickable.
+ The value is negative when the content is dragged or flicked beyond the beginning,
+ and positive when beyond the end; \c 0.0 otherwise.
+
+ \sa verticalOvershoot, boundsBehavior
+*/
+qreal QQuickFlickable::horizontalOvershoot() const
+{
+ Q_D(const QQuickFlickable);
+ return d->hData.overshoot;
+}
+
+/*!
+ \qmlproperty real QtQuick::Flickable::verticalOvershoot
+ \since 5.9
+
+ This property holds the vertical overshoot, that is, the vertical distance by
+ which the contents has been dragged or flicked past the bounds of the flickable.
+ The value is negative when the content is dragged or flicked beyond the beginning,
+ and positive when beyond the end; \c 0.0 otherwise.
+
+ \sa horizontalOvershoot, boundsBehavior
+*/
+qreal QQuickFlickable::verticalOvershoot() const
+{
+ Q_D(const QQuickFlickable);
+ return d->vData.overshoot;
+}
+
QT_END_NAMESPACE
diff --git a/src/quick/items/qquickflickable_p.h b/src/quick/items/qquickflickable_p.h
index 7384c7271a..52cade1472 100644
--- a/src/quick/items/qquickflickable_p.h
+++ b/src/quick/items/qquickflickable_p.h
@@ -106,12 +106,13 @@ class Q_QUICK_PRIVATE_EXPORT QQuickFlickable : public QQuickItem
Q_PROPERTY(bool pixelAligned READ pixelAligned WRITE setPixelAligned NOTIFY pixelAlignedChanged)
+ Q_PROPERTY(qreal horizontalOvershoot READ horizontalOvershoot NOTIFY horizontalOvershootChanged REVISION 9)
+ Q_PROPERTY(qreal verticalOvershoot READ verticalOvershoot NOTIFY verticalOvershootChanged REVISION 9)
+
Q_PROPERTY(QQmlListProperty<QObject> flickableData READ flickableData)
Q_PROPERTY(QQmlListProperty<QQuickItem> flickableChildren READ flickableChildren)
Q_CLASSINFO("DefaultProperty", "flickableData")
- Q_FLAGS(BoundsBehavior)
-
public:
QQuickFlickable(QQuickItem *parent=0);
~QQuickFlickable();
@@ -126,6 +127,7 @@ public:
DragAndOvershootBounds = DragOverBounds | OvershootBounds
};
Q_DECLARE_FLAGS(BoundsBehavior, BoundsBehaviorFlag)
+ Q_FLAG(BoundsBehavior)
BoundsBehavior boundsBehavior() const;
void setBoundsBehavior(BoundsBehavior);
@@ -201,6 +203,9 @@ public:
bool pixelAligned() const;
void setPixelAligned(bool align);
+ qreal horizontalOvershoot() const;
+ qreal verticalOvershoot() const;
+
Q_INVOKABLE void resizeContent(qreal w, qreal h, QPointF center);
Q_INVOKABLE void returnToBounds();
Q_INVOKABLE void flick(qreal xVelocity, qreal yVelocity);
@@ -243,6 +248,8 @@ Q_SIGNALS:
void dragStarted();
void dragEnded();
void pixelAlignedChanged();
+ Q_REVISION(9) void horizontalOvershootChanged();
+ Q_REVISION(9) void verticalOvershootChanged();
protected:
bool childMouseEventFilter(QQuickItem *, QEvent *) Q_DECL_OVERRIDE;
@@ -286,6 +293,7 @@ protected:
private:
Q_DISABLE_COPY(QQuickFlickable)
Q_DECLARE_PRIVATE(QQuickFlickable)
+ friend class QQuickFlickableContentItem;
friend class QQuickFlickableVisibleArea;
friend class QQuickFlickableReboundTransition;
};
diff --git a/src/quick/items/qquickflickable_p_p.h b/src/quick/items/qquickflickable_p_p.h
index 0c3bc21071..1ceff22dfc 100644
--- a/src/quick/items/qquickflickable_p_p.h
+++ b/src/quick/items/qquickflickable_p_p.h
@@ -101,7 +101,7 @@ public:
: move(fp, func)
, transitionToBounds(0)
, viewSize(-1), lastPos(0), previousDragDelta(0), velocity(0), startMargin(0), endMargin(0)
- , origin(0)
+ , origin(0), overshoot(0)
, transitionTo(0)
, continuousFlickVelocity(0), velocityTime(), vTime(0)
, smoothVelocity(fp), atEnd(false), atBeginning(true)
@@ -148,6 +148,7 @@ public:
qreal startMargin;
qreal endMargin;
qreal origin;
+ qreal overshoot;
qreal transitionTo;
qreal continuousFlickVelocity;
QElapsedTimer velocityTime;
diff --git a/src/quick/items/qquickflickablebehavior_p.h b/src/quick/items/qquickflickablebehavior_p.h
index 3377728d3f..ae7fe71359 100644
--- a/src/quick/items/qquickflickablebehavior_p.h
+++ b/src/quick/items/qquickflickablebehavior_p.h
@@ -75,20 +75,12 @@
// The default maximum velocity of a flick.
#ifndef QML_FLICK_DEFAULTMAXVELOCITY
-#ifdef Q_OS_BLACKBERRY
-#define QML_FLICK_DEFAULTMAXVELOCITY 10000
-#else
-#define QML_FLICK_DEFAULTMAXVELOCITY 2500
-#endif
+# define QML_FLICK_DEFAULTMAXVELOCITY 2500
#endif
// The default deceleration of a flick.
#ifndef QML_FLICK_DEFAULTDECELERATION
-#ifdef Q_OS_BLACKBERRY
-#define QML_FLICK_DEFAULTDECELERATION 5000
-#else
-#define QML_FLICK_DEFAULTDECELERATION 1500
-#endif
+# define QML_FLICK_DEFAULTDECELERATION 1500
#endif
// How much faster to decelerate when overshooting
diff --git a/src/quick/items/qquickflipable.cpp b/src/quick/items/qquickflipable.cpp
index 6a6b6c00a9..f452893528 100644
--- a/src/quick/items/qquickflipable.cpp
+++ b/src/quick/items/qquickflipable.cpp
@@ -153,7 +153,7 @@ void QQuickFlipable::setFront(QQuickItem *front)
{
Q_D(QQuickFlipable);
if (d->front) {
- qmlInfo(this) << tr("front is a write-once property");
+ qmlWarning(this) << tr("front is a write-once property");
return;
}
d->front = front;
@@ -175,7 +175,7 @@ void QQuickFlipable::setBack(QQuickItem *back)
{
Q_D(QQuickFlipable);
if (d->back) {
- qmlInfo(this) << tr("back is a write-once property");
+ qmlWarning(this) << tr("back is a write-once property");
return;
}
if (back == 0)
diff --git a/src/quick/items/qquickgridview.cpp b/src/quick/items/qquickgridview.cpp
index 14ea43f123..e6a7a0acd0 100644
--- a/src/quick/items/qquickgridview.cpp
+++ b/src/quick/items/qquickgridview.cpp
@@ -66,19 +66,19 @@ public:
{
}
- qreal position() const Q_DECL_OVERRIDE {
+ qreal position() const override {
return rowPos();
}
- qreal endPosition() const Q_DECL_OVERRIDE {
+ qreal endPosition() const override {
return endRowPos();
}
- qreal size() const Q_DECL_OVERRIDE {
+ qreal size() const override {
return view->flow() == QQuickGridView::FlowLeftToRight ? view->cellHeight() : view->cellWidth();
}
- qreal sectionSize() const Q_DECL_OVERRIDE {
+ qreal sectionSize() const override {
return 0.0;
}
@@ -122,7 +122,7 @@ public:
void setPosition(qreal col, qreal row, bool immediate = false) {
moveTo(pointForPosition(col, row), immediate);
}
- bool contains(qreal x, qreal y) const Q_DECL_OVERRIDE {
+ bool contains(qreal x, qreal y) const override {
return (x >= itemX() && x < itemX() + view->cellWidth() &&
y >= itemY() && y < itemY() + view->cellHeight());
}
@@ -159,13 +159,13 @@ class QQuickGridViewPrivate : public QQuickItemViewPrivate
Q_DECLARE_PUBLIC(QQuickGridView)
public:
- Qt::Orientation layoutOrientation() const Q_DECL_OVERRIDE;
- bool isContentFlowReversed() const Q_DECL_OVERRIDE;
+ Qt::Orientation layoutOrientation() const override;
+ bool isContentFlowReversed() const override;
- qreal positionAt(int index) const Q_DECL_OVERRIDE;
- qreal endPositionAt(int index) const Q_DECL_OVERRIDE;
- qreal originPosition() const Q_DECL_OVERRIDE;
- qreal lastPosition() const Q_DECL_OVERRIDE;
+ qreal positionAt(int index) const override;
+ qreal endPositionAt(int index) const override;
+ qreal originPosition() const override;
+ qreal lastPosition() const override;
qreal rowSize() const;
qreal colSize() const;
@@ -179,43 +179,43 @@ public:
void resetColumns();
- bool addVisibleItems(qreal fillFrom, qreal fillTo, qreal bufferFrom, qreal bufferTo, bool doBuffer) Q_DECL_OVERRIDE;
- bool removeNonVisibleItems(qreal bufferFrom, qreal bufferTo) Q_DECL_OVERRIDE;
+ bool addVisibleItems(qreal fillFrom, qreal fillTo, qreal bufferFrom, qreal bufferTo, bool doBuffer) override;
+ bool removeNonVisibleItems(qreal bufferFrom, qreal bufferTo) override;
void removeItem(FxViewItem *item);
- FxViewItem *newViewItem(int index, QQuickItem *item) Q_DECL_OVERRIDE;
- void initializeViewItem(FxViewItem *item) Q_DECL_OVERRIDE;
- void repositionItemAt(FxViewItem *item, int index, qreal sizeBuffer) Q_DECL_OVERRIDE;
- void repositionPackageItemAt(QQuickItem *item, int index) Q_DECL_OVERRIDE;
- void resetFirstItemPosition(qreal pos = 0.0) Q_DECL_OVERRIDE;
- void adjustFirstItem(qreal forwards, qreal backwards, int changeBeforeVisible) Q_DECL_OVERRIDE;
-
- void createHighlight() Q_DECL_OVERRIDE;
- void updateHighlight() Q_DECL_OVERRIDE;
- void resetHighlightPosition() Q_DECL_OVERRIDE;
-
- void setPosition(qreal pos) Q_DECL_OVERRIDE;
- void layoutVisibleItems(int fromModelIndex = 0) Q_DECL_OVERRIDE;
- bool applyInsertionChange(const QQmlChangeSet::Change &insert, ChangeResult *changeResult, QList<FxViewItem *> *addedItems, QList<MovedItem> *movingIntoView) Q_DECL_OVERRIDE;
- void translateAndTransitionItemsAfter(int afterModelIndex, const ChangeResult &insertionResult, const ChangeResult &removalResult) Q_DECL_OVERRIDE;
- bool needsRefillForAddedOrRemovedIndex(int index) const Q_DECL_OVERRIDE;
-
- qreal headerSize() const Q_DECL_OVERRIDE;
- qreal footerSize() const Q_DECL_OVERRIDE;
- bool showHeaderForIndex(int index) const Q_DECL_OVERRIDE;
- bool showFooterForIndex(int index) const Q_DECL_OVERRIDE;
- void updateHeader() Q_DECL_OVERRIDE;
- void updateFooter() Q_DECL_OVERRIDE;
-
- void changedVisibleIndex(int newIndex) Q_DECL_OVERRIDE;
- void initializeCurrentItem() Q_DECL_OVERRIDE;
-
- void updateViewport() Q_DECL_OVERRIDE;
- void fixupPosition() Q_DECL_OVERRIDE;
- void fixup(AxisData &data, qreal minExtent, qreal maxExtent) Q_DECL_OVERRIDE;
+ FxViewItem *newViewItem(int index, QQuickItem *item) override;
+ void initializeViewItem(FxViewItem *item) override;
+ void repositionItemAt(FxViewItem *item, int index, qreal sizeBuffer) override;
+ void repositionPackageItemAt(QQuickItem *item, int index) override;
+ void resetFirstItemPosition(qreal pos = 0.0) override;
+ void adjustFirstItem(qreal forwards, qreal backwards, int changeBeforeVisible) override;
+
+ void createHighlight() override;
+ void updateHighlight() override;
+ void resetHighlightPosition() override;
+
+ void setPosition(qreal pos) override;
+ void layoutVisibleItems(int fromModelIndex = 0) override;
+ bool applyInsertionChange(const QQmlChangeSet::Change &insert, ChangeResult *changeResult, QList<FxViewItem *> *addedItems, QList<MovedItem> *movingIntoView) override;
+ void translateAndTransitionItemsAfter(int afterModelIndex, const ChangeResult &insertionResult, const ChangeResult &removalResult) override;
+ bool needsRefillForAddedOrRemovedIndex(int index) const override;
+
+ qreal headerSize() const override;
+ qreal footerSize() const override;
+ bool showHeaderForIndex(int index) const override;
+ bool showFooterForIndex(int index) const override;
+ void updateHeader() override;
+ void updateFooter() override;
+
+ void changedVisibleIndex(int newIndex) override;
+ void initializeCurrentItem() override;
+
+ void updateViewport() override;
+ void fixupPosition() override;
+ void fixup(AxisData &data, qreal minExtent, qreal maxExtent) override;
bool flick(QQuickItemViewPrivate::AxisData &data, qreal minExtent, qreal maxExtent, qreal vSize,
- QQuickTimeLineCallback::Callback fixupCallback, qreal velocity) Q_DECL_OVERRIDE;
+ QQuickTimeLineCallback::Callback fixupCallback, qreal velocity) override;
QQuickGridView::Flow flow;
qreal cellWidth;
@@ -383,8 +383,7 @@ qreal QQuickGridViewPrivate::snapPosAt(qreal pos) const
FxViewItem *QQuickGridViewPrivate::snapItemAt(qreal pos) const
{
- for (int i = 0; i < visibleItems.count(); ++i) {
- FxViewItem *item = visibleItems.at(i);
+ for (FxViewItem *item : visibleItems) {
if (item->index == -1)
continue;
qreal itemTop = item->position();
@@ -397,16 +396,16 @@ FxViewItem *QQuickGridViewPrivate::snapItemAt(qreal pos) const
int QQuickGridViewPrivate::snapIndex() const
{
int index = currentIndex;
- for (int i = 0; i < visibleItems.count(); ++i) {
- FxGridItemSG *item = static_cast<FxGridItemSG*>(visibleItems.at(i));
+ for (FxViewItem *item : visibleItems) {
if (item->index == -1)
continue;
qreal itemTop = item->position();
FxGridItemSG *hItem = static_cast<FxGridItemSG*>(highlight);
if (itemTop >= hItem->rowPos()-rowSize()/2 && itemTop < hItem->rowPos()+rowSize()/2) {
- index = item->index;
- if (item->colPos() >= hItem->colPos()-colSize()/2 && item->colPos() < hItem->colPos()+colSize()/2)
- return item->index;
+ FxGridItemSG *gridItem = static_cast<FxGridItemSG*>(item);
+ index = gridItem->index;
+ if (gridItem->colPos() >= hItem->colPos()-colSize()/2 && gridItem->colPos() < hItem->colPos()+colSize()/2)
+ return gridItem->index;
}
}
return index;
@@ -496,8 +495,8 @@ bool QQuickGridViewPrivate::addVisibleItems(qreal fillFrom, qreal fillTo, qreal
// We've jumped more than a page. Estimate which items are now
// visible and fill from there.
int count = (fillFrom - (rowPos + rowSize())) / (rowSize()) * columns;
- for (int i = 0; i < visibleItems.count(); ++i)
- releaseItem(visibleItems.at(i));
+ for (FxViewItem *item : qAsConst(visibleItems))
+ releaseItem(item);
visibleItems.clear();
modelIndex += count;
if (modelIndex >= model->count())
@@ -2055,9 +2054,9 @@ void QQuickGridView::viewportMoved(Qt::Orientations orient)
// Set visibility of items to eliminate cost of items outside the visible area.
qreal from = d->isContentFlowReversed() ? -d->position()-d->displayMarginBeginning-d->size() : d->position()-d->displayMarginBeginning;
qreal to = d->isContentFlowReversed() ? -d->position()+d->displayMarginEnd : d->position()+d->size()+d->displayMarginEnd;
- for (int i = 0; i < d->visibleItems.count(); ++i) {
- FxGridItemSG *item = static_cast<FxGridItemSG*>(d->visibleItems.at(i));
- QQuickItemPrivate::get(item->item)->setCulled(item->rowPos() + d->rowSize() < from || item->rowPos() > to);
+ for (FxViewItem *item : qAsConst(d->visibleItems)) {
+ FxGridItemSG *gridItem = static_cast<FxGridItemSG*>(item);
+ QQuickItemPrivate::get(gridItem->item)->setCulled(gridItem->rowPos() + d->rowSize() < from || gridItem->rowPos() > to);
}
if (d->currentItem) {
FxGridItemSG *item = static_cast<FxGridItemSG*>(d->currentItem);
@@ -2357,8 +2356,7 @@ bool QQuickGridViewPrivate::applyInsertionChange(const QQmlChangeSet::Change &ch
if (modelIndex <= visibleIndex) {
// Insert before visible items
visibleIndex += count;
- for (int i = 0; i < visibleItems.count(); ++i) {
- FxViewItem *item = visibleItems.at(i);
+ for (FxViewItem *item : qAsConst(visibleItems)) {
if (item->index != -1 && item->index >= modelIndex)
item->index += count;
}
@@ -2391,8 +2389,7 @@ bool QQuickGridViewPrivate::applyInsertionChange(const QQmlChangeSet::Change &ch
}
// Update the indexes of the following visible items.
- for (int i = 0; i < visibleItems.count(); ++i) {
- FxViewItem *item = visibleItems.at(i);
+ for (FxViewItem *item : qAsConst(visibleItems)) {
if (item->index != -1 && item->index >= modelIndex) {
item->index += count;
if (change.isMove())
@@ -2535,8 +2532,10 @@ void QQuickGridViewPrivate::translateAndTransitionItemsAfter(int afterModelIndex
countItemsRemoved -= removalResult.countChangeAfterVisibleItems;
- for (int i=markerItemIndex+1; i<visibleItems.count() && visibleItems.at(i)->position() < viewEndPos; i++) {
+ for (int i=markerItemIndex+1; i<visibleItems.count(); i++) {
FxGridItemSG *gridItem = static_cast<FxGridItemSG *>(visibleItems.at(i));
+ if (gridItem->position() >= viewEndPos)
+ break;
if (!gridItem->transitionScheduledOrRunning()) {
qreal origRowPos = gridItem->colPos();
qreal origColPos = gridItem->rowPos();
diff --git a/src/quick/items/qquickgridview_p.h b/src/quick/items/qquickgridview_p.h
index aaf6e4a75b..5c6da2b433 100644
--- a/src/quick/items/qquickgridview_p.h
+++ b/src/quick/items/qquickgridview_p.h
@@ -84,8 +84,8 @@ public:
QQuickGridView(QQuickItem *parent=0);
~QQuickGridView();
- void setHighlightFollowsCurrentItem(bool) Q_DECL_OVERRIDE;
- void setHighlightMoveDuration(int) Q_DECL_OVERRIDE;
+ void setHighlightFollowsCurrentItem(bool) override;
+ void setHighlightMoveDuration(int) override;
Flow flow() const;
void setFlow(Flow);
@@ -117,10 +117,10 @@ Q_SIGNALS:
void snapModeChanged();
protected:
- void viewportMoved(Qt::Orientations) Q_DECL_OVERRIDE;
- void keyPressEvent(QKeyEvent *) Q_DECL_OVERRIDE;
- void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE;
- void initItem(int index, QObject *item) Q_DECL_OVERRIDE;
+ void viewportMoved(Qt::Orientations) override;
+ void keyPressEvent(QKeyEvent *) override;
+ void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override;
+ void initItem(int index, QObject *item) override;
};
class QQuickGridViewAttached : public QQuickItemViewAttached
diff --git a/src/quick/items/qquickimagebase.cpp b/src/quick/items/qquickimagebase.cpp
index a6bf6b4e8a..22d631e917 100644
--- a/src/quick/items/qquickimagebase.cpp
+++ b/src/quick/items/qquickimagebase.cpp
@@ -281,7 +281,7 @@ void QQuickImageBase::requestFinished()
Q_D(QQuickImageBase);
if (d->pix.isError()) {
- qmlInfo(this) << d->pix.error();
+ qmlWarning(this) << d->pix.error();
d->pix.clear(this);
d->status = Error;
if (d->progress != 0.0) {
diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp
index 504446a8be..f7b9a58329 100644
--- a/src/quick/items/qquickitem.cpp
+++ b/src/quick/items/qquickitem.cpp
@@ -1566,7 +1566,7 @@ QQuickLayoutMirroringAttached::QQuickLayoutMirroringAttached(QObject *parent) :
if (itemPrivate)
itemPrivate->extra.value().layoutDirectionAttached = this;
else
- qmlInfo(parent) << tr("LayoutDirection attached property only works with Items and Windows");
+ qmlWarning(parent) << tr("LayoutDirection attached property only works with Items and Windows");
}
QQuickLayoutMirroringAttached * QQuickLayoutMirroringAttached::qmlAttachedProperties(QObject *object)
@@ -1714,7 +1714,7 @@ QQuickEnterKeyAttached::QQuickEnterKeyAttached(QObject *parent)
itemPrivate = QQuickItemPrivate::get(item);
itemPrivate->extra.value().enterKeyAttached = this;
} else
- qmlInfo(parent) << tr("EnterKey attached property only works with Items");
+ qmlWarning(parent) << tr("EnterKey attached property only works with Items");
}
QQuickEnterKeyAttached *QQuickEnterKeyAttached::qmlAttachedProperties(QObject *object)
@@ -4374,7 +4374,7 @@ void QQuickItem::mapFromItem(QQmlV4Function *args) const
}
if (!itemObj && !item->isNull()) {
- qmlInfo(this) << "mapFromItem() given argument \"" << item->toQStringNoThrow()
+ qmlWarning(this) << "mapFromItem() given argument \"" << item->toQStringNoThrow()
<< "\" which is neither null nor an Item";
v4->throwTypeError();
return;
@@ -4462,7 +4462,7 @@ void QQuickItem::mapToItem(QQmlV4Function *args) const
}
if (!itemObj && !item->isNull()) {
- qmlInfo(this) << "mapToItem() given argument \"" << item->toQStringNoThrow()
+ qmlWarning(this) << "mapToItem() given argument \"" << item->toQStringNoThrow()
<< "\" which is neither null nor an Item";
v4->throwTypeError();
return;
@@ -8389,7 +8389,7 @@ void QQuickItemWrapper::markObjects(QV4::Heap::Base *that, QV4::ExecutionEngine
{
QObjectWrapper::Data *This = static_cast<QObjectWrapper::Data *>(that);
if (QQuickItem *item = static_cast<QQuickItem*>(This->object())) {
- foreach (QQuickItem *child, QQuickItemPrivate::get(item)->childItems)
+ for (QQuickItem *child : qAsConst(QQuickItemPrivate::get(item)->childItems))
QV4::QObjectWrapper::markWrapper(child, e);
}
QV4::QObjectWrapper::markObjects(that, e);
diff --git a/src/quick/items/qquickitemanimation.cpp b/src/quick/items/qquickitemanimation.cpp
index fd4a7d733f..9873622f41 100644
--- a/src/quick/items/qquickitemanimation.cpp
+++ b/src/quick/items/qquickitemanimation.cpp
@@ -304,7 +304,7 @@ QAbstractAnimationJob* QQuickParentAnimation::transition(QQuickStateActions &act
bool ok;
const QTransform &transform = targetParent->itemTransform(d->via, &ok);
if (transform.type() >= QTransform::TxShear || !ok) {
- qmlInfo(this) << QQuickParentAnimation::tr("Unable to preserve appearance under complex transform");
+ qmlWarning(this) << QQuickParentAnimation::tr("Unable to preserve appearance under complex transform");
ok = false;
}
@@ -315,21 +315,21 @@ QAbstractAnimationJob* QQuickParentAnimation::transition(QQuickStateActions &act
if (transform.m11() == transform.m22())
scale = transform.m11();
else {
- qmlInfo(this) << QQuickParentAnimation::tr("Unable to preserve appearance under non-uniform scale");
+ qmlWarning(this) << QQuickParentAnimation::tr("Unable to preserve appearance under non-uniform scale");
ok = false;
}
} else if (ok && isRotate) {
if (transform.m11() == transform.m22())
scale = qSqrt(transform.m11()*transform.m11() + transform.m12()*transform.m12());
else {
- qmlInfo(this) << QQuickParentAnimation::tr("Unable to preserve appearance under non-uniform scale");
+ qmlWarning(this) << QQuickParentAnimation::tr("Unable to preserve appearance under non-uniform scale");
ok = false;
}
if (scale != 0)
rotation = qAtan2(transform.m12()/scale, transform.m11()/scale) * 180/M_PI;
else {
- qmlInfo(this) << QQuickParentAnimation::tr("Unable to preserve appearance under scale of 0");
+ qmlWarning(this) << QQuickParentAnimation::tr("Unable to preserve appearance under scale of 0");
ok = false;
}
}
@@ -474,7 +474,7 @@ int QQuickAnchorAnimation::duration() const
void QQuickAnchorAnimation::setDuration(int duration)
{
if (duration < 0) {
- qmlInfo(this) << tr("Cannot set a duration of < 0");
+ qmlWarning(this) << tr("Cannot set a duration of < 0");
return;
}
@@ -613,7 +613,7 @@ int QQuickPathAnimation::duration() const
void QQuickPathAnimation::setDuration(int duration)
{
if (duration < 0) {
- qmlInfo(this) << tr("Cannot set a duration of < 0");
+ qmlWarning(this) << tr("Cannot set a duration of < 0");
return;
}
@@ -869,7 +869,7 @@ QAbstractAnimationJob* QQuickPathAnimation::transition(QQuickStateActions &actio
data->reverse = direction == Backward ? true : false;
data->fromSourced = false;
data->fromDefined = (d->path && d->path->hasStartX() && d->path->hasStartY()) ? true : false;
- data->toDefined = d->path ? d->path->hasEnd() : false;
+ data->toDefined = d->path ? true : false;
int origModifiedSize = modified.count();
for (int i = 0; i < actions.count(); ++i) {
diff --git a/src/quick/items/qquickitemgrabresult.cpp b/src/quick/items/qquickitemgrabresult.cpp
index c6355ceed2..07c2cb607c 100644
--- a/src/quick/items/qquickitemgrabresult.cpp
+++ b/src/quick/items/qquickitemgrabresult.cpp
@@ -47,6 +47,7 @@
#endif
#include <QtQml/QQmlEngine>
+#include <QtQml/QQmlInfo>
#include <private/qquickpixmapcache_p.h>
#include <private/qquickitem_p.h>
@@ -279,17 +280,17 @@ QQuickItemGrabResult *QQuickItemGrabResultPrivate::create(QQuickItem *item, cons
size = QSize(item->width(), item->height());
if (size.width() < 1 || size.height() < 1) {
- qWarning("Item::grabToImage: item has invalid dimensions");
+ qmlWarning(item) << "grabToImage: item has invalid dimensions";
return 0;
}
if (!item->window()) {
- qWarning("Item::grabToImage: item is not attached to a window");
+ qmlWarning(item) << "grabToImage: item is not attached to a window";
return 0;
}
if (!item->window()->isVisible()) {
- qWarning("Item::grabToImage: item's window is not visible");
+ qmlWarning(item) << "grabToImage: item's window is not visible";
return 0;
}
@@ -377,12 +378,12 @@ bool QQuickItem::grabToImage(const QJSValue &callback, const QSize &targetSize)
{
QQmlEngine *engine = qmlEngine(this);
if (!engine) {
- qWarning("Item::grabToImage: no QML Engine");
+ qmlWarning(this) << "grabToImage: item has no QML engine";
return false;
}
if (!callback.isCallable()) {
- qWarning("Item::grabToImage: 'callback' is not a function");
+ qmlWarning(this) << "grabToImage: 'callback' is not a function";
return false;
}
@@ -391,12 +392,12 @@ bool QQuickItem::grabToImage(const QJSValue &callback, const QSize &targetSize)
size = QSize(width(), height());
if (size.width() < 1 || size.height() < 1) {
- qWarning("Item::grabToImage: item has invalid dimensions");
+ qmlWarning(this) << "grabToImage: item has invalid dimensions";
return false;
}
if (!window()) {
- qWarning("Item::grabToImage: item is not attached to a window");
+ qmlWarning(this) << "grabToImage: item is not attached to a window";
return false;
}
diff --git a/src/quick/items/qquickitemsmodule.cpp b/src/quick/items/qquickitemsmodule.cpp
index e9439275ac..65143f3e9b 100644
--- a/src/quick/items/qquickitemsmodule.cpp
+++ b/src/quick/items/qquickitemsmodule.cpp
@@ -299,8 +299,10 @@ static void qt_quickitems_defineModule(const char *uri, int major, int minor)
qmlRegisterType<QQuickGrid, 1>(uri, 2, 1, "Grid");
#endif
#if QT_CONFIG(quick_itemview)
- qmlRegisterUncreatableType<QQuickItemView, 1>(uri, 2, 1, "ItemView", QQuickItemView::tr("ItemView is an abstract base class"));
- qmlRegisterUncreatableType<QQuickItemView, 2>(uri, 2, 3, "ItemView", QQuickItemView::tr("ItemView is an abstract base class"));
+ const char *itemViewName = "ItemView";
+ const QString itemViewMessage = QQuickItemView::tr("ItemView is an abstract base class");
+ qmlRegisterUncreatableType<QQuickItemView, 1>(uri, 2, 1, itemViewName, itemViewMessage);
+ qmlRegisterUncreatableType<QQuickItemView, 2>(uri, 2, 3, itemViewName, itemViewMessage);
#endif
#if QT_CONFIG(quick_listview)
qmlRegisterType<QQuickListView, 1>(uri, 2, 1, "ListView");
@@ -362,6 +364,9 @@ static void qt_quickitems_defineModule(const char *uri, int major, int minor)
#if QT_CONFIG(quick_pathview)
qmlRegisterType<QQuickPathView, 7>(uri, 2, 7, "PathView");
#endif
+#if QT_CONFIG(quick_itemview)
+ qmlRegisterUncreatableType<QQuickItemView, 7>(uri, 2, 7, itemViewName, itemViewMessage);
+#endif
qmlRegisterUncreatableType<QQuickMouseEvent, 7>(uri, 2, 7, nullptr, QQuickMouseEvent::tr("MouseEvent is only available within handlers in MouseArea"));
@@ -370,6 +375,7 @@ static void qt_quickitems_defineModule(const char *uri, int major, int minor)
qmlRegisterType<QQuickBorderImageMesh>("QtQuick", 2, 8, "BorderImageMesh");
#endif
+ qmlRegisterType<QQuickFlickable, 9>(uri, 2, 9, "Flickable");
qmlRegisterType<QQuickMouseArea, 9>(uri, 2, 9, "MouseArea");
#if QT_CONFIG(quick_path)
@@ -381,6 +387,16 @@ static void qt_quickitems_defineModule(const char *uri, int major, int minor)
qmlRegisterUncreatableType<QQuickPathGradient>(uri, 2, 9, "PathGradient", QQuickPathGradient::tr("PathGradient is an abstract base class"));
qmlRegisterType<QQuickPathLinearGradient>(uri, 2, 9, "PathLinearGradient");
#endif
+
+ qmlRegisterType<QQuickText, 9>(uri, 2, 9, "Text");
+ qmlRegisterType<QQuickTextInput, 9>(uri, 2, 9, "TextInput");
+ qmlRegisterType<QQuickTouchPoint>(uri, 2, 9, "TouchPoint");
+ qRegisterMetaType<QPointingDeviceUniqueId>("QPointingDeviceUniqueId");
+ qmlRegisterUncreatableType<QPointingDeviceUniqueId>(uri, 2, 9, "PointingDeviceUniqueId", QQuickTouchPoint::tr("PointingDeviceUniqueId is only available via read-only properties"));
+#if QT_CONFIG(quick_positioners)
+ qmlRegisterUncreatableType<QQuickBasePositioner, 9>(uri, 2, 9, "Positioner",
+ QStringLiteral("Positioner is an abstract type that is only available as an attached property."));
+#endif
}
static void initResources()
diff --git a/src/quick/items/qquickitemview.cpp b/src/quick/items/qquickitemview.cpp
index 7d98cc2693..a8bac633cc 100644
--- a/src/quick/items/qquickitemview.cpp
+++ b/src/quick/items/qquickitemview.cpp
@@ -380,8 +380,8 @@ void QQuickItemView::setDelegate(QQmlComponent *delegate)
int oldCount = dataModel->count();
dataModel->setDelegate(delegate);
if (isComponentComplete()) {
- for (int i = 0; i < d->visibleItems.count(); ++i)
- d->releaseItem(d->visibleItems.at(i));
+ for (FxViewItem *item : qAsConst(d->visibleItems))
+ d->releaseItem(item);
d->visibleItems.clear();
d->releaseItem(d->currentItem);
d->currentItem = 0;
@@ -487,7 +487,7 @@ void QQuickItemView::setCacheBuffer(int b)
{
Q_D(QQuickItemView);
if (b < 0) {
- qmlInfo(this) << "Cannot set a negative cache buffer";
+ qmlWarning(this) << "Cannot set a negative cache buffer";
return;
}
@@ -946,12 +946,12 @@ void QQuickItemViewPrivate::positionViewAtIndex(int index, int mode)
qreal itemPos = positionAt(idx);
changedVisibleIndex(idx);
// save the currently visible items in case any of them end up visible again
- QList<FxViewItem *> oldVisible = visibleItems;
+ const QList<FxViewItem *> oldVisible = visibleItems;
visibleItems.clear();
setPosition(qMin(itemPos, maxExtent));
// now release the reference to all the old visible items.
- for (int i = 0; i < oldVisible.count(); ++i)
- releaseItem(oldVisible.at(i));
+ for (FxViewItem *item : oldVisible)
+ releaseItem(item);
item = visibleItem(idx);
}
if (item) {
@@ -1199,10 +1199,10 @@ void QQuickItemViewPrivate::checkVisible() const
void QQuickItemViewPrivate::showVisibleItems() const
{
qDebug() << "Visible items:";
- for (int i = 0; i < visibleItems.count(); ++i) {
- qDebug() << "\t" << visibleItems.at(i)->index
- << visibleItems.at(i)->item->objectName()
- << visibleItems.at(i)->position();
+ for (FxViewItem *item : visibleItems) {
+ qDebug() << "\t" << item->index
+ << item->item->objectName()
+ << item->position();
}
}
@@ -1646,8 +1646,7 @@ FxViewItem *QQuickItemViewPrivate::visibleItem(int modelIndex) const {
// that don't look at the view position and size
FxViewItem *QQuickItemViewPrivate::firstVisibleItem() const {
const qreal pos = isContentFlowReversed() ? -position()-size() : position();
- for (int i = 0; i < visibleItems.count(); ++i) {
- FxViewItem *item = visibleItems.at(i);
+ for (FxViewItem *item : visibleItems) {
if (item->index != -1 && item->endPosition() > pos)
return item;
}
@@ -1744,14 +1743,14 @@ void QQuickItemViewPrivate::clear()
currentChanges.reset();
timeline.clear();
- for (int i = 0; i < visibleItems.count(); ++i)
- releaseItem(visibleItems.at(i));
+ for (FxViewItem *item : qAsConst(visibleItems))
+ releaseItem(item);
visibleItems.clear();
visibleIndex = 0;
- for (int i = 0; i < releasePendingTransition.count(); ++i) {
- releasePendingTransition.at(i)->releaseAfterTransition = false;
- releaseItem(releasePendingTransition.at(i));
+ for (FxViewItem *item : qAsConst(releasePendingTransition)) {
+ item->releaseAfterTransition = false;
+ releaseItem(item);
}
releasePendingTransition.clear();
@@ -1912,9 +1911,9 @@ void QQuickItemViewPrivate::layout()
forceLayout = false;
if (transitioner && transitioner->canTransition(QQuickItemViewTransitioner::PopulateTransition, true)) {
- for (int i=0; i<visibleItems.count(); i++) {
- if (!visibleItems.at(i)->transitionScheduledOrRunning())
- visibleItems.at(i)->transitionNextReposition(transitioner, QQuickItemViewTransitioner::PopulateTransition, true);
+ for (FxViewItem *item : qAsConst(visibleItems)) {
+ if (!item->transitionScheduledOrRunning())
+ item->transitionNextReposition(transitioner, QQuickItemViewTransitioner::PopulateTransition, true);
}
}
@@ -2010,18 +2009,18 @@ bool QQuickItemViewPrivate::applyModelChanges(ChangeResult *totalInsertionResult
ChangeResult removalResult(prevViewPos);
int removedCount = 0;
- for (int i=0; i<removals.count(); i++) {
- itemCount -= removals[i].count;
- if (applyRemovalChange(removals[i], &removalResult, &removedCount))
+ for (const QQmlChangeSet::Change &r : removals) {
+ itemCount -= r.count;
+ if (applyRemovalChange(r, &removalResult, &removedCount))
visibleAffected = true;
- if (!visibleAffected && needsRefillForAddedOrRemovedIndex(removals[i].index))
+ if (!visibleAffected && needsRefillForAddedOrRemovedIndex(r.index))
visibleAffected = true;
const int correctedFirstVisibleIndex = prevFirstVisibleIndex - removalResult.countChangeBeforeVisible;
- if (correctedFirstVisibleIndex >= 0 && removals[i].index < correctedFirstVisibleIndex) {
- if (removals[i].index + removals[i].count < correctedFirstVisibleIndex)
- removalResult.countChangeBeforeVisible += removals[i].count;
+ if (correctedFirstVisibleIndex >= 0 && r.index < correctedFirstVisibleIndex) {
+ if (r.index + r.count < correctedFirstVisibleIndex)
+ removalResult.countChangeBeforeVisible += r.count;
else
- removalResult.countChangeBeforeVisible += (correctedFirstVisibleIndex - removals[i].index);
+ removalResult.countChangeBeforeVisible += (correctedFirstVisibleIndex - r.index);
}
}
if (runDelayedRemoveTransition) {
@@ -2068,23 +2067,23 @@ bool QQuickItemViewPrivate::applyModelChanges(ChangeResult *totalInsertionResult
}
itemCount += insertions[i].count;
}
- for (int i=0; i<newItems.count(); i++) {
- if (newItems.at(i)->attached)
- newItems.at(i)->attached->emitAdd();
+ for (FxViewItem *item : qAsConst(newItems)) {
+ if (item->attached)
+ item->attached->emitAdd();
}
// for each item that was moved directly into the view as a result of a move(),
// find the index it was moved from in order to set its initial position, so that we
// can transition it from this "original" position to its new position in the view
if (transitioner && transitioner->canTransition(QQuickItemViewTransitioner::MoveTransition, true)) {
- for (int i=0; i<movingIntoView.count(); i++) {
- int fromIndex = findMoveKeyIndex(movingIntoView.at(i).moveKey, removals);
+ for (const MovedItem &m : qAsConst(movingIntoView)) {
+ int fromIndex = findMoveKeyIndex(m.moveKey, removals);
if (fromIndex >= 0) {
if (prevFirstVisibleIndex >= 0 && fromIndex < prevFirstVisibleIndex)
- repositionItemAt(movingIntoView.at(i).item, fromIndex, -totalInsertionResult->sizeChangesAfterVisiblePos);
+ repositionItemAt(m.item, fromIndex, -totalInsertionResult->sizeChangesAfterVisiblePos);
else
- repositionItemAt(movingIntoView.at(i).item, fromIndex, totalInsertionResult->sizeChangesAfterVisiblePos);
- movingIntoView.at(i).item->transitionNextReposition(transitioner, QQuickItemViewTransitioner::MoveTransition, true);
+ repositionItemAt(m.item, fromIndex, totalInsertionResult->sizeChangesAfterVisiblePos);
+ m.item->transitionNextReposition(transitioner, QQuickItemViewTransitioner::MoveTransition, true);
}
}
}
@@ -2345,7 +2344,7 @@ FxViewItem *QQuickItemViewPrivate::createItem(int modelIndex, bool asynchronous)
if (!delegateValidated) {
delegateValidated = true;
QObject* delegate = q->delegate();
- qmlInfo(delegate ? delegate : q) << QQuickItemView::tr("Delegate must be of Item type");
+ qmlWarning(delegate ? delegate : q) << QQuickItemView::tr("Delegate must be of Item type");
}
}
inRequest = false;
diff --git a/src/quick/items/qquickitemview_p.h b/src/quick/items/qquickitemview_p.h
index 3ac54ea3dc..b38bc6174f 100644
--- a/src/quick/items/qquickitemview_p.h
+++ b/src/quick/items/qquickitemview_p.h
@@ -232,10 +232,10 @@ public:
Q_INVOKABLE void positionViewAtEnd();
Q_REVISION(1) Q_INVOKABLE void forceLayout();
- void setContentX(qreal pos) Q_DECL_OVERRIDE;
- void setContentY(qreal pos) Q_DECL_OVERRIDE;
- qreal originX() const Q_DECL_OVERRIDE;
- qreal originY() const Q_DECL_OVERRIDE;
+ void setContentX(qreal pos) override;
+ void setContentY(qreal pos) override;
+ qreal originX() const override;
+ qreal originY() const override;
Q_SIGNALS:
void modelChanged();
@@ -277,13 +277,13 @@ Q_SIGNALS:
void highlightMoveDurationChanged();
protected:
- void updatePolish() Q_DECL_OVERRIDE;
- void componentComplete() Q_DECL_OVERRIDE;
- void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE;
- qreal minYExtent() const Q_DECL_OVERRIDE;
- qreal maxYExtent() const Q_DECL_OVERRIDE;
- qreal minXExtent() const Q_DECL_OVERRIDE;
- qreal maxXExtent() const Q_DECL_OVERRIDE;
+ void updatePolish() override;
+ void componentComplete() override;
+ void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override;
+ qreal minYExtent() const override;
+ qreal maxYExtent() const override;
+ qreal minXExtent() const override;
+ qreal maxXExtent() const override;
protected Q_SLOTS:
void destroyRemoved();
diff --git a/src/quick/items/qquickitemview_p_p.h b/src/quick/items/qquickitemview_p_p.h
index a8e66301c1..3087682ac7 100644
--- a/src/quick/items/qquickitemview_p_p.h
+++ b/src/quick/items/qquickitemview_p_p.h
@@ -201,10 +201,10 @@ public:
void regenerate(bool orientationChanged=false);
void layout();
- virtual void animationFinished(QAbstractAnimationJob *) Q_DECL_OVERRIDE;
+ virtual void animationFinished(QAbstractAnimationJob *) override;
void refill();
void refill(qreal from, qreal to);
- void mirrorChange() Q_DECL_OVERRIDE;
+ void mirrorChange() override;
FxViewItem *createItem(int modelIndex, bool asynchronous = false);
virtual bool releaseItem(FxViewItem *item);
@@ -236,7 +236,7 @@ public:
void prepareVisibleItemTransitions();
void prepareRemoveTransitions(QHash<QQmlChangeSet::MoveKey, FxViewItem *> *removedItems);
bool prepareNonVisibleItemTransition(FxViewItem *item, const QRectF &viewBounds);
- void viewItemTransitionFinished(QQuickItemViewTransitionableItem *item) Q_DECL_OVERRIDE;
+ void viewItemTransitionFinished(QQuickItemViewTransitionableItem *item) override;
int findMoveKeyIndex(QQmlChangeSet::MoveKey key, const QVector<QQmlChangeSet::Change> &changes) const;
@@ -348,8 +348,8 @@ protected:
virtual bool showFooterForIndex(int index) const = 0;
virtual void updateHeader() = 0;
virtual void updateFooter() = 0;
- virtual bool hasStickyHeader() const { return false; };
- virtual bool hasStickyFooter() const { return false; };
+ virtual bool hasStickyHeader() const { return false; }
+ virtual bool hasStickyFooter() const { return false; }
virtual void createHighlight() = 0;
virtual void updateHighlight() = 0;
@@ -382,7 +382,7 @@ protected:
virtual void updateSectionCriteria() {}
virtual void updateSections() {}
- void itemGeometryChanged(QQuickItem *item, QQuickGeometryChange change, const QRectF &) Q_DECL_OVERRIDE;
+ void itemGeometryChanged(QQuickItem *item, QQuickGeometryChange change, const QRectF &) override;
};
diff --git a/src/quick/items/qquickitemviewtransition.cpp b/src/quick/items/qquickitemviewtransition.cpp
index 83c451613e..700c4cc620 100644
--- a/src/quick/items/qquickitemviewtransition.cpp
+++ b/src/quick/items/qquickitemviewtransition.cpp
@@ -64,7 +64,7 @@ public:
bool *m_wasDeleted;
protected:
- void finished() Q_DECL_OVERRIDE;
+ void finished() override;
};
diff --git a/src/quick/items/qquicklistview.cpp b/src/quick/items/qquicklistview.cpp
index f89a995e76..0351077f20 100644
--- a/src/quick/items/qquicklistview.cpp
+++ b/src/quick/items/qquicklistview.cpp
@@ -65,51 +65,51 @@ class QQuickListViewPrivate : public QQuickItemViewPrivate
public:
static QQuickListViewPrivate* get(QQuickListView *item) { return item->d_func(); }
- Qt::Orientation layoutOrientation() const Q_DECL_OVERRIDE;
- bool isContentFlowReversed() const Q_DECL_OVERRIDE;
+ Qt::Orientation layoutOrientation() const override;
+ bool isContentFlowReversed() const override;
bool isRightToLeft() const;
bool isBottomToTop() const;
- qreal positionAt(int index) const Q_DECL_OVERRIDE;
- qreal endPositionAt(int index) const Q_DECL_OVERRIDE;
- qreal originPosition() const Q_DECL_OVERRIDE;
- qreal lastPosition() const Q_DECL_OVERRIDE;
+ qreal positionAt(int index) const override;
+ qreal endPositionAt(int index) const override;
+ qreal originPosition() const override;
+ qreal lastPosition() const override;
FxViewItem *itemBefore(int modelIndex) const;
QString sectionAt(int modelIndex);
qreal snapPosAt(qreal pos);
FxViewItem *snapItemAt(qreal pos);
- void init() Q_DECL_OVERRIDE;
- void clear() Q_DECL_OVERRIDE;
+ void init() override;
+ void clear() override;
- bool addVisibleItems(qreal fillFrom, qreal fillTo, qreal bufferFrom, qreal bufferTo, bool doBuffer) Q_DECL_OVERRIDE;
- bool removeNonVisibleItems(qreal bufferFrom, qreal bufferTo) Q_DECL_OVERRIDE;
- void visibleItemsChanged() Q_DECL_OVERRIDE;
+ bool addVisibleItems(qreal fillFrom, qreal fillTo, qreal bufferFrom, qreal bufferTo, bool doBuffer) override;
+ bool removeNonVisibleItems(qreal bufferFrom, qreal bufferTo) override;
+ void visibleItemsChanged() override;
void removeItem(FxViewItem *item);
- FxViewItem *newViewItem(int index, QQuickItem *item) Q_DECL_OVERRIDE;
- void initializeViewItem(FxViewItem *item) Q_DECL_OVERRIDE;
- bool releaseItem(FxViewItem *item) Q_DECL_OVERRIDE;
- void repositionItemAt(FxViewItem *item, int index, qreal sizeBuffer) Q_DECL_OVERRIDE;
- void repositionPackageItemAt(QQuickItem *item, int index) Q_DECL_OVERRIDE;
- void resetFirstItemPosition(qreal pos = 0.0) Q_DECL_OVERRIDE;
- void adjustFirstItem(qreal forwards, qreal backwards, int) Q_DECL_OVERRIDE;
- void updateSizeChangesBeforeVisiblePos(FxViewItem *item, ChangeResult *removeResult) Q_DECL_OVERRIDE;
+ FxViewItem *newViewItem(int index, QQuickItem *item) override;
+ void initializeViewItem(FxViewItem *item) override;
+ bool releaseItem(FxViewItem *item) override;
+ void repositionItemAt(FxViewItem *item, int index, qreal sizeBuffer) override;
+ void repositionPackageItemAt(QQuickItem *item, int index) override;
+ void resetFirstItemPosition(qreal pos = 0.0) override;
+ void adjustFirstItem(qreal forwards, qreal backwards, int) override;
+ void updateSizeChangesBeforeVisiblePos(FxViewItem *item, ChangeResult *removeResult) override;
- void createHighlight() Q_DECL_OVERRIDE;
- void updateHighlight() Q_DECL_OVERRIDE;
- void resetHighlightPosition() Q_DECL_OVERRIDE;
+ void createHighlight() override;
+ void updateHighlight() override;
+ void resetHighlightPosition() override;
- void setPosition(qreal pos) Q_DECL_OVERRIDE;
- void layoutVisibleItems(int fromModelIndex = 0) Q_DECL_OVERRIDE;
+ void setPosition(qreal pos) override;
+ void layoutVisibleItems(int fromModelIndex = 0) override;
- bool applyInsertionChange(const QQmlChangeSet::Change &insert, ChangeResult *changeResult, QList<FxViewItem *> *addedItems, QList<MovedItem> *movingIntoView) Q_DECL_OVERRIDE;
- void translateAndTransitionItemsAfter(int afterIndex, const ChangeResult &insertionResult, const ChangeResult &removalResult) Q_DECL_OVERRIDE;
+ bool applyInsertionChange(const QQmlChangeSet::Change &insert, ChangeResult *changeResult, QList<FxViewItem *> *addedItems, QList<MovedItem> *movingIntoView) override;
+ void translateAndTransitionItemsAfter(int afterIndex, const ChangeResult &insertionResult, const ChangeResult &removalResult) override;
- void updateSectionCriteria() Q_DECL_OVERRIDE;
- void updateSections() Q_DECL_OVERRIDE;
+ void updateSectionCriteria() override;
+ void updateSections() override;
QQuickItem *getSectionItem(const QString &section);
void releaseSectionItem(QQuickItem *item);
void releaseSectionItems();
@@ -117,25 +117,25 @@ public:
void updateCurrentSection();
void updateStickySections();
- qreal headerSize() const Q_DECL_OVERRIDE;
- qreal footerSize() const Q_DECL_OVERRIDE;
- bool showHeaderForIndex(int index) const Q_DECL_OVERRIDE;
- bool showFooterForIndex(int index) const Q_DECL_OVERRIDE;
- void updateHeader() Q_DECL_OVERRIDE;
- void updateFooter() Q_DECL_OVERRIDE;
- bool hasStickyHeader() const Q_DECL_OVERRIDE;
- bool hasStickyFooter() const Q_DECL_OVERRIDE;
+ qreal headerSize() const override;
+ qreal footerSize() const override;
+ bool showHeaderForIndex(int index) const override;
+ bool showFooterForIndex(int index) const override;
+ void updateHeader() override;
+ void updateFooter() override;
+ bool hasStickyHeader() const override;
+ bool hasStickyFooter() const override;
- void changedVisibleIndex(int newIndex) Q_DECL_OVERRIDE;
- void initializeCurrentItem() Q_DECL_OVERRIDE;
+ void changedVisibleIndex(int newIndex) override;
+ void initializeCurrentItem() override;
void updateAverage();
- void itemGeometryChanged(QQuickItem *item, QQuickGeometryChange change, const QRectF &oldGeometry) Q_DECL_OVERRIDE;
- void fixupPosition() Q_DECL_OVERRIDE;
- void fixup(AxisData &data, qreal minExtent, qreal maxExtent) Q_DECL_OVERRIDE;
+ void itemGeometryChanged(QQuickItem *item, QQuickGeometryChange change, const QRectF &oldGeometry) override;
+ void fixupPosition() override;
+ void fixup(AxisData &data, qreal minExtent, qreal maxExtent) override;
bool flick(QQuickItemViewPrivate::AxisData &data, qreal minExtent, qreal maxExtent, qreal vSize,
- QQuickTimeLineCallback::Callback fixupCallback, qreal velocity) Q_DECL_OVERRIDE;
+ QQuickTimeLineCallback::Callback fixupCallback, qreal velocity) override;
QQuickListView::Orientation orient;
qreal visiblePos;
@@ -263,7 +263,7 @@ public:
static_cast<QQuickListViewAttached*>(attached)->m_sectionItem = s;
}
- qreal position() const Q_DECL_OVERRIDE {
+ qreal position() const override {
if (section()) {
if (view->orientation() == QQuickListView::Vertical)
return (view->verticalLayoutDirection() == QQuickItemView::BottomToTop ? -section()->height()-section()->y() : section()->y());
@@ -279,7 +279,7 @@ public:
else
return (view->effectiveLayoutDirection() == Qt::RightToLeft ? -itemWidth()-itemX() : itemX());
}
- qreal size() const Q_DECL_OVERRIDE {
+ qreal size() const override {
if (section())
return (view->orientation() == QQuickListView::Vertical ? itemHeight()+section()->height() : itemWidth()+section()->width());
else
@@ -288,12 +288,12 @@ public:
qreal itemSize() const {
return (view->orientation() == QQuickListView::Vertical ? itemHeight() : itemWidth());
}
- qreal sectionSize() const Q_DECL_OVERRIDE {
+ qreal sectionSize() const override {
if (section())
return (view->orientation() == QQuickListView::Vertical ? section()->height() : section()->width());
return 0.0;
}
- qreal endPosition() const Q_DECL_OVERRIDE {
+ qreal endPosition() const override {
if (view->orientation() == QQuickListView::Vertical) {
return (view->verticalLayoutDirection() == QQuickItemView::BottomToTop
? -itemY()
@@ -327,7 +327,7 @@ public:
else
item->setWidth(size);
}
- bool contains(qreal x, qreal y) const Q_DECL_OVERRIDE {
+ bool contains(qreal x, qreal y) const override {
return (x >= itemX() && x < itemX() + itemWidth() &&
y >= itemY() && y < itemY() + itemHeight());
}
@@ -438,11 +438,12 @@ qreal QQuickListViewPrivate::lastPosition() const
int invisibleCount = INT_MIN;
int delayRemovedCount = 0;
for (int i = visibleItems.count()-1; i >= 0; --i) {
- if (visibleItems.at(i)->index != -1) {
+ FxViewItem *item = visibleItems.at(i);
+ if (item->index != -1) {
// Find the invisible count after the last visible item with known index
- invisibleCount = model->count() - (visibleItems.at(i)->index + 1 + delayRemovedCount);
+ invisibleCount = model->count() - (item->index + 1 + delayRemovedCount);
break;
- } else if (visibleItems.at(i)->attached->delayRemove()) {
+ } else if (item->attached->delayRemove()) {
++delayRemovedCount;
}
}
@@ -530,8 +531,7 @@ FxViewItem *QQuickListViewPrivate::snapItemAt(qreal pos)
{
FxViewItem *snapItem = 0;
qreal prevItemSize = 0;
- for (int i = 0; i < visibleItems.count(); ++i) {
- FxViewItem *item = visibleItems.at(i);
+ for (FxViewItem *item : qAsConst(visibleItems)) {
if (item->index == -1)
continue;
qreal itemTop = item->position();
@@ -660,8 +660,8 @@ bool QQuickListViewPrivate::addVisibleItems(qreal fillFrom, qreal fillTo, qreal
int newModelIdx = qBound(0, modelIndex + count, model->count());
count = newModelIdx - modelIndex;
if (count) {
- for (int i = 0; i < visibleItems.count(); ++i)
- releaseItem(visibleItems.at(i));
+ for (FxViewItem *item : qAsConst(visibleItems))
+ releaseItem(item);
visibleItems.clear();
modelIndex = newModelIdx;
visibleIndex = modelIndex;
@@ -1008,8 +1008,8 @@ void QQuickListViewPrivate::releaseSectionItem(QQuickItem *item)
void QQuickListViewPrivate::releaseSectionItems()
{
- for (int i = 0; i < visibleItems.count(); ++i) {
- FxListItemSG *listItem = static_cast<FxListItemSG *>(visibleItems.at(i));
+ for (FxViewItem *item : qAsConst(visibleItems)) {
+ FxListItemSG *listItem = static_cast<FxListItemSG *>(item);
if (listItem->section()) {
qreal pos = listItem->position();
releaseSectionItem(listItem->section());
@@ -1168,16 +1168,15 @@ void QQuickListViewPrivate::updateSections()
QQuickListViewAttached *prevAtt = 0;
int prevIdx = -1;
int idx = -1;
- for (int i = 0; i < visibleItems.count(); ++i) {
- FxViewItem *item = visibleItems.at(i);
+ for (FxViewItem *item : qAsConst(visibleItems)) {
QQuickListViewAttached *attached = static_cast<QQuickListViewAttached*>(item->attached);
attached->setPrevSection(prevSection);
- if (visibleItems.at(i)->index != -1) {
- QString propValue = model->stringValue(visibleItems.at(i)->index, sectionCriteria->property());
+ if (item->index != -1) {
+ QString propValue = model->stringValue(item->index, sectionCriteria->property());
attached->setSection(sectionCriteria->sectionString(propValue));
- idx = visibleItems.at(i)->index;
+ idx = item->index;
}
- updateInlineSection(static_cast<FxListItemSG*>(visibleItems.at(i)));
+ updateInlineSection(static_cast<FxListItemSG*>(item));
if (prevAtt)
prevAtt->setNextSection(sectionAt(prevIdx+1));
prevSection = attached->section();
@@ -1210,9 +1209,12 @@ void QQuickListViewPrivate::updateCurrentSection()
qreal startPos = hasStickyHeader() ? header->endPosition() : viewPos;
int index = 0;
int modelIndex = visibleIndex;
- while (index < visibleItems.count() && visibleItems.at(index)->endPosition() <= startPos) {
- if (visibleItems.at(index)->index != -1)
- modelIndex = visibleItems.at(index)->index;
+ while (index < visibleItems.count()) {
+ FxViewItem *item = visibleItems.at(index);
+ if (item->endPosition() > startPos)
+ break;
+ if (item->index != -1)
+ modelIndex = item->index;
++index;
}
@@ -1236,10 +1238,13 @@ void QQuickListViewPrivate::updateCurrentSection()
qreal endPos = hasStickyFooter() ? footer->position() : viewPos + size();
if (nextSectionItem && !inlineSections)
endPos -= orient == QQuickListView::Vertical ? nextSectionItem->height() : nextSectionItem->width();
- while (index < visibleItems.count() && static_cast<FxListItemSG*>(visibleItems.at(index))->itemPosition() < endPos) {
- if (visibleItems.at(index)->index != -1)
- modelIndex = visibleItems.at(index)->index;
- lastSection = visibleItems.at(index)->attached->section();
+ while (index < visibleItems.count()) {
+ FxListItemSG *listItem = static_cast<FxListItemSG *>(visibleItems.at(index));
+ if (listItem->itemPosition() >= endPos)
+ break;
+ if (listItem->index != -1)
+ modelIndex = listItem->index;
+ lastSection = listItem->attached->section();
++index;
}
@@ -1288,8 +1293,8 @@ void QQuickListViewPrivate::updateAverage()
if (!visibleItems.count())
return;
qreal sum = 0.0;
- for (int i = 0; i < visibleItems.count(); ++i)
- sum += visibleItems.at(i)->size();
+ for (FxViewItem *item : qAsConst(visibleItems))
+ sum += item->size();
averageSize = qRound(sum / visibleItems.count());
}
@@ -1462,9 +1467,15 @@ void QQuickListViewPrivate::fixupPosition()
void QQuickListViewPrivate::fixup(AxisData &data, qreal minExtent, qreal maxExtent)
{
- if ((orient == QQuickListView::Horizontal && &data == &vData)
- || (orient == QQuickListView::Vertical && &data == &hData))
+ if (orient == QQuickListView::Horizontal && &data == &vData) {
+ if (flickableDirection != QQuickFlickable::HorizontalFlick)
+ QQuickItemViewPrivate::fixup(data, minExtent, maxExtent);
+ return;
+ } else if (orient == QQuickListView::Vertical && &data == &hData) {
+ if (flickableDirection != QQuickFlickable::VerticalFlick)
+ QQuickItemViewPrivate::fixup(data, minExtent, maxExtent);
return;
+ }
correctFlick = false;
fixupMode = moveReason == Mouse ? fixupMode : Immediate;
@@ -1813,6 +1824,19 @@ bool QQuickListViewPrivate::flick(AxisData &data, qreal minExtent, qreal maxExte
\image listview-layout-righttoleft.png
\endtable
+ \section1 Flickable Direction
+
+ By default, a vertical ListView sets \l {Flickable::}{flickableDirection} to \e Flickable.Vertical,
+ and a horizontal ListView sets it to \e Flickable.Horizontal. Furthermore, a vertical ListView only
+ calculates (estimates) the \l {Flickable::}{contentHeight}, and a horizontal ListView only calculates
+ the \l {Flickable::}{contentWidth}. The other dimension is set to \e -1.
+
+ Since Qt 5.9 (Qt Quick 2.9), it is possible to make a ListView that can be flicked to both directions.
+ In order to do this, the \l {Flickable::}{flickableDirection} can be set to \e Flickable.AutoFlickDirection
+ or \e Flickable.AutoFlickIfNeeded, and the desired \e contentWidth or \e contentHeight must be provided.
+
+ \snippet qml/listview/listview.qml flickBothDirections
+
\sa {QML Data Models}, GridView, PathView, {Qt Quick Examples - Views}
*/
QQuickListView::QQuickListView(QQuickItem *parent)
@@ -2099,6 +2123,8 @@ void QQuickListView::setSpacing(qreal spacing)
\li Vertical orientation:
\image listview-highlight.png
\endtable
+
+ \sa {Flickable Direction}
*/
QQuickListView::Orientation QQuickListView::orientation() const
{
@@ -2112,12 +2138,18 @@ void QQuickListView::setOrientation(QQuickListView::Orientation orientation)
if (d->orient != orientation) {
d->orient = orientation;
if (d->orient == Vertical) {
- setContentWidth(-1);
- setFlickableDirection(VerticalFlick);
+ if (d->flickableDirection == HorizontalFlick) {
+ setFlickableDirection(VerticalFlick);
+ if (isComponentComplete())
+ setContentWidth(-1);
+ }
setContentX(0);
} else {
- setContentHeight(-1);
- setFlickableDirection(HorizontalFlick);
+ if (d->flickableDirection == VerticalFlick) {
+ setFlickableDirection(HorizontalFlick);
+ if (isComponentComplete())
+ setContentHeight(-1);
+ }
setContentY(0);
}
d->regenerate(true);
@@ -2899,8 +2931,7 @@ void QQuickListView::viewportMoved(Qt::Orientations orient)
// Set visibility of items to eliminate cost of items outside the visible area.
qreal from = d->isContentFlowReversed() ? -d->position()-d->displayMarginBeginning-d->size() : d->position()-d->displayMarginBeginning;
qreal to = d->isContentFlowReversed() ? -d->position()+d->displayMarginEnd : d->position()+d->size()+d->displayMarginEnd;
- for (int i = 0; i < d->visibleItems.count(); ++i) {
- FxViewItem *item = static_cast<FxListItemSG*>(d->visibleItems.at(i));
+ for (FxViewItem *item : qAsConst(d->visibleItems)) {
if (item->item)
QQuickItemPrivate::get(item->item)->setCulled(item->endPosition() < from || item->position() > to);
}
@@ -3042,6 +3073,21 @@ void QQuickListView::initItem(int index, QObject *object)
}
}
+qreal QQuickListView::maxYExtent() const
+{
+ Q_D(const QQuickListView);
+ if (d->layoutOrientation() == Qt::Horizontal && d->flickableDirection != HorizontalFlick)
+ return QQuickFlickable::maxYExtent();
+ return QQuickItemView::maxYExtent();
+}
+
+qreal QQuickListView::maxXExtent() const
+{
+ Q_D(const QQuickListView);
+ if (d->layoutOrientation() == Qt::Vertical && d->flickableDirection != VerticalFlick)
+ return QQuickFlickable::maxXExtent();
+ return QQuickItemView::maxXExtent();
+}
/*!
\qmlmethod QtQuick::ListView::incrementCurrentIndex()
@@ -3120,8 +3166,7 @@ bool QQuickListViewPrivate::applyInsertionChange(const QQmlChangeSet::Change &ch
if (modelIndex < visibleIndex) {
// Insert before visible items
visibleIndex += count;
- for (int i = 0; i < visibleItems.count(); ++i) {
- FxViewItem *item = visibleItems.at(i);
+ for (FxViewItem *item : qAsConst(visibleItems)) {
if (item->index != -1 && item->index >= modelIndex)
item->index += count;
}
@@ -3138,8 +3183,7 @@ bool QQuickListViewPrivate::applyInsertionChange(const QQmlChangeSet::Change &ch
}
// Update the indexes of the following visible items.
- for (int i = 0; i < visibleItems.count(); ++i) {
- FxViewItem *item = visibleItems.at(i);
+ for (FxViewItem *item : qAsConst(visibleItems)) {
if (item->index != -1 && item->index >= modelIndex) {
item->index += count;
if (change.isMove())
@@ -3281,8 +3325,10 @@ void QQuickListViewPrivate::translateAndTransitionItemsAfter(int afterModelIndex
qreal sizeRemoved = -removalResult.sizeChangesAfterVisiblePos
- (removalResult.countChangeAfterVisibleItems * (averageSize + spacing));
- for (int i=markerItemIndex+1; i<visibleItems.count() && visibleItems.at(i)->position() < viewEndPos; i++) {
+ for (int i=markerItemIndex+1; i<visibleItems.count(); i++) {
FxListItemSG *listItem = static_cast<FxListItemSG *>(visibleItems.at(i));
+ if (listItem->position() >= viewEndPos)
+ break;
if (!listItem->transitionScheduledOrRunning()) {
qreal pos = listItem->position();
listItem->setPosition(pos - sizeRemoved);
diff --git a/src/quick/items/qquicklistview_p.h b/src/quick/items/qquicklistview_p.h
index 3a871e88e9..f8db0f0f8f 100644
--- a/src/quick/items/qquicklistview_p.h
+++ b/src/quick/items/qquicklistview_p.h
@@ -146,7 +146,7 @@ public:
QQuickViewSection *sectionCriteria();
QString currentSection() const;
- void setHighlightFollowsCurrentItem(bool) Q_DECL_OVERRIDE;
+ void setHighlightFollowsCurrentItem(bool) override;
qreal highlightMoveVelocity() const;
void setHighlightMoveVelocity(qreal);
@@ -157,7 +157,7 @@ public:
int highlightResizeDuration() const;
void setHighlightResizeDuration(int);
- void setHighlightMoveDuration(int) Q_DECL_OVERRIDE;
+ void setHighlightMoveDuration(int) override;
enum SnapMode { NoSnap, SnapToItem, SnapOneItem };
Q_ENUM(SnapMode)
@@ -192,10 +192,12 @@ Q_SIGNALS:
Q_REVISION(2) void footerPositioningChanged();
protected:
- void viewportMoved(Qt::Orientations orient) Q_DECL_OVERRIDE;
- void keyPressEvent(QKeyEvent *) Q_DECL_OVERRIDE;
- void geometryChanged(const QRectF &newGeometry,const QRectF &oldGeometry) Q_DECL_OVERRIDE;
- void initItem(int index, QObject *item) Q_DECL_OVERRIDE;
+ void viewportMoved(Qt::Orientations orient) override;
+ void keyPressEvent(QKeyEvent *) override;
+ void geometryChanged(const QRectF &newGeometry,const QRectF &oldGeometry) override;
+ void initItem(int index, QObject *item) override;
+ qreal maxYExtent() const override;
+ qreal maxXExtent() const override;
};
class QQuickListViewAttached : public QQuickItemViewAttached
diff --git a/src/quick/items/qquickloader.cpp b/src/quick/items/qquickloader.cpp
index eeec562e3c..5d5934bbd2 100644
--- a/src/quick/items/qquickloader.cpp
+++ b/src/quick/items/qquickloader.cpp
@@ -971,7 +971,7 @@ QV4::ReturnedValue QQuickLoaderPrivate::extractInitialPropertyValues(QQmlV4Funct
QV4::ScopedValue v(scope, (*args)[1]);
if (!v->isObject() || v->as<QV4::ArrayObject>()) {
*error = true;
- qmlInfo(loader) << QQuickLoader::tr("setSource: value is not an object");
+ qmlWarning(loader) << QQuickLoader::tr("setSource: value is not an object");
} else {
*error = false;
valuemap = v;
diff --git a/src/quick/items/qquickmousearea.cpp b/src/quick/items/qquickmousearea.cpp
index 79c957832a..2f66bbebf2 100644
--- a/src/quick/items/qquickmousearea.cpp
+++ b/src/quick/items/qquickmousearea.cpp
@@ -341,7 +341,7 @@ bool QQuickMouseAreaPrivate::propagateHelper(QQuickMouseEvent *ev, QQuickItem *i
position of the release of the click, and whether the click was held.
When handling this signal, changing the \l {MouseEvent::}{accepted} property of the \a mouse
- parameter has no effect.
+ parameter has no effect, unless the \l propagateComposedEvents property is \c true.
The corresponding handler is \c onClicked.
*/
@@ -385,7 +385,7 @@ bool QQuickMouseAreaPrivate::propagateHelper(QQuickMouseEvent *ev, QQuickItem *i
position of the press, and which button is pressed.
When handling this signal, changing the \l {MouseEvent::}{accepted} property of the \a mouse
- parameter has no effect.
+ parameter has no effect, unless the \l propagateComposedEvents property is \c true.
The corresponding handler is \c onPressAndHold.
*/
diff --git a/src/quick/items/qquickmultipointtoucharea.cpp b/src/quick/items/qquickmultipointtoucharea.cpp
index 706980cd13..62119effb2 100644
--- a/src/quick/items/qquickmultipointtoucharea.cpp
+++ b/src/quick/items/qquickmultipointtoucharea.cpp
@@ -60,6 +60,8 @@ DEFINE_BOOL_CONFIG_OPTION(qmlVisualTouchDebugging, QML_VISUAL_TOUCH_DEBUGGING)
The TouchPoint type contains information about a touch point, such as the current
position, pressure, and area.
+
+ \image touchpoint-metrics.png
*/
/*!
@@ -101,16 +103,29 @@ void QQuickTouchPoint::setY(qreal y)
}
/*!
+ \qmlproperty size QtQuick::TouchPoint::ellipseDiameters
+ \since 5.9
+
+ This property holds the major and minor axes of the ellipse representing
+ the covered area of the touch point.
+*/
+void QQuickTouchPoint::setEllipseDiameters(const QSizeF &d)
+{
+ if (_ellipseDiameters == d)
+ return;
+ _ellipseDiameters = d;
+ emit ellipseDiametersChanged();
+}
+
+/*!
\qmlproperty real QtQuick::TouchPoint::pressure
\qmlproperty vector2d QtQuick::TouchPoint::velocity
- \qmlproperty rectangle QtQuick::TouchPoint::area
These properties hold additional information about the current state of the touch point.
\list
\li \c pressure is a value in the range of 0.0 to 1.0.
\li \c velocity is a vector with magnitude reported in pixels per second.
- \li \c area is a rectangle covering the area of the touch point, centered on the current position of the touch point.
\endlist
Not all touch devices support velocity. If velocity is not supported, it will be reported
@@ -124,6 +139,26 @@ void QQuickTouchPoint::setPressure(qreal pressure)
emit pressureChanged();
}
+/*!
+ \qmlproperty real QtQuick::TouchPoint::rotation
+ \since 5.9
+
+ This property holds the angular orientation of this touch point. The return
+ value is in degrees, where zero (the default) indicates the finger or token
+ is pointing upwards, a negative angle means it's rotated to the left, and a
+ positive angle means it's rotated to the right. Most touchscreens do not
+ detect rotation, so zero is the most common value.
+
+ \sa QTouchEvent::TouchPoint::rotation()
+*/
+void QQuickTouchPoint::setRotation(qreal r)
+{
+ if (_rotation == r)
+ return;
+ _rotation = r;
+ emit rotationChanged();
+}
+
void QQuickTouchPoint::setVelocity(const QVector2D &velocity)
{
if (_velocity == velocity)
@@ -132,6 +167,18 @@ void QQuickTouchPoint::setVelocity(const QVector2D &velocity)
emit velocityChanged();
}
+/*!
+ \deprecated
+ \qmlproperty rectangle QtQuick::TouchPoint::area
+
+ A rectangle covering the area of the touch point, centered on the current
+ position of the touch point.
+
+ It is deprecated because a touch point is more correctly modeled as an ellipse,
+ whereas this rectangle represents the outer bounds of the ellipse after \l rotation.
+
+ \sa horizontalDiameter, verticalDiameter
+*/
void QQuickTouchPoint::setArea(const QRectF &area)
{
if (_area == area)
@@ -222,6 +269,25 @@ void QQuickTouchPoint::setSceneY(qreal sceneY)
}
/*!
+ \qmlproperty PointingDeviceUniqueId QtQuick::TouchPoint::uniqueId
+ \since 5.9
+
+ This property holds the unique ID of the touch point or token.
+
+ It is normally empty, because touchscreens cannot uniquely identify fingers.
+ But when it is set, it is expected to uniquely identify a specific token
+ (fiducial object).
+
+ Interpreting the contents of this ID requires knowledge of the hardware and
+ drivers in use (e.g. various TUIO-based touch surfaces).
+*/
+void QQuickTouchPoint::setUniqueId(const QPointingDeviceUniqueId &id)
+{
+ _uniqueId = id;
+ emit uniqueIdChanged();
+}
+
+/*!
\qmltype MultiPointTouchArea
\instantiates QQuickMultiPointTouchArea
\inqmlmodule QtQuick
@@ -691,9 +757,12 @@ void QQuickMultiPointTouchArea::updateTouchPoint(QQuickTouchPoint *dtp, const QT
{
//TODO: if !qmlDefined, could bypass setters.
// also, should only emit signals after all values have been set
+ dtp->setUniqueId(p->uniqueId());
dtp->setX(p->pos().x());
dtp->setY(p->pos().y());
+ dtp->setEllipseDiameters(p->ellipseDiameters());
dtp->setPressure(p->pressure());
+ dtp->setRotation(p->rotation());
dtp->setVelocity(p->velocity());
dtp->setArea(p->rect());
dtp->setStartX(p->startPos().x());
diff --git a/src/quick/items/qquickmultipointtoucharea_p.h b/src/quick/items/qquickmultipointtoucharea_p.h
index 541eb04764..25e1056712 100644
--- a/src/quick/items/qquickmultipointtoucharea_p.h
+++ b/src/quick/items/qquickmultipointtoucharea_p.h
@@ -67,10 +67,13 @@ class Q_AUTOTEST_EXPORT QQuickTouchPoint : public QObject
{
Q_OBJECT
Q_PROPERTY(int pointId READ pointId NOTIFY pointIdChanged)
+ Q_PROPERTY(QPointingDeviceUniqueId uniqueId READ uniqueId NOTIFY uniqueIdChanged REVISION 9)
Q_PROPERTY(bool pressed READ pressed NOTIFY pressedChanged)
Q_PROPERTY(qreal x READ x NOTIFY xChanged)
Q_PROPERTY(qreal y READ y NOTIFY yChanged)
+ Q_PROPERTY(QSizeF ellipseDiameters READ ellipseDiameters NOTIFY ellipseDiametersChanged REVISION 9)
Q_PROPERTY(qreal pressure READ pressure NOTIFY pressureChanged)
+ Q_PROPERTY(qreal rotation READ rotation NOTIFY rotationChanged REVISION 9)
Q_PROPERTY(QVector2D velocity READ velocity NOTIFY velocityChanged)
Q_PROPERTY(QRectF area READ area NOTIFY areaChanged)
@@ -86,6 +89,7 @@ public:
: _id(0),
_x(0.0), _y(0.0),
_pressure(0.0),
+ _rotation(0),
_qmlDefined(qmlDefined),
_inUse(false),
_pressed(false),
@@ -97,15 +101,24 @@ public:
int pointId() const { return _id; }
void setPointId(int id);
+ QPointingDeviceUniqueId uniqueId() const { return _uniqueId; }
+ void setUniqueId(const QPointingDeviceUniqueId &id);
+
qreal x() const { return _x; }
void setX(qreal x);
qreal y() const { return _y; }
void setY(qreal y);
+ QSizeF ellipseDiameters() const { return _ellipseDiameters; }
+ void setEllipseDiameters(const QSizeF &d);
+
qreal pressure() const { return _pressure; }
void setPressure(qreal pressure);
+ qreal rotation() const { return _rotation; }
+ void setRotation(qreal r);
+
QVector2D velocity() const { return _velocity; }
void setVelocity(const QVector2D &velocity);
@@ -141,9 +154,12 @@ public:
Q_SIGNALS:
void pressedChanged();
void pointIdChanged();
+ Q_REVISION(9) void uniqueIdChanged();
void xChanged();
void yChanged();
+ Q_REVISION(9) void ellipseDiametersChanged();
void pressureChanged();
+ Q_REVISION(9) void rotationChanged();
void velocityChanged();
void areaChanged();
void startXChanged();
@@ -159,6 +175,8 @@ private:
qreal _x;
qreal _y;
qreal _pressure;
+ qreal _rotation;
+ QSizeF _ellipseDiameters;
QVector2D _velocity;
QRectF _area;
bool _qmlDefined;
@@ -170,6 +188,7 @@ private:
qreal _previousY;
qreal _sceneX;
qreal _sceneY;
+ QPointingDeviceUniqueId _uniqueId;
};
class QQuickGrabGestureEvent : public QObject
diff --git a/src/quick/items/qquickpathview.cpp b/src/quick/items/qquickpathview.cpp
index 11881ae0ab..53e547fe98 100644
--- a/src/quick/items/qquickpathview.cpp
+++ b/src/quick/items/qquickpathview.cpp
@@ -137,7 +137,7 @@ QQuickItem *QQuickPathViewPrivate::getItem(int modelIndex, qreal z, bool async)
if (!delegateValidated) {
delegateValidated = true;
QObject* delegate = q->delegate();
- qmlInfo(delegate ? delegate : q) << QQuickPathView::tr("Delegate must be of Item type");
+ qmlWarning(delegate ? delegate : q) << QQuickPathView::tr("Delegate must be of Item type");
}
}
} else {
@@ -704,16 +704,23 @@ void QQuickPathView::setPath(QQuickPath *path)
qmlobject_disconnect(d->path, QQuickPath, SIGNAL(changed()),
this, QQuickPathView, SLOT(pathUpdated()));
d->path = path;
- qmlobject_connect(d->path, QQuickPath, SIGNAL(changed()),
- this, QQuickPathView, SLOT(pathUpdated()));
- if (d->isValid() && isComponentComplete()) {
+
+ if (path) {
+ qmlobject_connect(d->path, QQuickPath, SIGNAL(changed()),
+ this, QQuickPathView, SLOT(pathUpdated()));
+ }
+
+ if (isComponentComplete()) {
d->clear();
- if (d->attType) {
- d->attType->release();
- d->attType = nullptr;
+ if (d->isValid()) {
+ if (d->attType) {
+ d->attType->release();
+ d->attType = nullptr;
+ }
+ d->regenerate();
}
- d->regenerate();
}
+
emit pathChanged();
}
diff --git a/src/quick/items/qquickpathview_p.h b/src/quick/items/qquickpathview_p.h
index 669ef60ef7..0e237b7b74 100644
--- a/src/quick/items/qquickpathview_p.h
+++ b/src/quick/items/qquickpathview_p.h
@@ -221,14 +221,14 @@ Q_SIGNALS:
void cacheItemCountChanged();
protected:
- void updatePolish() Q_DECL_OVERRIDE;
- void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QMouseEvent *) Q_DECL_OVERRIDE;
+ void updatePolish() override;
+ void mousePressEvent(QMouseEvent *event) override;
+ void mouseMoveEvent(QMouseEvent *event) override;
+ void mouseReleaseEvent(QMouseEvent *) override;
bool sendMouseEvent(QMouseEvent *event);
- bool childMouseEventFilter(QQuickItem *, QEvent *) Q_DECL_OVERRIDE;
- void mouseUngrabEvent() Q_DECL_OVERRIDE;
- void componentComplete() Q_DECL_OVERRIDE;
+ bool childMouseEventFilter(QQuickItem *, QEvent *) override;
+ void mouseUngrabEvent() override;
+ void componentComplete() override;
private Q_SLOTS:
void refill();
diff --git a/src/quick/items/qquickpathview_p_p.h b/src/quick/items/qquickpathview_p_p.h
index 082f427f2c..d58c986d1a 100644
--- a/src/quick/items/qquickpathview_p_p.h
+++ b/src/quick/items/qquickpathview_p_p.h
@@ -80,7 +80,7 @@ public:
void init();
- void itemGeometryChanged(QQuickItem *item, QQuickGeometryChange change, const QRectF &) Q_DECL_OVERRIDE {
+ void itemGeometryChanged(QQuickItem *item, QQuickGeometryChange change, const QRectF &) override {
if (change.sizeChange() && (!highlightItem || item != highlightItem)) {
if (QQuickPathViewAttached *att = attached(item))
att->m_percent = -1;
diff --git a/src/quick/items/qquickpositioners.cpp b/src/quick/items/qquickpositioners.cpp
index e22427ca49..05d3ae0191 100644
--- a/src/quick/items/qquickpositioners.cpp
+++ b/src/quick/items/qquickpositioners.cpp
@@ -290,6 +290,11 @@ void QQuickBasePositioner::itemChange(ItemChange change, const ItemChangeData &v
QQuickItem::itemChange(change, value);
}
+void QQuickBasePositioner::forceLayout()
+{
+ updatePolish();
+}
+
void QQuickBasePositioner::prePositioning()
{
Q_D(QQuickBasePositioner);
@@ -401,6 +406,8 @@ void QQuickBasePositioner::prePositioning()
//Set implicit size to the size of its children
setImplicitSize(contentSize.width(), contentSize.height());
+
+ emit positioningComplete();
}
void QQuickBasePositioner::positionItem(qreal x, qreal y, PositionedItem *target)
@@ -910,6 +917,28 @@ void QQuickPositionerAttached::setIsLastItem(bool isLastItem)
\sa Grid::spacing
*/
+/*!
+ \qmlmethod QtQuick::Column::forceLayout()
+ \since 5.9
+
+ Column typically positions its children once per frame. This means that
+ inside script blocks it is possible for the underlying children to have changed,
+ but the Column to have not yet been updated accordingly.
+
+ This method forces the Column to immediately respond to any outstanding
+ changes in its children.
+
+ \b Note: methods in general should only be called after the Component has completed.
+*/
+/*!
+ \qmlsignal QtQuick::Column::positioningComplete()
+ \since 5.9
+
+ This signal is emitted when positioning has been completed.
+
+ The corresponding handler is \c onPositioningComplete.
+*/
+
QQuickColumn::QQuickColumn(QQuickItem *parent)
: QQuickBasePositioner(Vertical, parent)
{
@@ -957,7 +986,7 @@ void QQuickColumn::reportConflictingAnchors()
}
}
if (d->anchorConflict) {
- qmlInfo(this) << "Cannot specify top, bottom, verticalCenter, fill or centerIn anchors for items inside Column."
+ qmlWarning(this) << "Cannot specify top, bottom, verticalCenter, fill or centerIn anchors for items inside Column."
<< " Column will not function.";
}
}
@@ -1077,6 +1106,27 @@ void QQuickColumn::reportConflictingAnchors()
\sa Grid::spacing
*/
+/*!
+ \qmlmethod QtQuick::Row::forceLayout()
+ \since 5.9
+
+ Row typically positions its children once per frame. This means that
+ inside script blocks it is possible for the underlying children to have changed,
+ but the Row to have not yet been updated accordingly.
+
+ This method forces the Row to immediately respond to any outstanding
+ changes in its children.
+
+ \b Note: methods in general should only be called after the Component has completed.
+*/
+/*!
+ \qmlsignal QtQuick::Row::positioningComplete()
+ \since 5.9
+
+ This signal is emitted when positioning has been completed.
+
+ The corresponding handler is \c onPositioningComplete.
+*/
class QQuickRowPrivate : public QQuickBasePositionerPrivate
{
@@ -1224,7 +1274,7 @@ void QQuickRow::reportConflictingAnchors()
}
}
if (d->anchorConflict)
- qmlInfo(this) << "Cannot specify left, right, horizontalCenter, fill or centerIn anchors for items inside Row."
+ qmlWarning(this) << "Cannot specify left, right, horizontalCenter, fill or centerIn anchors for items inside Row."
<< " Row will not function.";
}
@@ -1355,6 +1405,27 @@ void QQuickRow::reportConflictingAnchors()
\sa rows, columns
*/
+/*!
+ \qmlmethod QtQuick::Grid::forceLayout()
+ \since 5.9
+
+ Grid typically positions its children once per frame. This means that
+ inside script blocks it is possible for the underlying children to have changed,
+ but the Grid to have not yet been updated accordingly.
+
+ This method forces the Grid to immediately respond to any outstanding
+ changes in its children.
+
+ \b Note: methods in general should only be called after the Component has completed.
+*/
+/*!
+ \qmlsignal QtQuick::Grid::positioningComplete()
+ \since 5.9
+
+ This signal is emitted when positioning has been completed.
+
+ The corresponding handler is \c onPositioningComplete.
+*/
class QQuickGridPrivate : public QQuickBasePositionerPrivate
{
@@ -1808,7 +1879,7 @@ void QQuickGrid::reportConflictingAnchors()
}
}
if (d->anchorConflict)
- qmlInfo(this) << "Cannot specify anchors for items inside Grid." << " Grid will not function.";
+ qmlWarning(this) << "Cannot specify anchors for items inside Grid." << " Grid will not function.";
}
/*!
@@ -1920,6 +1991,28 @@ void QQuickGrid::reportConflictingAnchors()
\sa Grid::spacing
*/
+/*!
+ \qmlmethod QtQuick::Flow::forceLayout()
+ \since 5.9
+
+ Flow typically positions its children once per frame. This means that
+ inside script blocks it is possible for the underlying children to have changed,
+ but the Flow to have not yet been updated accordingly.
+
+ This method forces the Flow to immediately respond to any outstanding
+ changes in its children.
+
+
+ \b Note: methods in general should only be called after the Component has completed.
+*/
+/*!
+ \qmlsignal QtQuick::Flow::positioningComplete()
+ \since 5.9
+
+ This signal is emitted when positioning has been completed.
+
+ The corresponding handler is \c onPositioningComplete.
+*/
class QQuickFlowPrivate : public QQuickBasePositionerPrivate
{
@@ -2121,7 +2214,7 @@ void QQuickFlow::reportConflictingAnchors()
}
}
if (d->anchorConflict)
- qmlInfo(this) << "Cannot specify anchors for items inside Flow." << " Flow will not function.";
+ qmlWarning(this) << "Cannot specify anchors for items inside Flow." << " Flow will not function.";
}
QT_END_NAMESPACE
diff --git a/src/quick/items/qquickpositioners_p.h b/src/quick/items/qquickpositioners_p.h
index c25ecd6dbc..ae6e795794 100644
--- a/src/quick/items/qquickpositioners_p.h
+++ b/src/quick/items/qquickpositioners_p.h
@@ -155,6 +155,8 @@ public:
void setBottomPadding(qreal padding);
void resetBottomPadding();
+ Q_REVISION(9) Q_INVOKABLE void forceLayout();
+
protected:
QQuickBasePositioner(QQuickBasePositionerPrivate &dd, PositionerType at, QQuickItem *parent);
void componentComplete() Q_DECL_OVERRIDE;
@@ -172,6 +174,7 @@ Q_SIGNALS:
Q_REVISION(6) void leftPaddingChanged();
Q_REVISION(6) void rightPaddingChanged();
Q_REVISION(6) void bottomPaddingChanged();
+ Q_REVISION(9) void positioningComplete();
protected Q_SLOTS:
void prePositioning();
diff --git a/src/quick/items/qquickrendercontrol.cpp b/src/quick/items/qquickrendercontrol.cpp
index 13e13890b7..03d96aea1f 100644
--- a/src/quick/items/qquickrendercontrol.cpp
+++ b/src/quick/items/qquickrendercontrol.cpp
@@ -380,6 +380,9 @@ QImage QQuickRenderControl::grab()
if (d->window->rendererInterface()->graphicsApi() == QSGRendererInterface::OpenGL) {
#if QT_CONFIG(opengl)
+ QQuickWindowPrivate *cd = QQuickWindowPrivate::get(d->window);
+ cd->polishItems();
+ cd->syncSceneGraph();
render();
grabContent = qt_gl_read_framebuffer(d->window->size() * d->window->effectiveDevicePixelRatio(), false, false);
#endif
@@ -394,6 +397,8 @@ QImage QQuickRenderControl::grab()
QPaintDevice *prevDev = softwareRenderer->currentPaintDevice();
softwareRenderer->setCurrentPaintDevice(&grabContent);
softwareRenderer->markDirty();
+ cd->polishItems();
+ cd->syncSceneGraph();
render();
softwareRenderer->setCurrentPaintDevice(prevDev);
}
diff --git a/src/quick/items/qquickrepeater.cpp b/src/quick/items/qquickrepeater.cpp
index 4f46f41b0d..a7254464ed 100644
--- a/src/quick/items/qquickrepeater.cpp
+++ b/src/quick/items/qquickrepeater.cpp
@@ -423,7 +423,7 @@ void QQuickRepeater::initItem(int index, QObject *object)
if (!d->delegateValidated) {
d->delegateValidated = true;
QObject* delegate = this->delegate();
- qmlInfo(delegate ? delegate : this) << QQuickRepeater::tr("Delegate must be of Item type");
+ qmlWarning(delegate ? delegate : this) << QQuickRepeater::tr("Delegate must be of Item type");
}
}
return;
diff --git a/src/quick/items/qquickspriteengine.cpp b/src/quick/items/qquickspriteengine.cpp
index f54a8911b2..d26a1f8a64 100644
--- a/src/quick/items/qquickspriteengine.cpp
+++ b/src/quick/items/qquickspriteengine.cpp
@@ -378,7 +378,7 @@ QImage QQuickSpriteEngine::assembledImage(int maxSize)
if (!m_errorsPrinted && stat == QQuickPixmap::Error) {
for (QQuickSprite* s : qAsConst(m_sprites))
if (s->m_pix.isError())
- qmlInfo(s) << s->m_pix.error();
+ qmlWarning(s) << s->m_pix.error();
m_errorsPrinted = true;
}
@@ -399,7 +399,7 @@ QImage QQuickSpriteEngine::assembledImage(int maxSize)
{
const QSize frameSize(state->m_frameWidth, state->m_frameHeight);
if (!(img.size() - frameSize).isValid()) {
- qmlInfo(state).nospace() << "SpriteEngine: Invalid frame size " << frameSize << "."
+ qmlWarning(state).nospace() << "SpriteEngine: Invalid frame size " << frameSize << "."
" It's bigger than image size " << img.size() << ".";
return QImage();
}
@@ -419,10 +419,10 @@ QImage QQuickSpriteEngine::assembledImage(int maxSize)
int rowsNeeded = helper::divRoundUp(state->frames(), (maxSize / state->frameWidth()));
if (h + rowsNeeded * state->frameHeight() > maxSize){
if (rowsNeeded * state->frameHeight() > maxSize)
- qmlInfo(state) << "SpriteEngine: Animation too large to fit in one texture:" << state->source().toLocalFile();
+ qmlWarning(state) << "SpriteEngine: Animation too large to fit in one texture:" << state->source().toLocalFile();
else
- qmlInfo(state) << "SpriteEngine: Animations too large to fit in one texture, pushed over the edge by:" << state->source().toLocalFile();
- qmlInfo(state) << "SpriteEngine: Your texture max size today is " << maxSize;
+ qmlWarning(state) << "SpriteEngine: Animations too large to fit in one texture, pushed over the edge by:" << state->source().toLocalFile();
+ qmlWarning(state) << "SpriteEngine: Your texture max size today is " << maxSize;
return QImage();
}
state->m_generatedCount = rowsNeeded;
diff --git a/src/quick/items/qquickspritesequence.cpp b/src/quick/items/qquickspritesequence.cpp
index 25a39f951a..858a3c0576 100644
--- a/src/quick/items/qquickspritesequence.cpp
+++ b/src/quick/items/qquickspritesequence.cpp
@@ -209,7 +209,7 @@ QSGSpriteNode *QQuickSpriteSequence::initNode()
Q_D(QQuickSpriteSequence);
if (!d->m_spriteEngine) {
- qmlInfo(this) << "No sprite engine...";
+ qmlWarning(this) << "No sprite engine...";
return nullptr;
} else if (d->m_spriteEngine->status() == QQuickPixmap::Null) {
d->m_spriteEngine->startAssemblingImage();
diff --git a/src/quick/items/qquickstateoperations.cpp b/src/quick/items/qquickstateoperations.cpp
index 9cd3b6a5f5..b40a9e2843 100644
--- a/src/quick/items/qquickstateoperations.cpp
+++ b/src/quick/items/qquickstateoperations.cpp
@@ -78,7 +78,7 @@ void QQuickParentChangePrivate::doChange(QQuickItem *targetParent, QQuickItem *s
bool ok;
const QTransform &transform = target->parentItem()->itemTransform(targetParent, &ok);
if (transform.type() >= QTransform::TxShear || !ok) {
- qmlInfo(q) << QQuickParentChange::tr("Unable to preserve appearance under complex transform");
+ qmlWarning(q) << QQuickParentChange::tr("Unable to preserve appearance under complex transform");
ok = false;
}
@@ -89,21 +89,21 @@ void QQuickParentChangePrivate::doChange(QQuickItem *targetParent, QQuickItem *s
if (transform.m11() == transform.m22())
scale = transform.m11();
else {
- qmlInfo(q) << QQuickParentChange::tr("Unable to preserve appearance under non-uniform scale");
+ qmlWarning(q) << QQuickParentChange::tr("Unable to preserve appearance under non-uniform scale");
ok = false;
}
} else if (ok && isRotate) {
if (transform.m11() == transform.m22())
scale = qSqrt(transform.m11()*transform.m11() + transform.m12()*transform.m12());
else {
- qmlInfo(q) << QQuickParentChange::tr("Unable to preserve appearance under non-uniform scale");
+ qmlWarning(q) << QQuickParentChange::tr("Unable to preserve appearance under non-uniform scale");
ok = false;
}
if (scale != 0)
rotation = qAtan2(transform.m12()/scale, transform.m11()/scale) * 180/M_PI;
else {
- qmlInfo(q) << QQuickParentChange::tr("Unable to preserve appearance under scale of 0");
+ qmlWarning(q) << QQuickParentChange::tr("Unable to preserve appearance under scale of 0");
ok = false;
}
}
diff --git a/src/quick/items/qquicktext.cpp b/src/quick/items/qquicktext.cpp
index e37a7e6d5e..965fb0102f 100644
--- a/src/quick/items/qquicktext.cpp
+++ b/src/quick/items/qquicktext.cpp
@@ -1135,7 +1135,7 @@ void QQuickTextPrivate::setLineGeometry(QTextLine &line, qreal lineWidth, qreal
needToUpdateLayout = true;
}
} else if (image->pix->isError()) {
- qmlInfo(q) << image->pix->error();
+ qmlWarning(q) << image->pix->error();
}
}
@@ -2795,11 +2795,23 @@ void QQuickText::setRenderType(QQuickText::RenderType renderType)
/*!
\qmlmethod QtQuick::Text::doLayout()
+ \deprecated
- Triggers a re-layout of the displayed text.
+ Use \l forceLayout() instead.
*/
void QQuickText::doLayout()
{
+ forceLayout();
+}
+
+/*!
+ \qmlmethod QtQuick::Text::forceLayout()
+ \since 5.9
+
+ Triggers a re-layout of the displayed text.
+*/
+void QQuickText::forceLayout()
+{
Q_D(QQuickText);
d->updateSize();
}
diff --git a/src/quick/items/qquicktext_p.h b/src/quick/items/qquicktext_p.h
index 40dbd51f39..c3d3906e7e 100644
--- a/src/quick/items/qquicktext_p.h
+++ b/src/quick/items/qquicktext_p.h
@@ -218,7 +218,8 @@ public:
QRectF boundingRect() const Q_DECL_OVERRIDE;
QRectF clipRect() const Q_DECL_OVERRIDE;
- Q_INVOKABLE void doLayout();
+ Q_INVOKABLE void doLayout(); // ### Qt 6: remove
+ Q_REVISION(9) Q_INVOKABLE void forceLayout();
RenderType renderType() const;
void setRenderType(RenderType renderType);
diff --git a/src/quick/items/qquicktextdocument.cpp b/src/quick/items/qquicktextdocument.cpp
index 61d75fe99b..c272503480 100644
--- a/src/quick/items/qquicktextdocument.cpp
+++ b/src/quick/items/qquicktextdocument.cpp
@@ -211,7 +211,7 @@ QQuickPixmap *QQuickTextDocumentWithImageResources::loadPixmap(
if (p->isError()) {
if (!errors.contains(url)) {
errors.insert(url);
- qmlInfo(parent()) << p->error();
+ qmlWarning(parent()) << p->error();
}
}
return p;
diff --git a/src/quick/items/qquicktextedit.cpp b/src/quick/items/qquicktextedit.cpp
index 106acf57cf..075fd48a46 100644
--- a/src/quick/items/qquicktextedit.cpp
+++ b/src/quick/items/qquicktextedit.cpp
@@ -1729,7 +1729,9 @@ void QQuickTextEdit::select(int start, int end)
// QTBUG-11100
updateSelection();
+#if QT_CONFIG(im)
updateInputMethod();
+#endif
}
/*!
@@ -1741,7 +1743,7 @@ void QQuickTextEdit::select(int start, int end)
bool QQuickTextEdit::isRightToLeft(int start, int end)
{
if (start > end) {
- qmlInfo(this) << "isRightToLeft(start, end) called with the end property being smaller than the start.";
+ qmlWarning(this) << "isRightToLeft(start, end) called with the end property being smaller than the start.";
return false;
} else {
return getText(start, end).isRightToLeft();
diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp
index 27f3dcecfa..a023ad8a8c 100644
--- a/src/quick/items/qquicktextinput.cpp
+++ b/src/quick/items/qquicktextinput.cpp
@@ -1152,6 +1152,17 @@ bool QQuickTextInput::hasAcceptableInput() const
The corresponding handler is \c onEditingFinished.
*/
+/*!
+ \qmlsignal QtQuick::TextInput::textEdited()
+ \since 5.9
+
+ This signal is emitted whenever the text is edited. Unlike \c textChanged(),
+ this signal is not emitted when the text is changed programmatically, for example,
+ by changing the value of the \c text property or by calling \c clear().
+
+ The corresponding handler is \c onTextEdited.
+*/
+
#if QT_CONFIG(im)
Qt::InputMethodHints QQuickTextInputPrivate::effectiveInputMethodHints() const
{
@@ -1991,7 +2002,7 @@ void QQuickTextInput::selectAll()
bool QQuickTextInput::isRightToLeft(int start, int end)
{
if (start > end) {
- qmlInfo(this) << "isRightToLeft(start, end) called with the end property being smaller than the start.";
+ qmlWarning(this) << "isRightToLeft(start, end) called with the end property being smaller than the start.";
return false;
} else {
return text().midRef(start, end - start).isRightToLeft();
@@ -3499,7 +3510,7 @@ void QQuickTextInputPrivate::selectWordAtPos(int cursor)
The \a update value is currently unused.
*/
-bool QQuickTextInputPrivate::finishChange(int validateFromState, bool update, bool /*edited*/)
+bool QQuickTextInputPrivate::finishChange(int validateFromState, bool update, bool edited)
{
Q_Q(QQuickTextInput);
@@ -3570,6 +3581,8 @@ bool QQuickTextInputPrivate::finishChange(int validateFromState, bool update, bo
m_preeditDirty = false;
#endif
alignmentChanged = determineHorizontalAlignment();
+ if (edited)
+ emit q->textEdited();
emit q->textChanged();
}
diff --git a/src/quick/items/qquicktextinput_p.h b/src/quick/items/qquicktextinput_p.h
index f4545e1574..c4da807471 100644
--- a/src/quick/items/qquicktextinput_p.h
+++ b/src/quick/items/qquicktextinput_p.h
@@ -319,6 +319,7 @@ Q_SIGNALS:
void accepted();
void acceptableInputChanged();
Q_REVISION(2) void editingFinished();
+ Q_REVISION(9) void textEdited();
void colorChanged();
void selectionColorChanged();
void selectedTextColorChanged();
diff --git a/src/quick/items/qquicktextutil.cpp b/src/quick/items/qquicktextutil.cpp
index 8bcdb0b5f6..b07289f4a3 100644
--- a/src/quick/items/qquicktextutil.cpp
+++ b/src/quick/items/qquicktextutil.cpp
@@ -61,7 +61,7 @@ QQuickItem *QQuickTextUtil::createCursor(
item->setPosition(rectangle.topLeft());
item->setHeight(rectangle.height());
} else {
- qmlInfo(parent) << tr("%1 does not support loading non-visual cursor delegates.")
+ qmlWarning(parent) << tr("%1 does not support loading non-visual cursor delegates.")
.arg(QString::fromUtf8(className));
}
component->completeCreate();
@@ -72,7 +72,7 @@ QQuickItem *QQuickTextUtil::createCursor(
parent, SLOT(createCursor()), Qt::UniqueConnection);
return item;
}
- qmlInfo(parent, component->errors()) << tr("Could not load cursor delegate");
+ qmlWarning(parent, component->errors()) << tr("Could not load cursor delegate");
return item;
}
diff --git a/src/quick/items/qquickview.cpp b/src/quick/items/qquickview.cpp
index 573440ff7f..d7171bf910 100644
--- a/src/quick/items/qquickview.cpp
+++ b/src/quick/items/qquickview.cpp
@@ -62,6 +62,8 @@ void QQuickViewPrivate::init(QQmlEngine* e)
if (engine.isNull())
engine = new QQmlEngine(q);
+ QQmlEngine::setContextForObject(contentItem, engine.data()->rootContext());
+
if (!engine.data()->incubationController())
engine.data()->setIncubationController(q->incubationController());
diff --git a/src/quick/items/qquickview.h b/src/quick/items/qquickview.h
index 1fcc34e3a1..6d3b30e4c4 100644
--- a/src/quick/items/qquickview.h
+++ b/src/quick/items/qquickview.h
@@ -97,14 +97,14 @@ private Q_SLOTS:
void continueExecute();
protected:
- void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE;
- void timerEvent(QTimerEvent*) Q_DECL_OVERRIDE;
-
- void keyPressEvent(QKeyEvent *) Q_DECL_OVERRIDE;
- void keyReleaseEvent(QKeyEvent *) Q_DECL_OVERRIDE;
- void mousePressEvent(QMouseEvent *) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QMouseEvent *) Q_DECL_OVERRIDE;
- void mouseMoveEvent(QMouseEvent *) Q_DECL_OVERRIDE;
+ void resizeEvent(QResizeEvent *) override;
+ void timerEvent(QTimerEvent*) override;
+
+ void keyPressEvent(QKeyEvent *) override;
+ void keyReleaseEvent(QKeyEvent *) override;
+ void mousePressEvent(QMouseEvent *) override;
+ void mouseReleaseEvent(QMouseEvent *) override;
+ void mouseMoveEvent(QMouseEvent *) override;
private:
Q_DISABLE_COPY(QQuickView)
Q_DECLARE_PRIVATE(QQuickView)
diff --git a/src/quick/items/qquickview_p.h b/src/quick/items/qquickview_p.h
index a090bdc9f7..f92d4b95d6 100644
--- a/src/quick/items/qquickview_p.h
+++ b/src/quick/items/qquickview_p.h
@@ -88,7 +88,7 @@ public:
~QQuickViewPrivate();
void execute();
- void itemGeometryChanged(QQuickItem *item, QQuickGeometryChange change, const QRectF &) Q_DECL_OVERRIDE;
+ void itemGeometryChanged(QQuickItem *item, QQuickGeometryChange change, const QRectF &) override;
void initResize();
void updateSize();
void setRootObject(QObject *);
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp
index 07d87989b5..660c5f8067 100644
--- a/src/quick/items/qquickwindow.cpp
+++ b/src/quick/items/qquickwindow.cpp
@@ -2083,11 +2083,12 @@ void QQuickWindowPrivate::flushFrameSynchronousEvents()
ut->startAnimations();
}
- // Once per frame, send a synthetic hover, in case items have changed position.
+ // Once per frame, if any items are dirty, send a synthetic hover,
+ // in case items have changed position, visibility, etc.
// For instance, during animation (including the case of a ListView
// whose delegates contain MouseAreas), a MouseArea needs to know
// whether it has moved into a position where it is now under the cursor.
- if (!q->mouseGrabberItem() && !lastMousePosition.isNull()) {
+ if (!q->mouseGrabberItem() && !lastMousePosition.isNull() && dirtyItemList) {
bool accepted = false;
bool delivered = deliverHoverEvent(contentItem, lastMousePosition, lastMousePosition, QGuiApplication::keyboardModifiers(), 0, accepted);
if (!delivered)
diff --git a/src/quick/items/qquickwindowmodule.cpp b/src/quick/items/qquickwindowmodule.cpp
index ea1fc2f106..42313e4584 100644
--- a/src/quick/items/qquickwindowmodule.cpp
+++ b/src/quick/items/qquickwindowmodule.cpp
@@ -102,6 +102,9 @@ void QQuickWindowQmlImpl::classBegin()
{
Q_D(QQuickWindowQmlImpl);
QQmlEngine* e = qmlEngine(this);
+
+ QQmlEngine::setContextForObject(contentItem(), e->rootContext());
+
//Give QQuickView behavior when created from QML with QQmlApplicationEngine
if (QCoreApplication::instance()->property("__qml_using_qqmlapplicationengine") == QVariant(true)) {
if (e && !e->incubationController())
diff --git a/src/quick/quick.pro b/src/quick/quick.pro
index 8f4f9a8290..eae9b09b2f 100644
--- a/src/quick/quick.pro
+++ b/src/quick/quick.pro
@@ -9,6 +9,8 @@ win32-msvc*:DEFINES *= _CRT_SECURE_NO_WARNINGS
solaris-cc*:QMAKE_CXXFLAGS_RELEASE -= -O2
win32:!winrt: LIBS += -luser32
+DEFINES += QT_NO_FOREACH
+
exists("qqml_enable_gcov") {
QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage -fno-elide-constructors
LIBS_PRIVATE += -lgcov
diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarethreadedrenderloop.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwarethreadedrenderloop.cpp
index df5ec9b745..8abbefdd48 100644
--- a/src/quick/scenegraph/adaptations/software/qsgsoftwarethreadedrenderloop.cpp
+++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarethreadedrenderloop.cpp
@@ -618,6 +618,11 @@ void QSGSoftwareThreadedRenderLoop::windowDestroyed(QQuickWindow *window)
break;
}
}
+
+ // Now that we altered the window list, we may need to stop the animation
+ // timer even if we didn't via handleObscurity. This covers the case where
+ // we destroy a visible & exposed QQuickWindow.
+ startOrStopAnimationTimer();
}
void QSGSoftwareThreadedRenderLoop::exposureChanged(QQuickWindow *window)
diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
index b8ed190b33..d4324bc489 100644
--- a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
+++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
@@ -898,6 +898,7 @@ void Renderer::map(Buffer *buffer, int byteSize, bool isIndexBuf)
} else if (buffer->size != byteSize) {
free(buffer->data);
buffer->data = (char *) malloc(byteSize);
+ Q_CHECK_PTR(buffer->data);
}
buffer->size = byteSize;
}
@@ -2025,6 +2026,8 @@ Renderer::ClipType Renderer::updateStencilClip(const QSGClipNode *clip)
}
ClipType clipType = NoClip;
+ GLuint vbo = 0;
+ int vboSize = 0;
glDisable(GL_SCISSOR_TEST);
@@ -2109,7 +2112,21 @@ Renderer::ClipType Renderer::updateStencilClip(const QSGClipNode *clip)
const QSGGeometry *g = clip->geometry();
Q_ASSERT(g->attributeCount() > 0);
const QSGGeometry::Attribute *a = g->attributes();
- glVertexAttribPointer(0, a->tupleSize, a->type, GL_FALSE, g->sizeOfVertex(), g->vertexData());
+
+ if (!vbo)
+ glGenBuffers(1, &vbo);
+
+ glBindBuffer(GL_ARRAY_BUFFER, vbo);
+
+ const int vertexByteSize = g->sizeOfVertex() * g->vertexCount();
+ if (vboSize < vertexByteSize) {
+ vboSize = vertexByteSize;
+ glBufferData(GL_ARRAY_BUFFER, vertexByteSize, g->vertexData(), GL_STATIC_DRAW);
+ } else {
+ glBufferSubData(GL_ARRAY_BUFFER, 0, vertexByteSize, g->vertexData());
+ }
+
+ glVertexAttribPointer(0, a->tupleSize, a->type, GL_FALSE, g->sizeOfVertex(), 0);
m_clipProgram.setUniformValue(m_clipMatrixId, m);
if (g->indexCount()) {
@@ -2118,12 +2135,17 @@ Renderer::ClipType Renderer::updateStencilClip(const QSGClipNode *clip)
glDrawArrays(g->drawingMode(), 0, g->vertexCount());
}
+ glBindBuffer(GL_ARRAY_BUFFER, 0);
+
++m_currentStencilValue;
}
clip = clip->clipList();
}
+ if (vbo)
+ glDeleteBuffers(1, &vbo);
+
if (clipType & StencilClip) {
m_clipProgram.disableAttributeArray(0);
glStencilFunc(GL_EQUAL, m_currentStencilValue, 0xff); // stencil test, ref, test mask
diff --git a/src/quick/scenegraph/coreapi/qsggeometry.cpp b/src/quick/scenegraph/coreapi/qsggeometry.cpp
index a278c6079b..69a8c21ed2 100644
--- a/src/quick/scenegraph/coreapi/qsggeometry.cpp
+++ b/src/quick/scenegraph/coreapi/qsggeometry.cpp
@@ -675,6 +675,7 @@ void QSGGeometry::allocate(int vertexCount, int indexCount)
Q_ASSERT(m_index_type == UnsignedIntType || m_index_type == UnsignedShortType);
int indexByteSize = indexCount * (m_index_type == UnsignedShortType ? sizeof(quint16) : sizeof(quint32));
m_data = (void *) malloc(vertexByteSize + indexByteSize);
+ Q_CHECK_PTR(m_data);
m_index_data_offset = vertexByteSize;
m_owns_data = true;
}
diff --git a/src/quick/scenegraph/qsgadaptationlayer_p.h b/src/quick/scenegraph/qsgadaptationlayer_p.h
index bf267ccf92..03a1f7f281 100644
--- a/src/quick/scenegraph/qsgadaptationlayer_p.h
+++ b/src/quick/scenegraph/qsgadaptationlayer_p.h
@@ -87,6 +87,8 @@ class QSGRenderNode;
class Q_QUICK_PRIVATE_EXPORT QSGNodeVisitorEx
{
public:
+ virtual ~QSGNodeVisitorEx() {}
+
// visit(...) returns true if the children are supposed to be
// visisted and false if they're supposed to be skipped by the visitor.
diff --git a/src/quick/scenegraph/qsgthreadedrenderloop.cpp b/src/quick/scenegraph/qsgthreadedrenderloop.cpp
index 4543782d5b..5fa74027c1 100644
--- a/src/quick/scenegraph/qsgthreadedrenderloop.cpp
+++ b/src/quick/scenegraph/qsgthreadedrenderloop.cpp
@@ -280,7 +280,7 @@ public:
, stopEventProcessing(false)
{
sgrc = static_cast<QSGDefaultRenderContext *>(renderContext);
-#if defined(Q_OS_QNX) && !defined(Q_OS_BLACKBERRY) && defined(Q_PROCESSOR_X86)
+#if defined(Q_OS_QNX) && defined(Q_PROCESSOR_X86)
// The SDP 6.6.0 x86 MESA driver requires a larger stack than the default.
setStackSize(1024 * 1024);
#endif
@@ -826,13 +826,14 @@ void QSGThreadedRenderLoop::startOrStopAnimationTimer()
}
if (m_animation_timer != 0 && (exposedWindows == 1 || !m_animation_driver->isRunning())) {
+ qCDebug(QSG_LOG_RENDERLOOP) << "*** Stopping animation timer";
killTimer(m_animation_timer);
m_animation_timer = 0;
// If animations are running, make sure we keep on animating
if (m_animation_driver->isRunning())
maybePostPolishRequest(const_cast<Window *>(theOne));
-
} else if (m_animation_timer == 0 && exposedWindows != 1 && m_animation_driver->isRunning()) {
+ qCDebug(QSG_LOG_RENDERLOOP) << "*** Starting animation timer";
m_animation_timer = startTimer(qsgrl_animation_interval());
}
}
@@ -888,6 +889,11 @@ void QSGThreadedRenderLoop::windowDestroyed(QQuickWindow *window)
}
}
+ // Now that we altered the window list, we may need to stop the animation
+ // timer even if we didn't via handleObscurity. This covers the case where
+ // we destroy a visible & exposed QQuickWindow.
+ startOrStopAnimationTimer();
+
qCDebug(QSG_LOG_RENDERLOOP) << "done windowDestroyed()" << window;
}
diff --git a/src/quick/util/qquickanimation.cpp b/src/quick/util/qquickanimation.cpp
index 9de474ac36..1a2441171d 100644
--- a/src/quick/util/qquickanimation.cpp
+++ b/src/quick/util/qquickanimation.cpp
@@ -192,14 +192,14 @@ QQmlProperty QQuickAbstractAnimationPrivate::createProperty(QObject *obj, const
if (errorMessage)
*errorMessage = message;
else
- qmlInfo(infoObj) << message;
+ qmlWarning(infoObj) << message;
return QQmlProperty();
} else if (!prop.isWritable()) {
const QString message = QQuickAbstractAnimation::tr("Cannot animate read-only property \"%1\"").arg(str);
if (errorMessage)
*errorMessage = message;
else
- qmlInfo(infoObj) << message;
+ qmlWarning(infoObj) << message;
return QQmlProperty();
}
return prop;
@@ -256,7 +256,7 @@ void QQuickAbstractAnimation::setRunning(bool r)
return;
if (d->group || d->disableUserControl) {
- qmlInfo(this) << "setRunning() cannot be used on non-root animation nodes.";
+ qmlWarning(this) << "setRunning() cannot be used on non-root animation nodes.";
return;
}
@@ -322,12 +322,12 @@ void QQuickAbstractAnimation::setPaused(bool p)
return;
if (!d->running) {
- qmlInfo(this) << "setPaused() cannot be used when animation isn't running.";
+ qmlWarning(this) << "setPaused() cannot be used when animation isn't running.";
return;
}
if (d->group || d->disableUserControl) {
- qmlInfo(this) << "setPaused() cannot be used on non-root animation nodes.";
+ qmlWarning(this) << "setPaused() cannot be used on non-root animation nodes.";
return;
}
@@ -709,7 +709,7 @@ int QQuickPauseAnimation::duration() const
void QQuickPauseAnimation::setDuration(int duration)
{
if (duration < 0) {
- qmlInfo(this) << tr("Cannot set a duration of < 0");
+ qmlWarning(this) << tr("Cannot set a duration of < 0");
return;
}
@@ -1004,7 +1004,7 @@ void QQuickScriptActionPrivate::execute()
QQmlExpression expr(scriptStr);
expr.evaluate();
if (expr.hasError())
- qmlInfo(q) << expr.error();
+ qmlWarning(q) << expr.error();
}
}
@@ -2077,7 +2077,7 @@ int QQuickPropertyAnimation::duration() const
void QQuickPropertyAnimation::setDuration(int duration)
{
if (duration < 0) {
- qmlInfo(this) << tr("Cannot set a duration of < 0");
+ qmlWarning(this) << tr("Cannot set a duration of < 0");
return;
}
@@ -2644,7 +2644,7 @@ QQuickStateActions QQuickPropertyAnimation::createTransitionActions(QQuickStateA
if (!successfullyCreatedDefaultProperty) {
for (const QString &errorMessage : qAsConst(errorMessages))
- qmlInfo(this) << errorMessage;
+ qmlWarning(this) << errorMessage;
}
}
diff --git a/src/quick/util/qquickanimationcontroller.cpp b/src/quick/util/qquickanimationcontroller.cpp
index 4bc2d6319e..fa1ade50d1 100644
--- a/src/quick/util/qquickanimationcontroller.cpp
+++ b/src/quick/util/qquickanimationcontroller.cpp
@@ -169,7 +169,7 @@ void QQuickAnimationController::setAnimation(QQuickAbstractAnimation *animation)
if (animation != d->animation) {
if (animation) {
if (animation->userControlDisabled()) {
- qmlInfo(this) << "QQuickAnimationController::setAnimation: the animation is controlled by others, can't be used in AnimationController.";
+ qmlWarning(this) << "QQuickAnimationController::setAnimation: the animation is controlled by others, can't be used in AnimationController.";
return;
}
animation->setDisableUserControl();
diff --git a/src/quick/util/qquickanimator.cpp b/src/quick/util/qquickanimator.cpp
index 5d2af0f940..c3b5865369 100644
--- a/src/quick/util/qquickanimator.cpp
+++ b/src/quick/util/qquickanimator.cpp
@@ -50,6 +50,7 @@ QT_BEGIN_NAMESPACE
\inqmlmodule QtQuick
\since 5.2
\ingroup qtquick-transitions-animations
+ \inherits Animation
\brief Is the base of all QML animators.
Animator types are a special type of animation which operate
diff --git a/src/quick/util/qquickbehavior.cpp b/src/quick/util/qquickbehavior.cpp
index 9af1d41b29..1b2d9afb7c 100644
--- a/src/quick/util/qquickbehavior.cpp
+++ b/src/quick/util/qquickbehavior.cpp
@@ -129,7 +129,7 @@ void QQuickBehavior::setAnimation(QQuickAbstractAnimation *animation)
{
Q_D(QQuickBehavior);
if (d->animation) {
- qmlInfo(this) << tr("Cannot change the animation assigned to a Behavior.");
+ qmlWarning(this) << tr("Cannot change the animation assigned to a Behavior.");
return;
}
diff --git a/src/quick/util/qquickfontloader.cpp b/src/quick/util/qquickfontloader.cpp
index d13291c30a..3761a37a6d 100644
--- a/src/quick/util/qquickfontloader.cpp
+++ b/src/quick/util/qquickfontloader.cpp
@@ -307,7 +307,7 @@ void QQuickFontLoader::updateFontInfo(const QString& name, QQuickFontLoader::Sta
}
if (status != d->status) {
if (status == Error)
- qmlInfo(this) << "Cannot load font: \"" << d->url.toString() << '"';
+ qmlWarning(this) << "Cannot load font: \"" << d->url.toString() << '"';
d->status = status;
emit statusChanged();
}
diff --git a/src/quick/util/qquickpath.cpp b/src/quick/util/qquickpath.cpp
index 337d63e53b..afcbc4cc0a 100644
--- a/src/quick/util/qquickpath.cpp
+++ b/src/quick/util/qquickpath.cpp
@@ -216,20 +216,6 @@ bool QQuickPath::isClosed() const
return d->closed;
}
-bool QQuickPath::hasEnd() const
-{
- Q_D(const QQuickPath);
- for (int i = d->_pathElements.count() - 1; i > -1; --i) {
- if (QQuickCurve *curve = qobject_cast<QQuickCurve *>(d->_pathElements.at(i))) {
- if ((!curve->hasX() && !curve->hasRelativeX()) || (!curve->hasY() && !curve->hasRelativeY()))
- return false;
- else
- return true;
- }
- }
- return hasStartX() && hasStartY();
-}
-
/*!
\qmlproperty list<PathElement> QtQuick::Path::pathElements
This property holds the objects composing the path.
diff --git a/src/quick/util/qquickpath_p.h b/src/quick/util/qquickpath_p.h
index 4bcefb032e..1c639db9ce 100644
--- a/src/quick/util/qquickpath_p.h
+++ b/src/quick/util/qquickpath_p.h
@@ -405,7 +405,6 @@ public:
bool hasStartY() const;
bool isClosed() const;
- bool hasEnd() const;
QPainterPath path() const;
QStringList attributes() const;
diff --git a/src/quick/util/qquickpropertychanges.cpp b/src/quick/util/qquickpropertychanges.cpp
index fafa2edd0b..20aa52e472 100644
--- a/src/quick/util/qquickpropertychanges.cpp
+++ b/src/quick/util/qquickpropertychanges.cpp
@@ -397,10 +397,10 @@ QQuickPropertyChangesPrivate::property(const QString &property)
Q_Q(QQuickPropertyChanges);
QQmlProperty prop(object, property, qmlContext(q));
if (!prop.isValid()) {
- qmlInfo(q) << QQuickPropertyChanges::tr("Cannot assign to non-existent property \"%1\"").arg(property);
+ qmlWarning(q) << QQuickPropertyChanges::tr("Cannot assign to non-existent property \"%1\"").arg(property);
return QQmlProperty();
} else if (!(prop.type() & QQmlProperty::SignalProperty) && !prop.isWritable()) {
- qmlInfo(q) << QQuickPropertyChanges::tr("Cannot assign to read-only property \"%1\"").arg(property);
+ qmlWarning(q) << QQuickPropertyChanges::tr("Cannot assign to read-only property \"%1\"").arg(property);
return QQmlProperty();
}
return prop;
diff --git a/src/quick/util/qquickstatechangescript.cpp b/src/quick/util/qquickstatechangescript.cpp
index 86b70fe879..a70fa1a676 100644
--- a/src/quick/util/qquickstatechangescript.cpp
+++ b/src/quick/util/qquickstatechangescript.cpp
@@ -131,7 +131,7 @@ void QQuickStateChangeScript::execute()
QQmlExpression expr(d->script);
expr.evaluate();
if (expr.hasError())
- qmlInfo(this, expr.error());
+ qmlWarning(this, expr.error());
}
}
diff --git a/src/quick/util/qquickstategroup.cpp b/src/quick/util/qquickstategroup.cpp
index 200f243a1b..f2cd4638fc 100644
--- a/src/quick/util/qquickstategroup.cpp
+++ b/src/quick/util/qquickstategroup.cpp
@@ -438,7 +438,7 @@ void QQuickStateGroupPrivate::setCurrentStateInternal(const QString &state,
}
if (applyingState) {
- qmlInfo(q) << "Can't apply a state change as part of a state definition.";
+ qmlWarning(q) << "Can't apply a state change as part of a state definition.";
return;
}
diff --git a/src/quick/util/qquickvaluetypes.cpp b/src/quick/util/qquickvaluetypes.cpp
index e673df0451..4afcb07a5c 100644
--- a/src/quick/util/qquickvaluetypes.cpp
+++ b/src/quick/util/qquickvaluetypes.cpp
@@ -56,8 +56,7 @@ namespace QQuickValueTypes {
QString QQuickColorValueType::toString() const
{
- // to maintain behaviour with QtQuick 1.0, we just output normal toString() value.
- return QVariant(v).toString();
+ return v.name(v.alpha() != 255 ? QColor::HexArgb : QColor::HexRgb);
}
qreal QQuickColorValueType::r() const
diff --git a/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp b/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp
index 40e19d375d..8c30a82317 100644
--- a/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp
+++ b/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp
@@ -45,6 +45,7 @@
#include <QtQml/qqmlcomponent.h>
#include <QtQml/qqmlexpression.h>
#include <QtQml/qqmlproperty.h>
+#include <QtQml/qqmlincubator.h>
#include <QtQuick/qquickitem.h>
#include <QtNetwork/qhostaddress.h>
@@ -136,6 +137,7 @@ private slots:
void regression_QTCREATORBUG_7451();
void queryObjectWithNonStreamableTypes();
+ void asynchronousCreate();
};
QmlDebugObjectReference tst_QQmlEngineDebugService::findRootObject(
@@ -1220,6 +1222,32 @@ void tst_QQmlEngineDebugService::queryObjectTree()
QCOMPARE(findProperty(animation.properties,"duration").value.toInt(), 100);
}
+void tst_QQmlEngineDebugService::asynchronousCreate() {
+ QmlDebugObjectReference object;
+ auto connection = connect(m_dbg, &QQmlEngineDebugClient::newObject, this, [&](int objectId) {
+ object.debugId = objectId;
+ });
+
+ QByteArray asynchronousComponent = "import QtQuick 2.5\n"
+ "Rectangle { id: asyncRect }";
+ QQmlComponent component(m_engine);
+ component.setData(asynchronousComponent, QUrl::fromLocalFile(""));
+ QVERIFY(component.isReady()); // fails if bad syntax
+ QQmlIncubator incubator(QQmlIncubator::Asynchronous);
+ component.create(incubator);
+
+ QVERIFY(m_dbg->object().idString != QLatin1String("asyncRect"));
+
+ QTRY_VERIFY(object.debugId != -1);
+ disconnect(connection);
+
+ bool success = false;
+ m_dbg->queryObject(object, &success);
+ QVERIFY(success);
+
+ QTRY_COMPARE(m_dbg->object().idString, QLatin1String("asyncRect"));
+}
+
int main(int argc, char *argv[])
{
int _argc = argc + 1;
diff --git a/tests/auto/qml/debugger/qqmlinspector/data/qtquick2.qml b/tests/auto/qml/debugger/qqmlinspector/data/qtquick2.qml
index f44c653840..f43cff15e4 100644
--- a/tests/auto/qml/debugger/qqmlinspector/data/qtquick2.qml
+++ b/tests/auto/qml/debugger/qqmlinspector/data/qtquick2.qml
@@ -29,16 +29,15 @@ Rectangle {
}
var milliDelta = millis - prevHit;
- if (milliDelta < 0)
+ if (milliDelta <= 0)
milliDelta += 1000;
- console.log(milliDelta, "milliseconds ");
prevHit = millis;
var delta = parent.rotation - prevRotation;
if (delta < 0)
delta += 360
prevRotation = parent.rotation
- console.log(delta, "degrees ");
+ console.log(milliDelta, delta, "ms/degrees ");
}
}
}
diff --git a/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp b/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp
index f55fef232e..9461922eff 100644
--- a/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp
+++ b/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp
@@ -102,29 +102,46 @@ void tst_QQmlInspector::startQmlProcess(const QString &qmlFile, bool restrictSer
void tst_QQmlInspector::checkAnimationSpeed(int targetMillisPerDegree)
{
- QString degreesString = QStringLiteral("degrees");
- QString millisecondsString = QStringLiteral("milliseconds");
- for (int i = 0; i < 2; ++i) { // skip one period; the change might have happened inside it
- int position = m_process->output().length();
- while (!m_process->output().mid(position).contains(degreesString) ||
- !m_process->output().mid(position).contains(millisecondsString)) {
+ const QString markerString = QStringLiteral("ms/degrees");
+
+ // Funny things can happen with time and VMs. Also the change might take a while to propagate.
+ // Thus, we wait until we either have 3 passes or 3 failures in a row, or 10 loops have passed.
+
+ int numFailures = 0;
+ int numPasses = 0;
+
+ for (int i = 0; i < 10; ++i) {
+ QString output = m_process->output();
+ int position = output.length();
+ do {
QVERIFY(QQmlDebugTest::waitForSignal(m_process.data(),
SIGNAL(readyReadStandardOutput())));
+ output = m_process->output();
+ } while (!output.mid(position).contains(markerString));
+
+
+ QStringList words = output.split(QLatin1Char(' '));
+ const int marker = words.lastIndexOf(markerString);
+ QVERIFY(marker > 1);
+ const double degrees = words[marker - 1].toDouble();
+ const int milliseconds = words[marker - 2].toInt();
+ const double millisecondsPerDegree = milliseconds / degrees;
+
+ if (millisecondsPerDegree > targetMillisPerDegree - 3
+ || millisecondsPerDegree < targetMillisPerDegree + 3) {
+ if (++numPasses == 3)
+ return; // pass
+ numFailures = 0;
+ } else {
+ QVERIFY2(++numFailures < 3,
+ QString("3 consecutive failures when checking for %1 milliseconds per degree")
+ .arg(targetMillisPerDegree).toLocal8Bit().constData());
+ numPasses = 0;
}
}
- QStringList words = m_process->output().split(QLatin1Char(' '));
- int degreesMarker = words.lastIndexOf(degreesString);
- QVERIFY(degreesMarker > 1);
- double degrees = words[degreesMarker - 1].toDouble();
- int millisecondsMarker = words.lastIndexOf(millisecondsString);
- QVERIFY(millisecondsMarker > 1);
- int milliseconds = words[millisecondsMarker - 1].toInt();
-
- double millisecondsPerDegree = milliseconds / degrees;
- QVERIFY(millisecondsPerDegree > targetMillisPerDegree - 3);
- QVERIFY(millisecondsPerDegree < targetMillisPerDegree + 3);
-
+ QFAIL(QString("Animation speed won't settle to %1 milliseconds per degree")
+ .arg(targetMillisPerDegree).toLocal8Bit().constData());
}
void tst_QQmlInspector::cleanup()
diff --git a/tests/auto/qml/debugger/shared/qqmlenginedebugclient.cpp b/tests/auto/qml/debugger/shared/qqmlenginedebugclient.cpp
index 3ad7beb7ff..3e27951d78 100644
--- a/tests/auto/qml/debugger/shared/qqmlenginedebugclient.cpp
+++ b/tests/auto/qml/debugger/shared/qqmlenginedebugclient.cpp
@@ -489,7 +489,9 @@ void QQmlEngineDebugClient::messageReceived(const QByteArray &data)
return;
} else if (type == "OBJECT_CREATED") {
- emit newObjects();
+ int engineId, objectId, parentId;
+ ds >> engineId >> objectId >> parentId;
+ emit newObject(objectId);
return;
} else if (type == "SET_BINDING_R") {
ds >> m_valid;
diff --git a/tests/auto/qml/debugger/shared/qqmlenginedebugclient.h b/tests/auto/qml/debugger/shared/qqmlenginedebugclient.h
index a64a77e13e..5d74f2d43c 100644
--- a/tests/auto/qml/debugger/shared/qqmlenginedebugclient.h
+++ b/tests/auto/qml/debugger/shared/qqmlenginedebugclient.h
@@ -213,7 +213,7 @@ public:
bool valid() { return m_valid; }
signals:
- void newObjects();
+ void newObject(int objectId);
void valueChanged(QByteArray,QVariant);
void result();
diff --git a/tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp b/tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp
index 8af446173d..b265607fd1 100644
--- a/tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp
+++ b/tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp
@@ -53,6 +53,7 @@ private slots:
void registerImportForImplicitComponent();
void basicVersionChecks();
void recompileAfterChange();
+ void recompileAfterDirectoryChange();
void fileSelectors();
void localAliases();
void cacheResources();
@@ -95,11 +96,17 @@ struct TestCompiler
TestCompiler(QQmlEngine *engine)
: engine(engine)
, tempDir()
- , testFilePath(tempDir.path() + QStringLiteral("/test.qml"))
- , cacheFilePath(tempDir.path() + QStringLiteral("/test.qmlc"))
- , mappedFile(cacheFilePath)
, currentMapping(nullptr)
{
+ init(tempDir.path());
+ }
+
+ void init(const QString &baseDirectory)
+ {
+ closeMapping();
+ testFilePath = baseDirectory + QStringLiteral("/test.qml");
+ cacheFilePath = baseDirectory + QStringLiteral("/test.qmlc");
+ mappedFile.setFileName(cacheFilePath);
}
bool compile(const QByteArray &contents)
@@ -187,8 +194,8 @@ struct TestCompiler
QQmlEngine *engine;
const QTemporaryDir tempDir;
- const QString testFilePath;
- const QString cacheFilePath;
+ QString testFilePath;
+ QString cacheFilePath;
QString lastErrorString;
QFile mappedFile;
uchar *currentMapping;
@@ -441,6 +448,47 @@ void tst_qmldiskcache::recompileAfterChange()
}
}
+void tst_qmldiskcache::recompileAfterDirectoryChange()
+{
+ QQmlEngine engine;
+ TestCompiler testCompiler(&engine);
+
+ QVERIFY(testCompiler.tempDir.isValid());
+
+ QVERIFY(QDir(testCompiler.tempDir.path()).mkdir("source1"));
+ testCompiler.init(testCompiler.tempDir.path() + QLatin1String("/source1"));
+
+ {
+ const QByteArray contents = QByteArrayLiteral("import QtQml 2.0\n"
+ "QtObject {\n"
+ " property int blah: 42;\n"
+ "}");
+
+ testCompiler.clearCache();
+ QVERIFY2(testCompiler.compile(contents), qPrintable(testCompiler.lastErrorString));
+ QVERIFY2(testCompiler.verify(), qPrintable(testCompiler.lastErrorString));
+ testCompiler.closeMapping();
+ }
+
+ const QDateTime initialCacheTimeStamp = QFileInfo(testCompiler.cacheFilePath).lastModified();
+
+ QDir(testCompiler.tempDir.path()).rename(QStringLiteral("source1"), QStringLiteral("source2"));
+ waitForFileSystem();
+
+ testCompiler.init(testCompiler.tempDir.path() + QLatin1String("/source2"));
+
+ {
+ CleanlyLoadingComponent component(&engine, testCompiler.testFilePath);
+ QScopedPointer<QObject> obj(component.create());
+ QVERIFY(!obj.isNull());
+ QCOMPARE(obj->property("blah").toInt(), 42);
+ }
+
+ QFile cacheFile(testCompiler.cacheFilePath);
+ QVERIFY2(cacheFile.exists(), qPrintable(cacheFile.fileName()));
+ QVERIFY(QFileInfo(testCompiler.cacheFilePath).lastModified() > initialCacheTimeStamp);
+}
+
void tst_qmldiskcache::fileSelectors()
{
QQmlEngine engine;
diff --git a/tests/auto/qml/qqmlapplicationengine/data/LocalComponent.qml b/tests/auto/qml/qqmlapplicationengine/data/LocalComponent.qml
new file mode 100644
index 0000000000..ece4f45b4a
--- /dev/null
+++ b/tests/auto/qml/qqmlapplicationengine/data/LocalComponent.qml
@@ -0,0 +1,6 @@
+import QtQml 2.0
+
+// used in nonResolvedLocal
+QtObject {
+
+}
diff --git a/tests/auto/qml/qqmlapplicationengine/data/nonResolvedLocal.qml b/tests/auto/qml/qqmlapplicationengine/data/nonResolvedLocal.qml
new file mode 100644
index 0000000000..45a235346d
--- /dev/null
+++ b/tests/auto/qml/qqmlapplicationengine/data/nonResolvedLocal.qml
@@ -0,0 +1,9 @@
+import QtQml 2.0
+
+QtObject {
+ property bool success: true
+
+ property QtObject local: LocalComponent {
+ }
+}
+
diff --git a/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.cpp b/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.cpp
index 98b92e5fab..74add85cb0 100644
--- a/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.cpp
+++ b/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.cpp
@@ -42,6 +42,7 @@ public:
private slots:
void initTestCase();
void basicLoading();
+ void testNonResolvedPath();
void application();
void applicationProperties();
private:
@@ -83,6 +84,29 @@ void tst_qqmlapplicationengine::basicLoading()
delete test;
}
+// make sure we resolve a relative URL to an absolute one, otherwise things
+// will break.
+void tst_qqmlapplicationengine::testNonResolvedPath()
+{
+ {
+ // NOTE NOTE NOTE! Missing testFileUrl is *WANTED* here! We want a
+ // non-resolved URL.
+ QQmlApplicationEngine test("data/nonResolvedLocal.qml");
+ QCOMPARE(test.rootObjects().size(), 1);
+ QVERIFY(test.rootObjects()[0]);
+ QVERIFY(test.rootObjects()[0]->property("success").toBool());
+ }
+ {
+ QQmlApplicationEngine test;
+ // NOTE NOTE NOTE! Missing testFileUrl is *WANTED* here! We want a
+ // non-resolved URL.
+ test.load("data/nonResolvedLocal.qml");
+ QCOMPARE(test.rootObjects().size(), 1);
+ QVERIFY(test.rootObjects()[0]);
+ QVERIFY(test.rootObjects()[0]->property("success").toBool());
+ }
+}
+
void tst_qqmlapplicationengine::application()
{
/* This test batches together some tests about running an external application
diff --git a/tests/auto/qml/qqmlecmascript/data/signalParameterTypes.qml b/tests/auto/qml/qqmlecmascript/data/signalParameterTypes.qml
index 4fc2dab943..676593096c 100644
--- a/tests/auto/qml/qqmlecmascript/data/signalParameterTypes.qml
+++ b/tests/auto/qml/qqmlecmascript/data/signalParameterTypes.qml
@@ -15,4 +15,6 @@ MyQmlObject
onMySignal: { intProperty = a; realProperty = b; colorProperty = c; variantProperty = d; enumProperty = e; qtEnumProperty = f; }
onBasicSignal: root.mySignal(10, 19.2, Qt.rgba(1, 1, 0, 1), Qt.rgba(1, 0, 1, 1), MyQmlObject.EnumValue3, Qt.LeftButton)
+
+ onQjsValueEmittingSignal: {}
}
diff --git a/tests/auto/qml/qqmlecmascript/testtypes.h b/tests/auto/qml/qqmlecmascript/testtypes.h
index 47fb2a56e7..1f7f3344ef 100644
--- a/tests/auto/qml/qqmlecmascript/testtypes.h
+++ b/tests/auto/qml/qqmlecmascript/testtypes.h
@@ -244,6 +244,7 @@ signals:
void signalWithGlobalName(int parseInt);
void intChanged();
void qjsvalueChanged();
+ void qjsValueEmittingSignal(QJSValue value);
public slots:
void deleteMe() { delete this; }
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
index 88a8886ecb..8c0b0601fc 100644
--- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
+++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
@@ -331,6 +331,8 @@ private slots:
void qtbug_54589();
void qtbug_54687();
void stringify_qtbug_50592();
+ void instanceof_data();
+ void instanceof();
private:
// static void propertyVarWeakRefCallback(v8::Persistent<v8::Value> object, void* parameter);
@@ -1410,6 +1412,7 @@ void tst_qqmlecmascript::signalParameterTypes()
QVERIFY(object != 0);
emit object->basicSignal();
+ emit object->qjsValueEmittingSignal(QJSValue());
QCOMPARE(object->property("intProperty").toInt(), 10);
QCOMPARE(object->property("realProperty").toReal(), 19.2);
@@ -8113,6 +8116,68 @@ void tst_qqmlecmascript::stringify_qtbug_50592()
QCOMPARE(obj->property("source").toString(), QString::fromLatin1("http://example.org/some_nonexistant_image.png"));
}
+void tst_qqmlecmascript::instanceof_data()
+{
+ QTest::addColumn<QString>("setupCode");
+ QTest::addColumn<QVariant>("expectedValue");
+
+ // so the way this works is that the name of the test tag defines the test
+ // to run. the code in setupCode defines code run before the actual test
+ // (e.g. to create vars).
+ //
+ // the expectedValue is either a boolean true or false for whether the two
+ // operands are indeed an instanceof each other, or a string for the
+ // expected error message.
+ QTest::newRow("String instanceof String")
+ << ""
+ << QVariant(false);
+ QTest::newRow("s instanceof String")
+ << "var s = \"hello\""
+ << QVariant(false);
+ QTest::newRow("objectString instanceof String")
+ << "var objectString = new String(\"hello\")"
+ << QVariant(true);
+ QTest::newRow("o instanceof Object")
+ << "var o = new Object()"
+ << QVariant(true);
+ QTest::newRow("o instanceof String")
+ << "var o = new Object()"
+ << QVariant(false);
+ QTest::newRow("true instanceof true")
+ << ""
+ << QVariant("TypeError: Type error");
+ QTest::newRow("1 instanceof Math")
+ << ""
+ << QVariant("TypeError: Type error");
+ QTest::newRow("date instanceof Date")
+ << "var date = new Date"
+ << QVariant(true);
+ QTest::newRow("date instanceof Object")
+ << "var date = new Date"
+ << QVariant(true);
+ QTest::newRow("date instanceof String")
+ << "var date = new Date"
+ << QVariant(false);
+}
+
+void tst_qqmlecmascript::instanceof()
+{
+ QFETCH(QString, setupCode);
+ QFETCH(QVariant, expectedValue);
+
+ QJSEngine engine;
+ QJSValue ret = engine.evaluate(setupCode + ";\n" + QTest::currentDataTag());
+
+ if (expectedValue.type() == QMetaType::Bool) {
+ bool returnValue = ret.toBool();
+ QVERIFY2(!ret.isError(), qPrintable(ret.toString()));
+ QCOMPARE(returnValue, expectedValue.toBool());
+ } else {
+ QVERIFY2(ret.isError(), qPrintable(ret.toString()));
+ QCOMPARE(ret.toString(), expectedValue.toString());
+ }
+}
+
QTEST_MAIN(tst_qqmlecmascript)
#include "tst_qqmlecmascript.moc"
diff --git a/tests/auto/qml/qqmlinfo/tst_qqmlinfo.cpp b/tests/auto/qml/qqmlinfo/tst_qqmlinfo.cpp
index acda06c8d8..3f6c200027 100644
--- a/tests/auto/qml/qqmlinfo/tst_qqmlinfo.cpp
+++ b/tests/auto/qml/qqmlinfo/tst_qqmlinfo.cpp
@@ -49,6 +49,7 @@ private slots:
void nonQmlContextedObject();
void types();
void chaining();
+ void messageTypes();
private:
QQmlEngine engine;
@@ -62,14 +63,14 @@ void tst_qqmlinfo::qmlObject()
QVERIFY(object != 0);
QString message = component.url().toString() + ":3:1: QML QtObject: Test Message";
- QTest::ignoreMessage(QtWarningMsg, qPrintable(message));
+ QTest::ignoreMessage(QtInfoMsg, qPrintable(message));
qmlInfo(object) << "Test Message";
QObject *nested = qvariant_cast<QObject *>(object->property("nested"));
QVERIFY(nested != 0);
message = component.url().toString() + ":6:13: QML QtObject: Second Test Message";
- QTest::ignoreMessage(QtWarningMsg, qPrintable(message));
+ QTest::ignoreMessage(QtInfoMsg, qPrintable(message));
qmlInfo(nested) << "Second Test Message";
}
@@ -86,11 +87,11 @@ void tst_qqmlinfo::nestedQmlObject()
QVERIFY(nested2 != 0);
QString message = component.url().toString() + ":5:13: QML NestedObject: Outer Object";
- QTest::ignoreMessage(QtWarningMsg, qPrintable(message));
+ QTest::ignoreMessage(QtInfoMsg, qPrintable(message));
qmlInfo(nested) << "Outer Object";
message = testFileUrl("NestedObject.qml").toString() + ":6:14: QML QtObject: Inner Object";
- QTest::ignoreMessage(QtWarningMsg, qPrintable(message));
+ QTest::ignoreMessage(QtInfoMsg, qPrintable(message));
qmlInfo(nested2) << "Inner Object";
}
@@ -107,28 +108,28 @@ void tst_qqmlinfo::nestedComponent()
QVERIFY(nested2 != 0);
QString message = component.url().toString() + ":10:9: QML NestedObject: Complex Object";
- QTest::ignoreMessage(QtWarningMsg, qPrintable(message));
+ QTest::ignoreMessage(QtInfoMsg, qPrintable(message));
qmlInfo(nested) << "Complex Object";
message = component.url().toString() + ":16:9: QML Image: Simple Object";
- QTest::ignoreMessage(QtWarningMsg, qPrintable(message));
+ QTest::ignoreMessage(QtInfoMsg, qPrintable(message));
qmlInfo(nested2) << "Simple Object";
}
void tst_qqmlinfo::nonQmlObject()
{
QObject object;
- QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML QtObject: Test Message");
+ QTest::ignoreMessage(QtInfoMsg, "<Unknown File>: QML QtObject: Test Message");
qmlInfo(&object) << "Test Message";
QTimer nonQmlObject;
- QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML QTimer: Test Message");
+ QTest::ignoreMessage(QtInfoMsg, "<Unknown File>: QML QTimer: Test Message");
qmlInfo(&nonQmlObject) << "Test Message";
}
void tst_qqmlinfo::nullObject()
{
- QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: Null Object Test Message");
+ QTest::ignoreMessage(QtInfoMsg, "<Unknown File>: Null Object Test Message");
qmlInfo(0) << "Null Object Test Message";
}
@@ -137,50 +138,50 @@ void tst_qqmlinfo::nonQmlContextedObject()
QObject object;
QQmlContext context(&engine);
QQmlEngine::setContextForObject(&object, &context);
- QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML QtObject: Test Message");
+ QTest::ignoreMessage(QtInfoMsg, "<Unknown File>: QML QtObject: Test Message");
qmlInfo(&object) << "Test Message";
}
void tst_qqmlinfo::types()
{
- QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: false");
+ QTest::ignoreMessage(QtInfoMsg, "<Unknown File>: false");
qmlInfo(0) << false;
- QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: 1.1");
+ QTest::ignoreMessage(QtInfoMsg, "<Unknown File>: 1.1");
qmlInfo(0) << 1.1;
- QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: 1.2");
+ QTest::ignoreMessage(QtInfoMsg, "<Unknown File>: 1.2");
qmlInfo(0) << 1.2f;
- QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: 15");
+ QTest::ignoreMessage(QtInfoMsg, "<Unknown File>: 15");
qmlInfo(0) << 15;
- QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: 'b'");
+ QTest::ignoreMessage(QtInfoMsg, "<Unknown File>: 'b'");
qmlInfo(0) << QChar('b');
- QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: \"Qt\"");
+ QTest::ignoreMessage(QtInfoMsg, "<Unknown File>: \"Qt\"");
qmlInfo(0) << QByteArray("Qt");
- QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: true");
+ QTest::ignoreMessage(QtInfoMsg, "<Unknown File>: true");
qmlInfo(0) << bool(true);
//### do we actually want QUrl to show up in the output?
//### why the extra space at the end?
- QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QUrl(\"http://www.qt-project.org\") ");
+ QTest::ignoreMessage(QtInfoMsg, "<Unknown File>: QUrl(\"http://www.qt-project.org\") ");
qmlInfo(0) << QUrl("http://www.qt-project.org");
//### should this be quoted?
- QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: hello");
+ QTest::ignoreMessage(QtInfoMsg, "<Unknown File>: hello");
qmlInfo(0) << QLatin1String("hello");
//### should this be quoted?
- QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: World");
+ QTest::ignoreMessage(QtInfoMsg, "<Unknown File>: World");
QString str("Hello World");
QStringRef ref(&str, 6, 5);
qmlInfo(0) << ref;
//### should this be quoted?
- QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: Quick");
+ QTest::ignoreMessage(QtInfoMsg, "<Unknown File>: Quick");
qmlInfo(0) << QString ("Quick");
}
@@ -188,7 +189,7 @@ void tst_qqmlinfo::chaining()
{
QString str("Hello World");
QStringRef ref(&str, 6, 5);
- QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: false 1.1 1.2 15 hello 'b' World \"Qt\" true Quick QUrl(\"http://www.qt-project.org\") ");
+ QTest::ignoreMessage(QtInfoMsg, "<Unknown File>: false 1.1 1.2 15 hello 'b' World \"Qt\" true Quick QUrl(\"http://www.qt-project.org\") ");
qmlInfo(0) << false << ' '
<< 1.1 << ' '
<< 1.2f << ' '
@@ -202,6 +203,19 @@ void tst_qqmlinfo::chaining()
<< QUrl("http://www.qt-project.org");
}
+// Ensure that messages of different types are sent with the correct QtMsgType.
+void tst_qqmlinfo::messageTypes()
+{
+ QTest::ignoreMessage(QtDebugMsg, "<Unknown File>: debug");
+ qmlDebug(0) << QLatin1String("debug");
+
+ QTest::ignoreMessage(QtInfoMsg, "<Unknown File>: info");
+ qmlInfo(0) << QLatin1String("info");
+
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: warning");
+ qmlWarning(0) << QLatin1String("warning");
+}
+
QTEST_MAIN(tst_qqmlinfo)
#include "tst_qqmlinfo.moc"
diff --git a/tests/auto/qml/qqmllocale/data/date.qml b/tests/auto/qml/qqmllocale/data/date.qml
index 3f58497d22..d8cd043cdf 100644
--- a/tests/auto/qml/qqmllocale/data/date.qml
+++ b/tests/auto/qml/qqmllocale/data/date.qml
@@ -7,6 +7,7 @@ QtObject {
locale = Qt.locale(l)
}
+ // Month number 9 is October: JS Date()'s month range is 0 to 11.
function toLocaleString(fmt) {
var d = new Date(2011, 9, 7, 18, 53, 48, 345);
if (fmt < 0)
diff --git a/tests/auto/qml/qqmllocale/tst_qqmllocale.cpp b/tests/auto/qml/qqmllocale/tst_qqmllocale.cpp
index 4d2cae1523..d0ce83b997 100644
--- a/tests/auto/qml/qqmllocale/tst_qqmllocale.cpp
+++ b/tests/auto/qml/qqmllocale/tst_qqmllocale.cpp
@@ -640,9 +640,7 @@ void tst_qqmllocale::dateToLocaleString()
QObject *obj = c.create();
QVERIFY(obj);
- QDateTime dt;
- dt.setDate(QDate(2011, 10, 7)); // weirdly, JS Date month range is 0-11
- dt.setTime(QTime(18, 53, 48, 345));
+ const QDateTime dt(QDate(2011, 10, 7), QTime(18, 53, 48, 345));
QMetaObject::invokeMethod(obj, "setLocale", Qt::DirectConnection,
Q_ARG(QVariant, QVariant(locale)));
@@ -701,9 +699,7 @@ void tst_qqmllocale::dateToLocaleStringFormatted()
QObject *obj = c.create();
QVERIFY(obj);
- QDateTime dt;
- dt.setDate(QDate(2011, 10, 7)); // weirdly, JS Date month range is 0-11
- dt.setTime(QTime(18, 53, 48, 345));
+ const QDateTime dt(QDate(2011, 10, 7), QTime(18, 53, 48, 345));
QMetaObject::invokeMethod(obj, "setLocale", Qt::DirectConnection,
Q_ARG(QVariant, QVariant(locale)));
@@ -732,9 +728,7 @@ void tst_qqmllocale::dateToLocaleDateString()
QObject *obj = c.create();
QVERIFY(obj);
- QDateTime dt;
- dt.setDate(QDate(2011, 10, 7)); // weirdly, JS Date month range is 0-11
- dt.setTime(QTime(18, 53, 48, 345));
+ const QDateTime dt(QDate(2011, 10, 7), QTime(18, 53, 48, 345));
QMetaObject::invokeMethod(obj, "setLocale", Qt::DirectConnection,
Q_ARG(QVariant, QVariant(locale)));
@@ -793,9 +787,7 @@ void tst_qqmllocale::dateToLocaleDateStringFormatted()
QObject *obj = c.create();
QVERIFY(obj);
- QDateTime dt;
- dt.setDate(QDate(2011, 10, 7)); // weirdly, JS Date month range is 0-11
- dt.setTime(QTime(18, 53, 48, 345));
+ const QDateTime dt(QDate(2011, 10, 7), QTime(18, 53, 48, 345));
QMetaObject::invokeMethod(obj, "setLocale", Qt::DirectConnection,
Q_ARG(QVariant, QVariant(locale)));
@@ -824,9 +816,7 @@ void tst_qqmllocale::dateToLocaleTimeString()
QObject *obj = c.create();
QVERIFY(obj);
- QDateTime dt;
- dt.setDate(QDate(2011, 10, 7)); // weirdly, JS Date month range is 0-11
- dt.setTime(QTime(18, 53, 48, 345));
+ const QDateTime dt(QDate(2011, 10, 7), QTime(18, 53, 48, 345));
QMetaObject::invokeMethod(obj, "setLocale", Qt::DirectConnection,
Q_ARG(QVariant, QVariant(locale)));
@@ -885,9 +875,7 @@ void tst_qqmllocale::dateToLocaleTimeStringFormatted()
QObject *obj = c.create();
QVERIFY(obj);
- QDateTime dt;
- dt.setDate(QDate(2011, 10, 7)); // weirdly, JS Date month range is 0-11
- dt.setTime(QTime(18, 53, 48, 345));
+ const QDateTime dt(QDate(2011, 10, 7), QTime(18, 53, 48, 345));
QMetaObject::invokeMethod(obj, "setLocale", Qt::DirectConnection,
Q_ARG(QVariant, QVariant(locale)));
@@ -927,21 +915,20 @@ void tst_qqmllocale::dateFromLocaleString()
QObject *obj = c.create();
QVERIFY(obj);
- QDateTime dt;
- dt.setDate(QDate(2011, 10, 7));
- dt.setTime(QTime(18, 53, 48, 345));
+ const QDateTime dt(QDate(2011, 10, 7), QTime(18, 53, 48, 345));
QMetaObject::invokeMethod(obj, "setLocale", Qt::DirectConnection,
Q_ARG(QVariant, QVariant(locale)));
QLocale l(locale);
+ const QString localeText(l.toString(dt, format));
QVariant val;
QMetaObject::invokeMethod(obj, "fromLocaleString", Qt::DirectConnection,
Q_RETURN_ARG(QVariant, val),
- Q_ARG(QVariant, QVariant(l.toString(dt, format))),
+ Q_ARG(QVariant, QVariant(localeText)),
Q_ARG(QVariant, QVariant(format)));
- QDateTime pd = l.toDateTime(l.toString(dt, format), format);
+ QDateTime pd = l.toDateTime(localeText, format);
QCOMPARE(val.toDateTime(), pd);
}
@@ -971,21 +958,20 @@ void tst_qqmllocale::dateFromLocaleDateString()
QObject *obj = c.create();
QVERIFY(obj);
- QDateTime dt;
- dt.setDate(QDate(2011, 10, 7));
- dt.setTime(QTime(18, 53, 48, 345));
+ const QDateTime dt(QDate(2011, 10, 7), QTime(18, 53, 48, 345));
QMetaObject::invokeMethod(obj, "setLocale", Qt::DirectConnection,
Q_ARG(QVariant, QVariant(locale)));
QLocale l(locale);
+ const QString localeText(l.toString(dt, format));
QVariant val;
QMetaObject::invokeMethod(obj, "fromLocaleDateString", Qt::DirectConnection,
Q_RETURN_ARG(QVariant, val),
- Q_ARG(QVariant, QVariant(l.toString(dt, format))),
+ Q_ARG(QVariant, QVariant(localeText)),
Q_ARG(QVariant, QVariant(format)));
- QDate pd = l.toDate(l.toString(dt, format), format);
+ QDate pd = l.toDate(localeText, format);
QCOMPARE(val.toDate(), pd);
}
@@ -1015,21 +1001,20 @@ void tst_qqmllocale::dateFromLocaleTimeString()
QObject *obj = c.create();
QVERIFY(obj);
- QDateTime dt;
- dt.setDate(QDate(2011, 10, 7));
- dt.setTime(QTime(18, 53, 48, 345));
+ const QDateTime dt(QDate(2011, 10, 7), QTime(18, 53, 48, 345));
QMetaObject::invokeMethod(obj, "setLocale", Qt::DirectConnection,
Q_ARG(QVariant, QVariant(locale)));
QLocale l(locale);
+ const QString localeText(l.toString(dt, format));
QVariant val;
QMetaObject::invokeMethod(obj, "fromLocaleTimeString", Qt::DirectConnection,
Q_RETURN_ARG(QVariant, val),
- Q_ARG(QVariant, QVariant(l.toString(dt, format))),
+ Q_ARG(QVariant, QVariant(localeText)),
Q_ARG(QVariant, QVariant(format)));
- QTime pd = l.toTime(l.toString(dt, format), format);
+ QTime pd = l.toTime(localeText, format);
QCOMPARE(val.toTime(), pd);
}
@@ -1267,7 +1252,10 @@ QString DateFormatter::getLocalizedForm(const QString &isoTimestamp)
// which will require linking to a different library to access that API.
static void setTimeZone(const QByteArray &tz)
{
- qputenv("TZ", tz);
+ if (tz.isEmpty())
+ qunsetenv("TZ");
+ else
+ qputenv("TZ", tz);
::tzset();
// following left for future reference, see comment above
@@ -1291,7 +1279,7 @@ void tst_qqmllocale::timeZoneUpdated()
QQmlComponent c(&e, testFileUrl("timeZoneUpdated.qml"));
QScopedPointer<QObject> obj(c.create());
QVERIFY(obj);
- QCOMPARE(obj->property("success").toBool(), true);
+ QVERIFY(obj->property("success").toBool());
// Change to Indian time
setTimeZone(QByteArray("IST-05:30"));
@@ -1302,7 +1290,7 @@ void tst_qqmllocale::timeZoneUpdated()
setTimeZone(original);
QMetaObject::invokeMethod(obj.data(), "resetTimeZone");
- QCOMPARE(obj->property("success").toBool(), true);
+ QVERIFY(obj->property("success").toBool());
}
#endif
diff --git a/tests/auto/qml/qqmlsqldatabase/tst_qqmlsqldatabase.cpp b/tests/auto/qml/qqmlsqldatabase/tst_qqmlsqldatabase.cpp
index e16bfb08a2..3b982d1ab7 100644
--- a/tests/auto/qml/qqmlsqldatabase/tst_qqmlsqldatabase.cpp
+++ b/tests/auto/qml/qqmlsqldatabase/tst_qqmlsqldatabase.cpp
@@ -31,12 +31,6 @@
#include <QtQuick/private/qquicktext_p.h>
#include <private/qqmlengine_p.h>
#include <QtCore/qcryptographichash.h>
-/*
-#include <QtWebKit/qwebpage.h>
-#include <QtWebKit/qwebframe.h>
-#include <QtWebKit/qwebdatabase.h>
-#include <QtWebKit/qwebsecurityorigin.h>
-*/
#include <QtSql/qsqldatabase.h>
#include <QtCore/qdir.h>
#include <QtCore/qfile.h>
@@ -150,42 +144,6 @@ void tst_qqmlsqldatabase::testQml_data()
// test - in which case increment total_databases_created_by_tests above.
}
-/*
-class QWebPageWithJavaScriptConsoleMessages : public QWebPage {
-public:
- void javaScriptConsoleMessage(const QString& message, int lineNumber, const QString& sourceID)
- {
- qWarning() << sourceID << ":" << lineNumber << ":" << message;
- }
-};
-
-void tst_qqmlsqldatabase::validateAgainstWebkit()
-{
- // Validates tests against WebKit (HTML5) support.
- //
- QFETCH(QString, jsfile);
- QFETCH(QString, result);
- QFETCH(int, databases);
-
- QFile f(jsfile);
- QVERIFY(f.open(QIODevice::ReadOnly));
- QString js=f.readAll();
-
- QWebPageWithJavaScriptConsoleMessages webpage;
- webpage.settings()->setOfflineStoragePath(dbDir());
- webpage.settings()->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled, true);
-
- QEXPECT_FAIL("","WebKit doesn't support openDatabaseSync yet", Continue);
- QCOMPARE(webpage.mainFrame()->evaluateJavaScript(js).toString(),result);
-
- QTest::qWait(100); // WebKit crashes if you quit it too fast
-
- QWebSecurityOrigin origin = webpage.mainFrame()->securityOrigin();
- QList<QWebDatabase> dbs = origin.databases();
- QCOMPARE(dbs.count(), databases);
-}
-*/
-
void tst_qqmlsqldatabase::testQml()
{
if (engine->offlineStoragePath().isEmpty())
diff --git a/examples/quick/demos/samegame/content/BBSettings.qml b/tests/auto/qmltest/layout/Container.qml
index cd6be7dcf5..db3d68c485 100644
--- a/examples/quick/demos/samegame/content/BBSettings.qml
+++ b/tests/auto/qmltest/layout/Container.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the examples of the Qt Toolkit.
+** This file is part of the test suite of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** You may use this file under the terms of the BSD license as follows:
@@ -38,24 +38,18 @@
**
****************************************************************************/
-import QtQml 2.0
+import QtQuick 2.5
+import QtQuick.Layouts 1.2
-QtObject {
- // This height/width is here for desktop testing, otherwise
- // we could just use Screen.width/Screen.height.
- property int screenHeight: 1280
- property int screenWidth: 768
+Item {
+ objectName: "qtbug51927-window"
+ visible: true
- property int menuDelay: 500
+ default property alias _contents: customContent.data
- property int headerHeight: 70
- property int footerHeight: 100
-
- property int fontPixelSize: 55
-
- property int blockSize: 64
-
- property int toolButtonHeight: 64
-
- property int menuButtonSpacing: 15
+ ColumnLayout {
+ id: customContent
+ objectName: "qtbug51927-columnLayout"
+ anchors.fill: parent
+ }
}
diff --git a/examples/quick/demos/samegame/content/+blackberry/Settings.qml b/tests/auto/qmltest/layout/ContainerUser.qml
index c744ca6f51..ff7ce6221b 100644
--- a/examples/quick/demos/samegame/content/+blackberry/Settings.qml
+++ b/tests/auto/qmltest/layout/ContainerUser.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the examples of the Qt Toolkit.
+** This file is part of the test suite of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** You may use this file under the terms of the BSD license as follows:
@@ -38,10 +38,16 @@
**
****************************************************************************/
-pragma Singleton
-import QtQml 2.0
+import QtQuick 2.6
+import QtQuick.Window 2.2
-// Instantiating a BBSettings class that can be easily tweaked for future
-// BB devices (we may have more selectors added)
-BBSettings {
+Container {
+ visible: true
+
+ Text {
+ objectName: "qtbug51927-text"
+ text: qsTr("Hello World")
+ anchors.centerIn: parent
+ renderType: Text.QtRendering
+ }
}
diff --git a/tests/auto/qmltest/layout/tst_layout.qml b/tests/auto/qmltest/layout/tst_layout.qml
new file mode 100644
index 0000000000..ee44a01080
--- /dev/null
+++ b/tests/auto/qmltest/layout/tst_layout.qml
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtTest 1.0
+
+TestCase {
+ id: testCase
+ name: "Tests_Layout"
+ when:windowShown
+ width:400
+ height:400
+
+ function test_invalidParent() {
+ ignoreWarning('<Unknown File>:1:49: QML QtObject: Layout must be attached to Item elements')
+ var object = Qt.createQmlObject('import QtQuick 2.2; import QtQuick.Layouts 1.0; QtObject { Layout.fillWidth: true }', testCase, '');
+ object.destroy()
+ }
+
+ function test_defaultPropertyAliasCrash() {
+ var containerUserComponent = Qt.createComponent("ContainerUser.qml");
+ compare(containerUserComponent.status, Component.Ready);
+
+ var containerUser = containerUserComponent.createObject(testCase);
+ verify(containerUser);
+
+ // Shouldn't crash.
+ containerUser.destroy();
+ }
+}
+
diff --git a/tests/auto/qmltest/positioners/tst_positioners.qml b/tests/auto/qmltest/positioners/tst_positioners.qml
new file mode 100644
index 0000000000..03a0e13225
--- /dev/null
+++ b/tests/auto/qmltest/positioners/tst_positioners.qml
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.9
+import QtTest 1.1
+
+Item {
+ Column {
+ id: column
+ Repeater {
+ id: repeater
+ model: 2
+ Rectangle {
+ width: 100
+ height: 30
+ border.width: 1
+ }
+ }
+ }
+
+ SignalSpy {
+ id: spy
+ target: column
+ signalName: "positioningComplete"
+ }
+
+ TestCase {
+ function test_forceLayout() {
+ compare(column.height, 60)
+ repeater.model = 4
+ column.forceLayout()
+ compare(column.height, 120)
+
+ // initial positioning and our forced layout
+ compare(spy.count, 2)
+ }
+ }
+}
diff --git a/tests/auto/qmltest/selftests/tst_createTemporaryObject.qml b/tests/auto/qmltest/selftests/tst_createTemporaryObject.qml
index c4912c7388..5f1e802df2 100644
--- a/tests/auto/qmltest/selftests/tst_createTemporaryObject.qml
+++ b/tests/auto/qmltest/selftests/tst_createTemporaryObject.qml
@@ -38,11 +38,15 @@ TestCase {
when: windowShown
property var createdObjectNames: []
+ property var createdParentlessObjects: []
function verifyNoChildren() {
for (var i = 0; i < createdObjectNames.length; ++i) {
verify(!findChild(testCase, createdObjectNames[i]));
}
+
+ compare(createdParentlessObjects.length, 0,
+ "The following parentless temporary objects were not destroyed: " + createdParentlessObjects)
}
function init() {
@@ -70,6 +74,21 @@ TestCase {
compare(findChild(testCase, object.objectName), object);
createdObjectNames.push(object.objectName);
+
+ // Create an object and destroy it early. It should be
+ // removed from TestCase's list of temporary objects
+ // as soon as it's destroyed.
+ var manuallyDestroyedObject = createTemporaryQmlObject(data.qml, testCase);
+ verify(manuallyDestroyedObject);
+
+ var manuallyDestroyedObjectName = data.tag + "FromQmlShortLived";
+ manuallyDestroyedObject.objectName = manuallyDestroyedObjectName;
+ compare(findChild(testCase, manuallyDestroyedObjectName), manuallyDestroyedObject);
+
+ manuallyDestroyedObject.destroy();
+ wait(0);
+
+ verify(!findChild(testCase, manuallyDestroyedObjectName));
}
Component {
@@ -109,5 +128,52 @@ TestCase {
object.contentItem.objectName = "WindowContentItemFromComponent";
createdObjectNames.push(object.objectName);
+
+ // Create an object and destroy it early. It should be
+ // removed from TestCase's list of temporary objects
+ // as soon as it's destroyed.
+ var manuallyDestroyedObject = createTemporaryObject(data.component, testCase);
+ verify(manuallyDestroyedObject);
+
+ var manuallyDestroyedObjectName = data.tag + "FromComponentShortLived";
+ manuallyDestroyedObject.objectName = manuallyDestroyedObjectName;
+ compare(findChild(testCase, manuallyDestroyedObjectName), manuallyDestroyedObject);
+
+ manuallyDestroyedObject.destroy();
+ wait(0);
+
+ verify(!findChild(testCase, manuallyDestroyedObjectName));
+ }
+
+ function test_fromComponentParent_data() {
+ return [
+ { tag: "omit", expectedParent: null },
+ { tag: "undefined", parent: undefined, expectedParent: null },
+ { tag: "null", parent: null, expectedParent: null },
+ { tag: "1", parent: 1, expectedParent: null },
+ { tag: "testCase", parent: testCase, expectedParent: testCase }
+ ];
+ }
+
+ // Tests that an invalid or missing parent argument results in a parentless object.
+ // This is the same behavior as displayed by component.createObject().
+ function test_fromComponentParent(data) {
+ var object = data.hasOwnProperty("parent")
+ ? createTemporaryObject(itemComponent, data.parent)
+ : createTemporaryObject(itemComponent);
+ verify(object);
+ compare(object.parent, data.expectedParent);
+
+ object.objectName = data.tag + "FromComponentOmitParent";
+ if (object.parent) {
+ compare(findChild(testCase, object.objectName), object);
+ createdObjectNames.push(object.objectName);
+ } else {
+ object.Component.destruction.connect(function() {
+ var indexOfObject = createdParentlessObjects.indexOf(object);
+ createdParentlessObjects.splice(indexOfObject, 1);
+ });
+ createdParentlessObjects.push(object);
+ }
}
}
diff --git a/tests/auto/quick/examples/tst_examples.cpp b/tests/auto/quick/examples/tst_examples.cpp
index 1673915c27..0feebb8c1e 100644
--- a/tests/auto/quick/examples/tst_examples.cpp
+++ b/tests/auto/quick/examples/tst_examples.cpp
@@ -89,12 +89,6 @@ tst_examples::tst_examples()
excludedDirs << "snippets/qml/imports";
excludedFiles << "examples/quick/pathitem/content/pathitem.qml"; // relies on resources
-#ifdef QT_NO_WEBKIT
- excludedDirs << "qtquick/modelviews/webview";
- excludedDirs << "demos/webbrowser";
- excludedDirs << "doc/src/snippets/qml/webview";
-#endif
-
#ifdef QT_NO_XMLPATTERNS
excludedDirs << "demos/twitter";
excludedDirs << "demos/flickr";
diff --git a/tests/auto/quick/qquickanimations/data/pathLineUnspecifiedXYBug.qml b/tests/auto/quick/qquickanimations/data/pathLineUnspecifiedXYBug.qml
new file mode 100644
index 0000000000..426360bbcc
--- /dev/null
+++ b/tests/auto/quick/qquickanimations/data/pathLineUnspecifiedXYBug.qml
@@ -0,0 +1,28 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400
+ height: 400
+
+ Rectangle {
+ id: redRect
+ color: "red"
+ width: 100; height: 100
+ x: 50; y: 50
+ }
+
+ PathAnimation {
+ target: redRect
+ duration: 1000
+ path: Path {
+ startX: 100; startY: 100
+
+ PathLine {
+ x: 200
+ y: 200
+ }
+
+ PathLine {}
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickanimations/data/pathSvgAnimation.qml b/tests/auto/quick/qquickanimations/data/pathSvgAnimation.qml
new file mode 100644
index 0000000000..e409bb031f
--- /dev/null
+++ b/tests/auto/quick/qquickanimations/data/pathSvgAnimation.qml
@@ -0,0 +1,25 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400
+ height: 400
+
+ Rectangle {
+ id: redRect
+ color: "red"
+ width: 100; height: 100
+ x: 50; y: 50
+ }
+
+ PathAnimation {
+ target: redRect
+ duration: 1000;
+ path: Path {
+ startX: 100; startY: 100
+
+ PathSvg {
+ path: "M 200 200"
+ }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp b/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp
index 6e265503a1..fbd6c9c97e 100644
--- a/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp
+++ b/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp
@@ -101,6 +101,8 @@ private slots:
void scriptActionCrash();
void animatorInvalidTargetCrash();
void defaultPropertyWarning();
+ void pathSvgAnimation();
+ void pathLineUnspecifiedXYBug();
};
#define QTIMED_COMPARE(lhs, rhs) do { \
@@ -1523,6 +1525,48 @@ void tst_qquickanimations::defaultPropertyWarning()
QVERIFY(warnings.isEmpty());
}
+// QTBUG-57666
+void tst_qquickanimations::pathSvgAnimation()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("pathSvgAnimation.qml"));
+ QScopedPointer<QQuickRectangle> rect(qobject_cast<QQuickRectangle*>(component.create()));
+ QVERIFY(rect);
+
+ QQuickRectangle *redRect = rect->findChild<QQuickRectangle*>();
+ QVERIFY(redRect);
+ QQuickPathAnimation *pathAnim = rect->findChild<QQuickPathAnimation*>();
+ QVERIFY(pathAnim);
+
+ QCOMPARE(redRect->x(), qreal(50));
+ QCOMPARE(redRect->y(), qreal(50));
+
+ pathAnim->start();
+ QTRY_COMPARE(redRect->x(), qreal(200));
+ QCOMPARE(redRect->y(), qreal(200));
+}
+
+// QTBUG-57666
+void tst_qquickanimations::pathLineUnspecifiedXYBug()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("pathLineUnspecifiedXYBug.qml"));
+ QScopedPointer<QQuickRectangle> rect(qobject_cast<QQuickRectangle*>(component.create()));
+ QVERIFY(rect);
+
+ QQuickRectangle *redRect = rect->findChild<QQuickRectangle*>();
+ QVERIFY(redRect);
+ QQuickPathAnimation *pathAnim = rect->findChild<QQuickPathAnimation*>();
+ QVERIFY(pathAnim);
+
+ QCOMPARE(redRect->x(), qreal(50));
+ QCOMPARE(redRect->y(), qreal(50));
+
+ pathAnim->start();
+ QTRY_COMPARE(redRect->x(), qreal(0));
+ QCOMPARE(redRect->y(), qreal(0));
+}
+
QTEST_MAIN(tst_qquickanimations)
#include "tst_qquickanimations.moc"
diff --git a/tests/auto/quick/qquickflickable/data/overshoot.qml b/tests/auto/quick/qquickflickable/data/overshoot.qml
new file mode 100644
index 0000000000..4235156479
--- /dev/null
+++ b/tests/auto/quick/qquickflickable/data/overshoot.qml
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.9
+
+Flickable {
+ width: 200; height: 200
+ contentWidth: rect.width; contentHeight: rect.height
+
+ property real minContentY: 0
+ property real maxContentY: 0
+ onContentYChanged: {
+ minContentY = Math.min(contentY, minContentY)
+ maxContentY = Math.max(contentY, maxContentY)
+ }
+
+ property real minContentX: 0
+ property real maxContentX: 0
+ onContentXChanged: {
+ minContentX = Math.min(contentX, minContentX)
+ maxContentX = Math.max(contentX, maxContentX)
+ }
+
+ property real minVerticalOvershoot: 0
+ property real maxVerticalOvershoot: 0
+ onVerticalOvershootChanged: {
+ minVerticalOvershoot = Math.min(verticalOvershoot, minVerticalOvershoot)
+ maxVerticalOvershoot = Math.max(verticalOvershoot, maxVerticalOvershoot)
+ }
+
+ property real minHorizontalOvershoot: 0
+ property real maxHorizontalOvershoot: 0
+ onHorizontalOvershootChanged: {
+ minHorizontalOvershoot = Math.min(horizontalOvershoot, minHorizontalOvershoot)
+ maxHorizontalOvershoot = Math.max(horizontalOvershoot, maxHorizontalOvershoot)
+ }
+
+ function reset() {
+ minContentY = contentY
+ maxContentY = contentY
+ minContentX = contentX
+ maxContentX = contentX
+ minVerticalOvershoot = 0
+ maxVerticalOvershoot = 0
+ minHorizontalOvershoot = 0
+ maxHorizontalOvershoot = 0
+ }
+
+ Rectangle {
+ id: rect
+ color: "red"
+ width: 400; height: 400
+ }
+}
diff --git a/tests/auto/quick/qquickflickable/data/overshoot_reentrant.qml b/tests/auto/quick/qquickflickable/data/overshoot_reentrant.qml
new file mode 100644
index 0000000000..bc7abba25a
--- /dev/null
+++ b/tests/auto/quick/qquickflickable/data/overshoot_reentrant.qml
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.9
+
+Flickable {
+ width: 200; height: 200
+ contentWidth: rect.width; contentHeight: rect.height
+
+ property real contentPosAdjustment: 0.0
+
+ onContentXChanged: {
+ var adjustment = contentPosAdjustment
+ contentPosAdjustment = 0.0
+ contentX += adjustment
+ }
+
+ onContentYChanged: {
+ var adjustment = contentPosAdjustment
+ contentPosAdjustment = 0.0
+ contentY += adjustment
+ }
+
+ Rectangle {
+ id: rect
+ border.color: "red"
+ border.width: 5
+ width: 400; height: 400
+ }
+}
diff --git a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
index 942e99018f..1ad691d1c1 100644
--- a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
+++ b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
@@ -95,6 +95,9 @@ private slots:
void ratios_smallContent();
void contentXYNotTruncatedToInt();
void keepGrab();
+ void overshoot();
+ void overshoot_data();
+ void overshoot_reentrant();
private:
void flickWithTouch(QQuickWindow *window, QTouchDevice *touchDevice, const QPoint &from, const QPoint &to);
@@ -2037,6 +2040,199 @@ void tst_qquickflickable::keepGrab()
QVERIFY(flickable->contentY() != 0.0);
}
+Q_DECLARE_METATYPE(QQuickFlickable::BoundsBehavior)
+
+void tst_qquickflickable::overshoot()
+{
+ QFETCH(QQuickFlickable::BoundsBehavior, boundsBehavior);
+
+ QScopedPointer<QQuickView> window(new QQuickView);
+ window->setSource(testFileUrl("overshoot.qml"));
+ window->show();
+
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
+
+ QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(window->rootObject());
+ QVERIFY(flickable);
+
+ QCOMPARE(flickable->width(), 200.0);
+ QCOMPARE(flickable->height(), 200.0);
+ QCOMPARE(flickable->contentWidth(), 400.0);
+ QCOMPARE(flickable->contentHeight(), 400.0);
+
+ flickable->setBoundsBehavior(boundsBehavior);
+
+ // drag past the beginning
+ QTest::mousePress(window.data(), Qt::LeftButton, 0, QPoint(10, 10));
+ QTest::mouseMove(window.data(), QPoint(20, 20));
+ QTest::mouseMove(window.data(), QPoint(30, 30));
+ QTest::mouseMove(window.data(), QPoint(40, 40));
+ QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(50, 50));
+
+ if (boundsBehavior & QQuickFlickable::DragOverBounds) {
+ QVERIFY(flickable->property("minVerticalOvershoot").toReal() < 0.0);
+ QVERIFY(flickable->property("minHorizontalOvershoot").toReal() < 0.0);
+ QCOMPARE(flickable->property("minContentY").toReal(),
+ flickable->property("minVerticalOvershoot").toReal());
+ QCOMPARE(flickable->property("minContentX").toReal(),
+ flickable->property("minHorizontalOvershoot").toReal());
+ } else {
+ QCOMPARE(flickable->property("minContentY").toReal(), 0.0);
+ QCOMPARE(flickable->property("minContentX").toReal(), 0.0);
+ QCOMPARE(flickable->property("minVerticalOvershoot").toReal(), 0.0);
+ QCOMPARE(flickable->property("minHorizontalOvershoot").toReal(), 0.0);
+ }
+ QCOMPARE(flickable->property("maxContentY").toReal(), 0.0);
+ QCOMPARE(flickable->property("maxContentX").toReal(), 0.0);
+ QCOMPARE(flickable->property("maxVerticalOvershoot").toReal(), 0.0);
+ QCOMPARE(flickable->property("maxHorizontalOvershoot").toReal(), 0.0);
+
+ flickable->setContentX(20.0);
+ flickable->setContentY(20.0);
+ QMetaObject::invokeMethod(flickable, "reset");
+
+ // flick past the beginning
+ flick(window.data(), QPoint(10, 10), QPoint(50, 50), 100);
+ QTRY_VERIFY(!flickable->property("flicking").toBool());
+
+ if (boundsBehavior & QQuickFlickable::OvershootBounds) {
+ QVERIFY(flickable->property("minVerticalOvershoot").toReal() < 0.0);
+ QVERIFY(flickable->property("minHorizontalOvershoot").toReal() < 0.0);
+ QCOMPARE(flickable->property("minContentY").toReal(),
+ flickable->property("minVerticalOvershoot").toReal());
+ QCOMPARE(flickable->property("minContentX").toReal(),
+ flickable->property("minHorizontalOvershoot").toReal());
+ } else {
+ QCOMPARE(flickable->property("minContentY").toReal(), 0.0);
+ QCOMPARE(flickable->property("minContentX").toReal(), 0.0);
+ QCOMPARE(flickable->property("minVerticalOvershoot").toReal(), 0.0);
+ QCOMPARE(flickable->property("minHorizontalOvershoot").toReal(), 0.0);
+ }
+ QCOMPARE(flickable->property("maxContentY").toReal(), 20.0);
+ QCOMPARE(flickable->property("maxContentX").toReal(), 20.0);
+ QCOMPARE(flickable->property("maxVerticalOvershoot").toReal(), 0.0);
+ QCOMPARE(flickable->property("maxHorizontalOvershoot").toReal(), 0.0);
+
+ flickable->setContentX(200.0);
+ flickable->setContentY(200.0);
+ QMetaObject::invokeMethod(flickable, "reset");
+
+ // drag past the end
+ QTest::mousePress(window.data(), Qt::LeftButton, 0, QPoint(50, 50));
+ QTest::mouseMove(window.data(), QPoint(40, 40));
+ QTest::mouseMove(window.data(), QPoint(30, 30));
+ QTest::mouseMove(window.data(), QPoint(20, 20));
+ QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(10, 10));
+
+ if (boundsBehavior & QQuickFlickable::DragOverBounds) {
+ QVERIFY(flickable->property("maxVerticalOvershoot").toReal() > 0.0);
+ QVERIFY(flickable->property("maxHorizontalOvershoot").toReal() > 0.0);
+ QCOMPARE(flickable->property("maxContentY").toReal() - 200.0,
+ flickable->property("maxVerticalOvershoot").toReal());
+ QCOMPARE(flickable->property("maxContentX").toReal() - 200.0,
+ flickable->property("maxHorizontalOvershoot").toReal());
+ } else {
+ QCOMPARE(flickable->property("maxContentY").toReal(), 200.0);
+ QCOMPARE(flickable->property("maxContentX").toReal(), 200.0);
+ QCOMPARE(flickable->property("maxVerticalOvershoot").toReal(), 0.0);
+ QCOMPARE(flickable->property("maxHorizontalOvershoot").toReal(), 0.0);
+ }
+ QCOMPARE(flickable->property("minContentY").toReal(), 200.0);
+ QCOMPARE(flickable->property("minContentX").toReal(), 200.0);
+ QCOMPARE(flickable->property("minVerticalOvershoot").toReal(), 0.0);
+ QCOMPARE(flickable->property("minHorizontalOvershoot").toReal(), 0.0);
+
+ flickable->setContentX(180.0);
+ flickable->setContentY(180.0);
+ QMetaObject::invokeMethod(flickable, "reset");
+
+ // flick past the end
+ flick(window.data(), QPoint(50, 50), QPoint(10, 10), 100);
+ QTRY_VERIFY(!flickable->property("flicking").toBool());
+
+ if (boundsBehavior & QQuickFlickable::OvershootBounds) {
+ QVERIFY(flickable->property("maxVerticalOvershoot").toReal() > 0.0);
+ QVERIFY(flickable->property("maxHorizontalOvershoot").toReal() > 0.0);
+ QCOMPARE(flickable->property("maxContentY").toReal() - 200.0,
+ flickable->property("maxVerticalOvershoot").toReal());
+ QCOMPARE(flickable->property("maxContentX").toReal() - 200.0,
+ flickable->property("maxHorizontalOvershoot").toReal());
+ } else {
+ QCOMPARE(flickable->property("maxContentY").toReal(), 200.0);
+ QCOMPARE(flickable->property("maxContentX").toReal(), 200.0);
+ QCOMPARE(flickable->property("maxVerticalOvershoot").toReal(), 0.0);
+ QCOMPARE(flickable->property("maxHorizontalOvershoot").toReal(), 0.0);
+ }
+ QCOMPARE(flickable->property("minContentY").toReal(), 180.0);
+ QCOMPARE(flickable->property("minContentX").toReal(), 180.0);
+ QCOMPARE(flickable->property("minVerticalOvershoot").toReal(), 0.0);
+ QCOMPARE(flickable->property("minHorizontalOvershoot").toReal(), 0.0);
+}
+
+void tst_qquickflickable::overshoot_data()
+{
+ QTest::addColumn<QQuickFlickable::BoundsBehavior>("boundsBehavior");
+
+ QTest::newRow("StopAtBounds")
+ << QQuickFlickable::BoundsBehavior(QQuickFlickable::StopAtBounds);
+ QTest::newRow("DragOverBounds")
+ << QQuickFlickable::BoundsBehavior(QQuickFlickable::DragOverBounds);
+ QTest::newRow("OvershootBounds")
+ << QQuickFlickable::BoundsBehavior(QQuickFlickable::OvershootBounds);
+ QTest::newRow("DragAndOvershootBounds")
+ << QQuickFlickable::BoundsBehavior(QQuickFlickable::DragAndOvershootBounds);
+}
+
+void tst_qquickflickable::overshoot_reentrant()
+{
+ QScopedPointer<QQuickView> window(new QQuickView);
+ window->setSource(testFileUrl("overshoot_reentrant.qml"));
+ window->show();
+
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
+
+ QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(window->rootObject());
+ QVERIFY(flickable);
+
+ // horizontal
+ flickable->setContentX(-10.0);
+ QCOMPARE(flickable->contentX(), -10.0);
+ QCOMPARE(flickable->horizontalOvershoot(), -10.0);
+
+ flickable->setProperty("contentPosAdjustment", -5.0);
+ flickable->setContentX(-20.0);
+ QCOMPARE(flickable->contentX(), -25.0);
+ QCOMPARE(flickable->horizontalOvershoot(), -25.0);
+
+ flickable->setContentX(210);
+ QCOMPARE(flickable->contentX(), 210.0);
+ QCOMPARE(flickable->horizontalOvershoot(), 10.0);
+
+ flickable->setProperty("contentPosAdjustment", 5.0);
+ flickable->setContentX(220.0);
+ QCOMPARE(flickable->contentX(), 225.0);
+ QCOMPARE(flickable->horizontalOvershoot(), 25.0);
+
+ // vertical
+ flickable->setContentY(-10.0);
+ QCOMPARE(flickable->contentY(), -10.0);
+ QCOMPARE(flickable->verticalOvershoot(), -10.0);
+
+ flickable->setProperty("contentPosAdjustment", -5.0);
+ flickable->setContentY(-20.0);
+ QCOMPARE(flickable->contentY(), -25.0);
+ QCOMPARE(flickable->verticalOvershoot(), -25.0);
+
+ flickable->setContentY(210);
+ QCOMPARE(flickable->contentY(), 210.0);
+ QCOMPARE(flickable->verticalOvershoot(), 10.0);
+
+ flickable->setProperty("contentPosAdjustment", 5.0);
+ flickable->setContentY(220.0);
+ QCOMPARE(flickable->contentY(), 225.0);
+ QCOMPARE(flickable->verticalOvershoot(), 25.0);
+}
+
QTEST_MAIN(tst_qquickflickable)
#include "tst_qquickflickable.moc"
diff --git a/tests/auto/quick/qquickgraphicsinfo/tst_qquickgraphicsinfo.cpp b/tests/auto/quick/qquickgraphicsinfo/tst_qquickgraphicsinfo.cpp
index 650892d650..4da6da6043 100644
--- a/tests/auto/quick/qquickgraphicsinfo/tst_qquickgraphicsinfo.cpp
+++ b/tests/auto/quick/qquickgraphicsinfo/tst_qquickgraphicsinfo.cpp
@@ -51,7 +51,7 @@ private slots:
void tst_QQuickGraphicsInfo::testProperties()
{
QQuickView view;
- view.setSource(QUrl::fromLocalFile("data/basic.qml"));
+ view.setSource(QUrl("data/basic.qml"));
view.show();
QVERIFY(QTest::qWaitForWindowExposed(&view));
diff --git a/tests/auto/quick/qquickgridview/data/keyNavigationEnabled.qml b/tests/auto/quick/qquickgridview/data/keyNavigationEnabled.qml
new file mode 100644
index 0000000000..868611760e
--- /dev/null
+++ b/tests/auto/quick/qquickgridview/data/keyNavigationEnabled.qml
@@ -0,0 +1,12 @@
+import QtQuick 2.7
+
+GridView {
+ width: 405
+ height: 200
+ cellWidth: width / 9
+ cellHeight: height / 2
+ // Ensure that the property is available in QML.
+ onKeyNavigationEnabledChanged: {}
+ model: 18
+ delegate: Rectangle { objectName: "delegate"; width: 10; height: 10; color: "green" }
+}
diff --git a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp
index 07c03a57d7..1acc36c9b0 100644
--- a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp
+++ b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp
@@ -6568,7 +6568,7 @@ void tst_QQuickGridView::QTBUG_45640()
void tst_QQuickGridView::keyNavigationEnabled()
{
QScopedPointer<QQuickView> window(createView());
- window->setSource(testFileUrl("gridview4.qml"));
+ window->setSource(testFileUrl("keyNavigationEnabled.qml"));
window->show();
window->requestActivate();
QVERIFY(QTest::qWaitForWindowActive(window.data()));
diff --git a/tests/auto/quick/qquickimage/tst_qquickimage.cpp b/tests/auto/quick/qquickimage/tst_qquickimage.cpp
index d345163db5..4699f947a1 100644
--- a/tests/auto/quick/qquickimage/tst_qquickimage.cpp
+++ b/tests/auto/quick/qquickimage/tst_qquickimage.cpp
@@ -145,9 +145,9 @@ void tst_qquickimage::imageSource_data()
QTest::newRow("remote") << "/colors.png" << 120.0 << 120.0 << true << false << true << "";
QTest::newRow("remote redirected") << "/oldcolors.png" << 120.0 << 120.0 << true << false << false << "";
if (QImageReader::supportedImageFormats().contains("svg"))
- QTest::newRow("remote svg") << "/heart.svg" << 550.0 << 500.0 << true << false << false << "";
+ QTest::newRow("remote svg") << "/heart.svg" << 595.0 << 841.0 << true << false << false << "";
if (QImageReader::supportedImageFormats().contains("svgz"))
- QTest::newRow("remote svgz") << "/heart.svgz" << 550.0 << 500.0 << true << false << false << "";
+ QTest::newRow("remote svgz") << "/heart.svgz" << 595.0 << 841.0 << true << false << false << "";
QTest::newRow("remote not found") << "/no-such-file.png" << 0.0 << 0.0 << true
<< false << true << "<Unknown File>:2:1: QML Image: Error transferring {{ServerBaseUrl}}/no-such-file.png - server replied: Not found";
@@ -309,10 +309,6 @@ void tst_qquickimage::mirror()
qreal devicePixelRatio = 1.0;
foreach (QQuickImage::FillMode fillMode, fillModes) {
-#if defined(Q_OS_BLACKBERRY)
- QWindow dummy; // On BlackBerry first window is always full screen,
- dummy.showFullScreen(); // so make test window a second window.
-#endif
QScopedPointer<QQuickView> window(new QQuickView);
window->setSource(testFileUrl("mirror.qml"));
@@ -402,12 +398,12 @@ void tst_qquickimage::svg()
component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
QQuickImage *obj = qobject_cast<QQuickImage*>(component.create());
QVERIFY(obj != 0);
- QCOMPARE(obj->width(), 300.0);
- QCOMPARE(obj->height(), 273.0);
+ QCOMPARE(obj->width(), 212.0);
+ QCOMPARE(obj->height(), 300.0);
obj->setSourceSize(QSize(200,200));
- QCOMPARE(obj->width(), 200.0);
- QCOMPARE(obj->height(), 182.0);
+ QCOMPARE(obj->width(), 141.0);
+ QCOMPARE(obj->height(), 200.0);
delete obj;
}
diff --git a/tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp b/tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp
index 44310008d6..5419778cfc 100644
--- a/tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp
+++ b/tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp
@@ -44,10 +44,6 @@ public:
QImage runTest(const QString &fileName)
{
-#if defined(Q_OS_BLACKBERRY)
- QWindow dummy; // On BlackBerry first window is always full screen,
- dummy.showFullScreen(); // so make test window a second window.
-#endif
QQuickView view;
view.setSource(testFileUrl(fileName));
diff --git a/tests/auto/quick/qquicklayouts/data/tst_rowlayout.qml b/tests/auto/quick/qquicklayouts/data/tst_rowlayout.qml
index 2d4e227a9e..97860458fe 100644
--- a/tests/auto/quick/qquicklayouts/data/tst_rowlayout.qml
+++ b/tests/auto/quick/qquicklayouts/data/tst_rowlayout.qml
@@ -802,6 +802,27 @@ Item {
layout.destroy() // Do not crash
}
+ Component {
+ id: rectangle_Component
+ Rectangle {
+ width: 100
+ height: 50
+ }
+ }
+
+ function test_destroyImplicitInvisibleLayout()
+ {
+ var root = rectangle_Component.createObject(container)
+ root.visible = false
+ var layout = layout_deleteLayout.createObject(root)
+ layout.visible = true
+ // at this point the layout is still invisible because root is invisible
+ layout.destroy()
+ // Do not crash when destructing the layout
+ waitForRendering(container) // should ideally call gc(), but does not work
+ root.destroy()
+ }
+
function test_sizeHintWithHiddenChildren(data) {
var layout = layout_sizeHint_Component.createObject(container)
var grid = layout.children[0]
diff --git a/tests/auto/quick/qquicklistview/data/flickBothDirections.qml b/tests/auto/quick/qquicklistview/data/flickBothDirections.qml
new file mode 100644
index 0000000000..5d80ce4110
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/flickBothDirections.qml
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.9
+
+Rectangle {
+ width: 200
+ height: 200
+ ListView {
+ id: list
+ objectName: "list"
+ width: 100
+ height: 100
+ model: 20
+ anchors.centerIn: parent
+ orientation: initialOrientation
+ contentWidth: initialContentWidth
+ contentHeight: initialContentHeight
+ flickableDirection: initialFlickableDirection
+ delegate: Rectangle {
+ width: list.orientation == ListView.Vertical ? 120 : 10
+ height: list.orientation == ListView.Vertical ? 20 : 110
+ color: Qt.rgba(0, 0, index / 19, 1)
+ opacity: 0.8
+ }
+ Rectangle {
+ z: -1
+ width: 100
+ height: 100
+ border.width: 1
+ border.color: "red"
+ }
+ }
+}
diff --git a/tests/auto/quick/qquicklistview/data/keyNavigationEnabled.qml b/tests/auto/quick/qquicklistview/data/keyNavigationEnabled.qml
new file mode 100644
index 0000000000..943b0aadbd
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/keyNavigationEnabled.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.7
+
+ListView {
+ width: 400
+ height: 400
+ model: 100
+ // Ensure that the property is available in QML.
+ onKeyNavigationEnabledChanged: {}
+ delegate: Rectangle {
+ height: 40
+ width: 400
+ color: index % 2 ? "lightsteelblue" : "lightgray"
+ }
+}
diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
index 61ba2caaf7..ff06c1e1a4 100644
--- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
+++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
@@ -53,6 +53,7 @@ Q_DECLARE_METATYPE(Qt::LayoutDirection)
Q_DECLARE_METATYPE(QQuickItemView::VerticalLayoutDirection)
Q_DECLARE_METATYPE(QQuickItemView::PositionMode)
Q_DECLARE_METATYPE(QQuickListView::Orientation)
+Q_DECLARE_METATYPE(QQuickFlickable::FlickableDirection)
Q_DECLARE_METATYPE(Qt::Key)
using namespace QQuickViewTestUtil;
@@ -205,6 +206,8 @@ private slots:
void multipleDisplaced();
void flickBeyondBounds();
+ void flickBothDirections();
+ void flickBothDirections_data();
void destroyItemOnCreation();
void parentBinding();
@@ -7123,6 +7126,82 @@ void tst_QQuickListView::flickBeyondBounds()
}
}
+void tst_QQuickListView::flickBothDirections()
+{
+ QFETCH(bool, initValues);
+ QFETCH(QQuickListView::Orientation, orientation);
+ QFETCH(QQuickFlickable::FlickableDirection, flickableDirection);
+ QFETCH(qreal, contentWidth);
+ QFETCH(qreal, contentHeight);
+ QFETCH(QPointF, targetPos);
+
+ QQuickView *window = getView();
+ QQuickViewTestUtil::moveMouseAway(window);
+
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("initialOrientation", initValues ? orientation : QQuickListView::Vertical);
+ ctxt->setContextProperty("initialFlickableDirection", initValues ? flickableDirection : QQuickFlickable::VerticalFlick);
+ ctxt->setContextProperty("initialContentWidth", initValues ? contentWidth : -1);
+ ctxt->setContextProperty("initialContentHeight", initValues ? contentHeight : -1);
+
+ window->setSource(testFileUrl("flickBothDirections.qml"));
+ window->show();
+ QVERIFY(QTest::qWaitForWindowActive(window));
+
+ QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
+ QVERIFY(listview);
+
+ if (!initValues) {
+ listview->setOrientation(orientation);
+ listview->setFlickableDirection(flickableDirection);
+ if (contentWidth > 0)
+ listview->setContentWidth(contentWidth);
+ if (contentHeight > 0)
+ listview->setContentHeight(contentHeight);
+ }
+
+ flick(window, QPoint(100, 100), QPoint(25, 25), 50);
+ QVERIFY(listview->isMoving());
+ QTRY_VERIFY(!listview->isMoving());
+ QCOMPARE(listview->contentX(), targetPos.x());
+ QCOMPARE(listview->contentY(), targetPos.y());
+}
+
+void tst_QQuickListView::flickBothDirections_data()
+{
+ QTest::addColumn<bool>("initValues");
+ QTest::addColumn<QQuickListView::Orientation>("orientation");
+ QTest::addColumn<QQuickFlickable::FlickableDirection>("flickableDirection");
+ QTest::addColumn<qreal>("contentWidth");
+ QTest::addColumn<qreal>("contentHeight");
+ QTest::addColumn<QPointF>("targetPos");
+
+ // model: 20
+ // listview: 100x100
+ // vertical delegate: 120x20 -> contentHeight: 20x20=400
+ // horizontal delegate: 10x110 -> contentWidth: 20x10=200
+
+ QTest::newRow("init:vertical,-1") << true << QQuickListView::Vertical << QQuickFlickable::VerticalFlick << -1. << -1. << QPointF(0, 300);
+ QTest::newRow("init:vertical,120") << true << QQuickListView::Vertical << QQuickFlickable::VerticalFlick<< 120. << -1. << QPointF(0, 300);
+ QTest::newRow("init:vertical,auto,-1") << true << QQuickListView::Vertical << QQuickFlickable::AutoFlickDirection << -1. << -1. << QPointF(0, 300);
+ QTest::newRow("init:vertical,auto,120") << true << QQuickListView::Vertical << QQuickFlickable::AutoFlickDirection << 120. << -1. << QPointF(20, 300);
+
+ QTest::newRow("completed:vertical,-1") << false << QQuickListView::Vertical << QQuickFlickable::VerticalFlick << -1. << -1. << QPointF(0, 300);
+ QTest::newRow("completed:vertical,120") << false << QQuickListView::Vertical << QQuickFlickable::VerticalFlick << 120. << -1. << QPointF(0, 300);
+ QTest::newRow("completed:vertical,auto,-1") << false << QQuickListView::Vertical << QQuickListView::AutoFlickDirection << -1. << -1. << QPointF(0, 300);
+ QTest::newRow("completed:vertical,auto,120") << false << QQuickListView::Vertical << QQuickListView::AutoFlickDirection << 120. << -1. << QPointF(20, 300);
+
+ QTest::newRow("init:horizontal,-1") << true << QQuickListView::Horizontal << QQuickFlickable::HorizontalFlick << -1. << -1. << QPointF(100, 0);
+ QTest::newRow("init:horizontal,110") << true << QQuickListView::Horizontal << QQuickFlickable::HorizontalFlick <<-1. << 110. << QPointF(100, 0);
+ QTest::newRow("init:horizontal,auto,-1") << true << QQuickListView::Horizontal << QQuickListView::AutoFlickDirection << -1. << -1. << QPointF(100, 0);
+ QTest::newRow("init:horizontal,auto,110") << true << QQuickListView::Horizontal << QQuickListView::AutoFlickDirection << -1. << 110. << QPointF(100, 10);
+
+ QTest::newRow("completed:horizontal,-1") << false << QQuickListView::Horizontal << QQuickFlickable::HorizontalFlick << -1. << -1. << QPointF(100, 0);
+ QTest::newRow("completed:horizontal,110") << false << QQuickListView::Horizontal << QQuickFlickable::HorizontalFlick << -1. << 110. << QPointF(100, 0);
+ QTest::newRow("completed:horizontal,auto,-1") << false << QQuickListView::Horizontal << QQuickListView::AutoFlickDirection << -1. << -1. << QPointF(100, 0);
+ QTest::newRow("completed:horizontal,auto,110") << false << QQuickListView::Horizontal << QQuickListView::AutoFlickDirection << -1. << 110. << QPointF(100, 10);
+}
+
void tst_QQuickListView::destroyItemOnCreation()
{
QaimModel model;
@@ -8271,7 +8350,7 @@ void tst_QQuickListView::QTBUG_48044_currentItemNotVisibleAfterTransition()
void tst_QQuickListView::keyNavigationEnabled()
{
QScopedPointer<QQuickView> window(createView());
- window->setSource(testFileUrl("simplelistview.qml"));
+ window->setSource(testFileUrl("keyNavigationEnabled.qml"));
window->show();
window->requestActivate();
QVERIFY(QTest::qWaitForWindowActive(window.data()));
diff --git a/tests/auto/quick/qquickpathview/data/removePath.qml b/tests/auto/quick/qquickpathview/data/removePath.qml
new file mode 100644
index 0000000000..85029f3eaf
--- /dev/null
+++ b/tests/auto/quick/qquickpathview/data/removePath.qml
@@ -0,0 +1,26 @@
+import QtQuick 2.0
+
+PathView {
+ width: 240
+ height: 200
+
+ path: myPath
+
+ delegate: Text { text: value }
+ model: 10
+
+ Path {
+ id: myPath
+ startX: 120; startY: 100
+ PathQuad { x: 120; y: 25; controlX: 260; controlY: 75 }
+ PathQuad { x: 120; y: 100; controlX: -20; controlY: 75 }
+ }
+
+ function removePath() {
+ path = null
+ }
+
+ function setPath() {
+ path = myPath
+ }
+}
diff --git a/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp b/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp
index ba3d182efc..b01d0c3cec 100644
--- a/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp
+++ b/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp
@@ -141,6 +141,7 @@ private slots:
void addCustomAttribute();
void movementDirection_data();
void movementDirection();
+ void removePath();
};
class TestObject : public QObject
@@ -2504,6 +2505,19 @@ void tst_QQuickPathView::movementDirection()
verify_offsets(pathview, toidx, fromoffset, tooffset);
}
+void tst_QQuickPathView::removePath()
+{
+ QScopedPointer<QQuickView> window(createView());
+ window->setSource(testFileUrl("removePath.qml"));
+ window->show();
+
+ QQuickPathView *pathview = qobject_cast<QQuickPathView*>(window->rootObject());
+ QVERIFY(pathview != 0);
+
+ QVERIFY(QMetaObject::invokeMethod(pathview, "removePath"));
+ QVERIFY(QMetaObject::invokeMethod(pathview, "setPath"));
+}
+
QTEST_MAIN(tst_QQuickPathView)
#include "tst_qquickpathview.moc"
diff --git a/tests/auto/quick/qquicktext/tst_qquicktext.cpp b/tests/auto/quick/qquicktext/tst_qquicktext.cpp
index 2032f72e26..034ea4aec8 100644
--- a/tests/auto/quick/qquicktext/tst_qquicktext.cpp
+++ b/tests/auto/quick/qquicktext/tst_qquicktext.cpp
@@ -762,11 +762,6 @@ void tst_qquicktext::horizontalAlignment()
void tst_qquicktext::horizontalAlignment_RightToLeft()
{
-#if defined(Q_OS_BLACKBERRY)
- QQuickWindow dummy; // On BlackBerry first window is always full screen,
- dummy.showFullScreen(); // so make test window a second window.
-#endif
-
QScopedPointer<QQuickView> window(createView(testFile("horizontalAlignment_RightToLeft.qml")));
QQuickText *text = window->rootObject()->findChild<QQuickText*>("text");
QVERIFY(text != 0);
diff --git a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp
index 1451f8e2fc..67921e1fd0 100644
--- a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp
+++ b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp
@@ -135,6 +135,7 @@ private slots:
void signal_accepted();
void signal_editingfinished();
+ void signal_textEdited();
void passwordCharacter();
void cursorDelegate_data();
@@ -2441,6 +2442,57 @@ void tst_qquicktextinput::signal_editingfinished()
QTRY_COMPARE(editingFinished2Spy.count(), 1);
}
+void tst_qquicktextinput::signal_textEdited()
+{
+ QQuickWindow window;
+ window.show();
+ window.requestActivate();
+ QTest::qWaitForWindowActive(&window);
+
+ QQuickTextInput *input = new QQuickTextInput(window.contentItem());
+ QVERIFY(input);
+
+ QSignalSpy textChangedSpy(input, SIGNAL(textChanged()));
+ QVERIFY(textChangedSpy.isValid());
+
+ QSignalSpy textEditedSpy(input, SIGNAL(textEdited()));
+ QVERIFY(textEditedSpy.isValid());
+
+ input->forceActiveFocus();
+ QTRY_VERIFY(input->hasActiveFocus());
+
+ int textChanges = 0;
+ int textEdits = 0;
+
+ QTest::keyClick(&window, Qt::Key_A);
+ QCOMPARE(textChangedSpy.count(), ++textChanges);
+ QCOMPARE(textEditedSpy.count(), ++textEdits);
+
+ QTest::keyClick(&window, Qt::Key_B);
+ QCOMPARE(textChangedSpy.count(), ++textChanges);
+ QCOMPARE(textEditedSpy.count(), ++textEdits);
+
+ QTest::keyClick(&window, Qt::Key_C);
+ QCOMPARE(textChangedSpy.count(), ++textChanges);
+ QCOMPARE(textEditedSpy.count(), ++textEdits);
+
+ QTest::keyClick(&window, Qt::Key_Space);
+ QCOMPARE(textChangedSpy.count(), ++textChanges);
+ QCOMPARE(textEditedSpy.count(), ++textEdits);
+
+ QTest::keyClick(&window, Qt::Key_Backspace);
+ QCOMPARE(textChangedSpy.count(), ++textChanges);
+ QCOMPARE(textEditedSpy.count(), ++textEdits);
+
+ input->clear();
+ QCOMPARE(textChangedSpy.count(), ++textChanges);
+ QCOMPARE(textEditedSpy.count(), textEdits);
+
+ input->setText("TextInput");
+ QCOMPARE(textChangedSpy.count(), ++textChanges);
+ QCOMPARE(textEditedSpy.count(), textEdits);
+}
+
/*
TextInput element should only handle left/right keys until the cursor reaches
the extent of the text, then they should ignore the keys.
diff --git a/tests/auto/quick/qquickwindow/data/grabContentItemToImage.qml b/tests/auto/quick/qquickwindow/data/grabContentItemToImage.qml
new file mode 100644
index 0000000000..9086e0cc84
--- /dev/null
+++ b/tests/auto/quick/qquickwindow/data/grabContentItemToImage.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+import QtQuick.Window 2.2 as Window
+
+Window.Window {
+ visible: true
+ width: 100
+ height: 100
+ property int success: 0
+
+ function grabContentItemToImage() {
+ contentItem.grabToImage(function (image) {
+ success = 1
+ })
+ }
+}
diff --git a/tests/auto/quick/qquickwindow/qquickwindow.pro b/tests/auto/quick/qquickwindow/qquickwindow.pro
index 05093ba8e0..b0a5f97a32 100644
--- a/tests/auto/quick/qquickwindow/qquickwindow.pro
+++ b/tests/auto/quick/qquickwindow/qquickwindow.pro
@@ -16,4 +16,5 @@ OTHER_FILES += \
data/AnimationsWhileHidden.qml \
data/Headless.qml \
data/showHideAnimate.qml \
- data/windoworder.qml
+ data/windoworder.qml \
+ data/grabContentItemToImage.qml
diff --git a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
index 300ca392f9..dd00154935 100644
--- a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
+++ b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
@@ -370,6 +370,8 @@ private slots:
void pointerEventTypeAndPointCount();
+ void grabContentItemToImage();
+
private:
QTouchDevice *touchDevice;
QTouchDevice *touchDeviceWithVelocity;
@@ -2554,6 +2556,23 @@ void tst_qquickwindow::pointerEventTypeAndPointCount()
QVERIFY(!pte.touchPointById(0));
}
+void tst_qquickwindow::grabContentItemToImage()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+ component.loadUrl(testFileUrl("grabContentItemToImage.qml"));
+
+ QObject *created = component.create();
+ QScopedPointer<QObject> cleanup(created);
+ QVERIFY(created);
+
+ QQuickWindow *window = qobject_cast<QQuickWindow *>(created);
+ QVERIFY(QTest::qWaitForWindowActive(window));
+
+ QMetaObject::invokeMethod(window, "grabContentItemToImage");
+ QTRY_COMPARE(created->property("success").toInt(), 1);
+}
+
QTEST_MAIN(tst_qquickwindow)
#include "tst_qquickwindow.moc"
diff --git a/tests/auto/quick/qquickxmllistmodel/qquickxmllistmodel.pro b/tests/auto/quick/qquickxmllistmodel/qquickxmllistmodel.pro
index 642345a4bb..902325802c 100644
--- a/tests/auto/quick/qquickxmllistmodel/qquickxmllistmodel.pro
+++ b/tests/auto/quick/qquickxmllistmodel/qquickxmllistmodel.pro
@@ -2,7 +2,9 @@ CONFIG += testcase
TARGET = tst_qquickxmllistmodel
macx:CONFIG -= app_bundle
-SOURCES += tst_qquickxmllistmodel.cpp
+SOURCES += tst_qquickxmllistmodel.cpp \
+ ../../../../src/imports/xmllistmodel/qqmlxmllistmodel.cpp
+HEADERS += ../../../../src/imports/xmllistmodel/qqmlxmllistmodel_p.h
include (../../shared/util.pri)
diff --git a/tests/auto/quick/touchmouse/tst_touchmouse.cpp b/tests/auto/quick/touchmouse/tst_touchmouse.cpp
index b5af61d723..4f4fac8fa5 100644
--- a/tests/auto/quick/touchmouse/tst_touchmouse.cpp
+++ b/tests/auto/quick/touchmouse/tst_touchmouse.cpp
@@ -194,8 +194,6 @@ private:
QQuickView *tst_TouchMouse::createView()
{
QQuickView *window = new QQuickView(0);
- window->setGeometry(0,0,240,320);
-
return window;
}
@@ -210,13 +208,11 @@ void tst_TouchMouse::initTestCase()
void tst_TouchMouse::simpleTouchEvent()
{
- QQuickView *window = createView();
-
+ QScopedPointer<QQuickView> window(createView());
window->setSource(testFileUrl("singleitem.qml"));
window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window));
- window->requestActivate();
- QVERIFY(QTest::qWaitForWindowActive(window));
+ QQuickViewTestUtil::centerOnScreen(window.data());
+ QVERIFY(QTest::qWaitForWindowActive(window.data()));
QVERIFY(window->rootObject() != 0);
EventItem *eventItem1 = window->rootObject()->findChild<EventItem*>("eventItem1");
@@ -225,33 +221,33 @@ void tst_TouchMouse::simpleTouchEvent()
// Do not accept touch or mouse
QPoint p1;
p1 = QPoint(20, 20);
- QTest::touchEvent(window, device).press(0, p1, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).press(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
// Get a touch and then mouse event offered
QCOMPARE(eventItem1->eventList.size(), 2);
QCOMPARE(eventItem1->eventList.at(0).type, QEvent::TouchBegin);
p1 += QPoint(10, 0);
- QTest::touchEvent(window, device).move(0, p1, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).move(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
// Not accepted, no updates
QCOMPARE(eventItem1->eventList.size(), 2);
- QTest::touchEvent(window, device).release(0, p1, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).release(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(eventItem1->eventList.size(), 2);
eventItem1->eventList.clear();
// Accept touch
eventItem1->acceptTouch = true;
p1 = QPoint(20, 20);
- QTest::touchEvent(window, device).press(0, p1, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).press(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(eventItem1->eventList.size(), 1);
p1 += QPoint(10, 0);
- QTest::touchEvent(window, device).move(0, p1, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).move(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(eventItem1->eventList.size(), 2);
- QTest::touchEvent(window, device).release(0, p1, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).release(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(eventItem1->eventList.size(), 3);
eventItem1->eventList.clear();
@@ -263,8 +259,8 @@ void tst_TouchMouse::simpleTouchEvent()
eventItem1->acceptMouse = true;
eventItem1->setAcceptedMouseButtons(Qt::LeftButton);
p1 = QPoint(20, 20);
- QTest::touchEvent(window, device).press(0, p1, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).press(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(eventItem1->eventList.size(), 2);
QCOMPARE(eventItem1->eventList.at(0).type, QEvent::TouchBegin);
QCOMPARE(eventItem1->eventList.at(1).type, QEvent::MouseButtonPress);
@@ -280,13 +276,13 @@ void tst_TouchMouse::simpleTouchEvent()
QCOMPARE(eventItem1->eventList.at(1).mousePosGlobal, globalPos);
p1 += QPoint(10, 0);
- QTest::touchEvent(window, device).move(0, p1, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).move(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(eventItem1->eventList.size(), 4);
QCOMPARE(eventItem1->eventList.at(2).type, QEvent::TouchUpdate);
QCOMPARE(eventItem1->eventList.at(3).type, QEvent::MouseMove);
- QTest::touchEvent(window, device).release(0, p1, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).release(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(eventItem1->eventList.size(), 7);
QCOMPARE(eventItem1->eventList.at(4).type, QEvent::TouchEnd);
QCOMPARE(eventItem1->eventList.at(5).type, QEvent::MouseButtonRelease);
@@ -301,17 +297,17 @@ void tst_TouchMouse::simpleTouchEvent()
eventItem1->acceptMouse = false;
eventItem1->setAcceptedMouseButtons(Qt::LeftButton);
p1 = QPoint(20, 20);
- QTest::touchEvent(window, device).press(0, p1, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).press(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(eventItem1->eventList.size(), 2);
QCOMPARE(eventItem1->eventList.at(0).type, QEvent::TouchBegin);
QCOMPARE(eventItem1->eventList.at(1).type, QEvent::MouseButtonPress);
p1 += QPoint(10, 0);
- QTest::touchEvent(window, device).move(0, p1, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).move(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(eventItem1->eventList.size(), 2);
- QTest::touchEvent(window, device).release(0, p1, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).release(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(eventItem1->eventList.size(), 2);
eventItem1->eventList.clear();
@@ -322,32 +318,30 @@ void tst_TouchMouse::simpleTouchEvent()
eventItem1->acceptTouch = true;
eventItem1->setAcceptedMouseButtons(Qt::LeftButton);
p1 = QPoint(20, 20);
- QTest::touchEvent(window, device).press(0, p1, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).press(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(eventItem1->eventList.size(), 1);
QCOMPARE(eventItem1->eventList.at(0).type, QEvent::TouchBegin);
p1 += QPoint(10, 0);
- QTest::touchEvent(window, device).move(0, p1, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).move(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(eventItem1->eventList.size(), 2);
QCOMPARE(eventItem1->eventList.at(1).type, QEvent::TouchUpdate);
- QTest::touchEvent(window, device).release(0, p1, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).release(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(eventItem1->eventList.size(), 3);
QCOMPARE(eventItem1->eventList.at(2).type, QEvent::TouchEnd);
eventItem1->eventList.clear();
-
- delete window;
}
void tst_TouchMouse::testEventFilter()
{
// // install event filter on item and see that it can grab events
-// QQuickView *window = createView();
-
+// QScopedPointer<QQuickView> window(createView());
// window->setSource(testFileUrl("singleitem.qml"));
// window->show();
-// window->requestActivate();
+// QQuickViewTestUtil::centerOnScreen(window.data());
+// QVERIFY(QTest::qWaitForWindowActive(window.data()));
// QVERIFY(window->rootObject() != 0);
// EventItem *eventItem1 = window->rootObject()->findChild<EventItem*>("eventItem1");
@@ -359,16 +353,15 @@ void tst_TouchMouse::testEventFilter()
// eventItem1->installEventFilter(filter);
// QPoint p1 = QPoint(20, 20);
-// QTest::touchEvent(window, device).press(0, p1, window);
+// QTest::touchEvent(window.data(), device).press(0, p1, window.data());
// // QEXPECT_FAIL("", "We do not implement event filters correctly", Abort);
// QCOMPARE(eventItem1->eventList.size(), 0);
// QCOMPARE(filter->eventList.size(), 1);
-// QTest::touchEvent(window, device).release(0, p1, window);
+// QTest::touchEvent(window.data(), device).release(0, p1, window.data());
// QCOMPARE(eventItem1->eventList.size(), 0);
// QCOMPARE(filter->eventList.size(), 2);
// delete filter;
-// delete window;
}
void tst_TouchMouse::mouse()
@@ -377,34 +370,29 @@ void tst_TouchMouse::mouse()
// - eventItem2
QTest::qWait(qApp->styleHints()->mouseDoubleClickInterval() + 10);
- QQuickView *window = createView();
-
+ QScopedPointer<QQuickView> window(createView());
window->setSource(testFileUrl("twoitems.qml"));
window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window));
- window->requestActivate();
- QVERIFY(QTest::qWaitForWindowActive(window));
+ QQuickViewTestUtil::centerOnScreen(window.data());
+ QVERIFY(QTest::qWaitForWindowActive(window.data()));
QVERIFY(window->rootObject() != 0);
EventItem *eventItem1 = window->rootObject()->findChild<EventItem*>("eventItem1");
QVERIFY(eventItem1);
EventItem *eventItem2 = window->rootObject()->findChild<EventItem*>("eventItem2");
QVERIFY(eventItem2);
- QVERIFY(QTest::qWaitForWindowExposed(window));
// bottom item likes mouse, top likes touch
eventItem1->setAcceptedMouseButtons(Qt::LeftButton);
eventItem1->acceptMouse = true;
// item 2 doesn't accept anything, thus it sees a touch pass by
QPoint p1 = QPoint(30, 30);
- QTest::touchEvent(window, device).press(0, p1, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).press(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(eventItem1->eventList.size(), 2);
QCOMPARE(eventItem1->eventList.at(0).type, QEvent::TouchBegin);
QCOMPARE(eventItem1->eventList.at(1).type, QEvent::MouseButtonPress);
-
- delete window;
}
void tst_TouchMouse::touchOverMouse()
@@ -412,13 +400,11 @@ void tst_TouchMouse::touchOverMouse()
// eventItem1
// - eventItem2
- QQuickView *window = createView();
-
+ QScopedPointer<QQuickView> window(createView());
window->setSource(testFileUrl("twoitems.qml"));
window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window));
- window->requestActivate();
- QVERIFY(QTest::qWaitForWindowActive(window));
+ QQuickViewTestUtil::centerOnScreen(window.data());
+ QVERIFY(QTest::qWaitForWindowActive(window.data()));
QVERIFY(window->rootObject() != 0);
EventItem *eventItem1 = window->rootObject()->findChild<EventItem*>("eventItem1");
@@ -430,27 +416,23 @@ void tst_TouchMouse::touchOverMouse()
eventItem1->setAcceptedMouseButtons(Qt::LeftButton);
eventItem2->acceptTouch = true;
- QVERIFY(QTest::qWaitForWindowExposed(window));
-
QCOMPARE(eventItem1->eventList.size(), 0);
QPoint p1 = QPoint(20, 20);
- QTest::touchEvent(window, device).press(0, p1, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).press(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(eventItem1->eventList.size(), 0);
QCOMPARE(eventItem2->eventList.size(), 1);
QCOMPARE(eventItem2->eventList.at(0).type, QEvent::TouchBegin);
p1 += QPoint(10, 0);
- QTest::touchEvent(window, device).move(0, p1, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).move(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(eventItem2->eventList.size(), 2);
QCOMPARE(eventItem2->eventList.at(1).type, QEvent::TouchUpdate);
- QTest::touchEvent(window, device).release(0, p1, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).release(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(eventItem2->eventList.size(), 3);
QCOMPARE(eventItem2->eventList.at(2).type, QEvent::TouchEnd);
eventItem2->eventList.clear();
-
- delete window;
}
void tst_TouchMouse::mouseOverTouch()
@@ -458,13 +440,11 @@ void tst_TouchMouse::mouseOverTouch()
// eventItem1
// - eventItem2
- QQuickView *window = createView();
-
+ QScopedPointer<QQuickView> window(createView());
window->setSource(testFileUrl("twoitems.qml"));
window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window));
- window->requestActivate();
- QVERIFY(QTest::qWaitForWindowActive(window));
+ QQuickViewTestUtil::centerOnScreen(window.data());
+ QVERIFY(QTest::qWaitForWindowActive(window.data()));
QVERIFY(window->rootObject() != 0);
EventItem *eventItem1 = window->rootObject()->findChild<EventItem*>("eventItem1");
@@ -477,12 +457,10 @@ void tst_TouchMouse::mouseOverTouch()
eventItem2->setAcceptedMouseButtons(Qt::LeftButton);
eventItem2->acceptMouse = true;
- QVERIFY(QTest::qWaitForWindowExposed(window));
-
QPoint p1 = QPoint(20, 20);
QTest::qWait(qApp->styleHints()->mouseDoubleClickInterval() + 10);
- QTest::touchEvent(window, device).press(0, p1, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).press(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(eventItem1->eventList.size(), 0);
QCOMPARE(eventItem2->eventList.size(), 2);
QCOMPARE(eventItem2->eventList.at(0).type, QEvent::TouchBegin);
@@ -490,13 +468,11 @@ void tst_TouchMouse::mouseOverTouch()
// p1 += QPoint(10, 0);
-// QTest::touchEvent(window, device).move(0, p1, window);
+// QTest::touchEvent(window.data(), device).move(0, p1, window.data());
// QCOMPARE(eventItem2->eventList.size(), 1);
-// QTest::touchEvent(window, device).release(0, p1, window);
+// QTest::touchEvent(window.data(), device).release(0, p1, window.data());
// QCOMPARE(eventItem2->eventList.size(), 1);
// eventItem2->eventList.clear();
-
- delete window;
}
void tst_TouchMouse::buttonOnFlickable()
@@ -505,13 +481,11 @@ void tst_TouchMouse::buttonOnFlickable()
// - eventItem1 y: 100, height 100
// - eventItem2 y: 300, height 100
- QQuickView *window = createView();
-
+ QScopedPointer<QQuickView> window(createView());
window->setSource(testFileUrl("buttononflickable.qml"));
window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window));
- window->requestActivate();
- QVERIFY(QTest::qWaitForWindowActive(window));
+ QQuickViewTestUtil::centerOnScreen(window.data());
+ QVERIFY(QTest::qWaitForWindowActive(window.data()));
QVERIFY(window->rootObject() != 0);
QQuickFlickable *flickable = window->rootObject()->findChild<QQuickFlickable*>("flickable");
@@ -536,13 +510,13 @@ void tst_TouchMouse::buttonOnFlickable()
// mouse button
QCOMPARE(eventItem1->eventList.size(), 0);
QPoint p1 = QPoint(20, 130);
- QTest::touchEvent(window, device).press(0, p1, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).press(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
QTRY_COMPARE(eventItem1->eventList.size(), 2);
QCOMPARE(eventItem1->eventList.at(0).type, QEvent::TouchBegin);
QCOMPARE(eventItem1->eventList.at(1).type, QEvent::MouseButtonPress);
- QTest::touchEvent(window, device).release(0, p1, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).release(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(eventItem1->eventList.size(), 5);
QCOMPARE(eventItem1->eventList.at(2).type, QEvent::TouchEnd);
QCOMPARE(eventItem1->eventList.at(3).type, QEvent::MouseButtonRelease);
@@ -551,12 +525,12 @@ void tst_TouchMouse::buttonOnFlickable()
// touch button
p1 = QPoint(10, 310);
- QTest::touchEvent(window, device).press(0, p1, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).press(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(eventItem2->eventList.size(), 1);
QCOMPARE(eventItem2->eventList.at(0).type, QEvent::TouchBegin);
- QTest::touchEvent(window, device).release(0, p1, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).release(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(eventItem2->eventList.size(), 2);
QCOMPARE(eventItem2->eventList.at(1).type, QEvent::TouchEnd);
QCOMPARE(eventItem1->eventList.size(), 0);
@@ -567,11 +541,11 @@ void tst_TouchMouse::buttonOnFlickable()
// click above button, no events please
p1 = QPoint(10, 90);
- QTest::touchEvent(window, device).press(0, p1, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).press(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(eventItem1->eventList.size(), 0);
- QTest::touchEvent(window, device).release(0, p1, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).release(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(eventItem1->eventList.size(), 0);
eventItem1->eventList.clear();
@@ -581,13 +555,13 @@ void tst_TouchMouse::buttonOnFlickable()
// check that flickable moves - mouse button
QCOMPARE(eventItem1->eventList.size(), 0);
p1 = QPoint(10, 110);
- QTest::touchEvent(window, device).press(0, p1, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).press(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(eventItem1->eventList.size(), 2);
QCOMPARE(eventItem1->eventList.at(0).type, QEvent::TouchBegin);
QCOMPARE(eventItem1->eventList.at(1).type, QEvent::MouseButtonPress);
- QQuickWindowPrivate *windowPriv = QQuickWindowPrivate::get(window);
+ QQuickWindowPrivate *windowPriv = QQuickWindowPrivate::get(window.data());
QVERIFY(windowPriv->touchMouseId != -1);
auto pointerEvent = QQuickPointerDevice::touchDevices().at(0)->pointerEvent();
QCOMPARE(pointerEvent->point(0)->grabber(), eventItem1);
@@ -596,13 +570,13 @@ void tst_TouchMouse::buttonOnFlickable()
p1 += QPoint(0, -10);
QPoint p2 = p1 + QPoint(0, -10);
QPoint p3 = p2 + QPoint(0, -10);
- QQuickTouchUtils::flush(window);
- QTest::touchEvent(window, device).move(0, p1, window);
- QQuickTouchUtils::flush(window);
- QTest::touchEvent(window, device).move(0, p2, window);
- QQuickTouchUtils::flush(window);
- QTest::touchEvent(window, device).move(0, p3, window);
- QQuickTouchUtils::flush(window);
+ QQuickTouchUtils::flush(window.data());
+ QTest::touchEvent(window.data(), device).move(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
+ QTest::touchEvent(window.data(), device).move(0, p2, window.data());
+ QQuickTouchUtils::flush(window.data());
+ QTest::touchEvent(window.data(), device).move(0, p3, window.data());
+ QQuickTouchUtils::flush(window.data());
// we cannot really know when the events get grabbed away
QVERIFY(eventItem1->eventList.size() >= 4);
@@ -614,9 +588,8 @@ void tst_TouchMouse::buttonOnFlickable()
QCOMPARE(pointerEvent->point(0)->grabber(), flickable);
QVERIFY(flickable->isMovingVertically());
- QTest::touchEvent(window, device).release(0, p3, window);
- QQuickTouchUtils::flush(window);
- delete window;
+ QTest::touchEvent(window.data(), device).release(0, p3, window.data());
+ QQuickTouchUtils::flush(window.data());
}
void tst_TouchMouse::buttonOnDelayedPressFlickable_data()
@@ -642,13 +615,11 @@ void tst_TouchMouse::buttonOnDelayedPressFlickable()
qApp->setAttribute(Qt::AA_SynthesizeMouseForUnhandledTouchEvents, true);
filteredEventList.clear();
- QQuickView *window = createView();
-
+ QScopedPointer<QQuickView> window(createView());
window->setSource(testFileUrl("buttononflickable.qml"));
window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window));
- window->requestActivate();
- QVERIFY(QTest::qWaitForWindowActive(window));
+ QQuickViewTestUtil::centerOnScreen(window.data());
+ QVERIFY(QTest::qWaitForWindowActive(window.data()));
QVERIFY(window->rootObject() != 0);
QQuickFlickable *flickable = window->rootObject()->findChild<QQuickFlickable*>("flickable");
@@ -673,13 +644,13 @@ void tst_TouchMouse::buttonOnDelayedPressFlickable()
// wait to avoid getting a double click event
QTest::qWait(qApp->styleHints()->mouseDoubleClickInterval() + 10);
- QQuickWindowPrivate *windowPriv = QQuickWindowPrivate::get(window);
+ QQuickWindowPrivate *windowPriv = QQuickWindowPrivate::get(window.data());
QCOMPARE(windowPriv->touchMouseId, -1); // no grabber
// touch press
QPoint p1 = QPoint(10, 110);
- QTest::touchEvent(window, device).press(0, p1, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).press(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
if (scrollBeforeDelayIsOver) {
// no events, the flickable got scrolled, the button sees nothing
@@ -694,13 +665,13 @@ void tst_TouchMouse::buttonOnDelayedPressFlickable()
p1 += QPoint(0, -10);
QPoint p2 = p1 + QPoint(0, -10);
QPoint p3 = p2 + QPoint(0, -10);
- QQuickTouchUtils::flush(window);
- QTest::touchEvent(window, device).move(0, p1, window);
- QQuickTouchUtils::flush(window);
- QTest::touchEvent(window, device).move(0, p2, window);
- QQuickTouchUtils::flush(window);
- QTest::touchEvent(window, device).move(0, p3, window);
- QQuickTouchUtils::flush(window);
+ QQuickTouchUtils::flush(window.data());
+ QTest::touchEvent(window.data(), device).move(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
+ QTest::touchEvent(window.data(), device).move(0, p2, window.data());
+ QQuickTouchUtils::flush(window.data());
+ QTest::touchEvent(window.data(), device).move(0, p3, window.data());
+ QQuickTouchUtils::flush(window.data());
QTRY_VERIFY(flickable->isMovingVertically());
if (scrollBeforeDelayIsOver) {
@@ -721,8 +692,8 @@ void tst_TouchMouse::buttonOnDelayedPressFlickable()
auto pointerEvent = QQuickPointerDevice::touchDevices().at(0)->pointerEvent();
QCOMPARE(pointerEvent->point(0)->grabber(), flickable);
- QTest::touchEvent(window, device).release(0, p3, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).release(0, p3, window.data());
+ QQuickTouchUtils::flush(window.data());
// We should not have received any synthesised mouse events from Qt gui,
// just the delayed press.
@@ -730,8 +701,6 @@ void tst_TouchMouse::buttonOnDelayedPressFlickable()
QCOMPARE(filteredEventList.count(), 0);
else
QCOMPARE(filteredEventList.count(), 1);
-
- delete window;
}
void tst_TouchMouse::buttonOnTouch()
@@ -744,12 +713,11 @@ void tst_TouchMouse::buttonOnTouch()
// - eventItem1 y: 100, height 100
// - eventItem2 y: 300, height 100
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
window->setSource(testFileUrl("buttonontouch.qml"));
window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window));
- window->requestActivate();
- QVERIFY(QTest::qWaitForWindowActive(window));
+ QQuickViewTestUtil::centerOnScreen(window.data());
+ QVERIFY(QTest::qWaitForWindowActive(window.data()));
QVERIFY(window->rootObject() != 0);
QQuickPinchArea *pinchArea = window->rootObject()->findChild<QQuickPinchArea*>("pincharea");
@@ -779,10 +747,10 @@ void tst_TouchMouse::buttonOnTouch()
// Normal touch click
QPoint p1 = QPoint(10, 110);
- QTest::touchEvent(window, device).press(0, p1, window);
- QQuickTouchUtils::flush(window);
- QTest::touchEvent(window, device).release(0, p1, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).press(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
+ QTest::touchEvent(window.data(), device).release(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(eventItem1->eventList.size(), 5);
QCOMPARE(eventItem1->eventList.at(0).type, QEvent::TouchBegin);
QCOMPARE(eventItem1->eventList.at(1).type, QEvent::MouseButtonPress);
@@ -792,7 +760,7 @@ void tst_TouchMouse::buttonOnTouch()
eventItem1->eventList.clear();
// Normal mouse click
- QTest::mouseClick(window, Qt::LeftButton, 0, p1);
+ QTest::mouseClick(window.data(), Qt::LeftButton, 0, p1);
QCOMPARE(eventItem1->eventList.size(), 3);
QCOMPARE(eventItem1->eventList.at(0).type, QEvent::MouseButtonPress);
QCOMPARE(eventItem1->eventList.at(1).type, QEvent::MouseButtonRelease);
@@ -804,35 +772,35 @@ void tst_TouchMouse::buttonOnTouch()
QPoint p2 = QPoint(60, 10);
// Start the events after each other
- QTest::touchEvent(window, device).press(0, p1, window);
- QQuickTouchUtils::flush(window);
- QTest::touchEvent(window, device).stationary(0).press(1, p2, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).press(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
+ QTest::touchEvent(window.data(), device).stationary(0).press(1, p2, window.data());
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(button1->scale(), 1.0);
// This event seems to be discarded, let's ignore it for now until someone digs into pincharea
p1 -= QPoint(10, 0);
p2 += QPoint(10, 0);
- QTest::touchEvent(window, device).move(0, p1, window).move(1, p2, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).move(0, p1, window.data()).move(1, p2, window.data());
+ QQuickTouchUtils::flush(window.data());
p1 -= QPoint(10, 0);
p2 += QPoint(10, 0);
- QTest::touchEvent(window, device).move(0, p1, window).move(1, p2, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).move(0, p1, window.data()).move(1, p2, window.data());
+ QQuickTouchUtils::flush(window.data());
// QCOMPARE(button1->scale(), 1.5);
qDebug() << "Button scale: " << button1->scale();
p1 -= QPoint(10, 0);
p2 += QPoint(10, 0);
- QTest::touchEvent(window, device).move(0, p1, window).move(1, p2, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).move(0, p1, window.data()).move(1, p2, window.data());
+ QQuickTouchUtils::flush(window.data());
// QCOMPARE(button1->scale(), 2.0);
qDebug() << "Button scale: " << button1->scale();
- QTest::touchEvent(window, device).release(0, p1, window).release(1, p2, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).release(0, p1, window.data()).release(1, p2, window.data());
+ QQuickTouchUtils::flush(window.data());
// QVERIFY(eventItem1->eventList.isEmpty());
// QCOMPARE(button1->scale(), 2.0);
qDebug() << "Button scale: " << button1->scale();
@@ -845,8 +813,8 @@ void tst_TouchMouse::buttonOnTouch()
button1->setScale(1.0);
p1 = QPoint(40, 110);
p2 = QPoint(60, 110);
- QTest::touchEvent(window, device).press(0, p1, window).press(1, p2, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).press(0, p1, window.data()).press(1, p2, window.data());
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(button1->scale(), 1.0);
QCOMPARE(eventItem1->eventList.count(), 2);
QCOMPARE(eventItem1->eventList.at(0).type, QEvent::TouchBegin);
@@ -855,40 +823,37 @@ void tst_TouchMouse::buttonOnTouch()
// This event seems to be discarded, let's ignore it for now until someone digs into pincharea
p1 -= QPoint(10, 0);
p2 += QPoint(10, 0);
- QTest::touchEvent(window, device).move(0, p1, window).move(1, p2, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).move(0, p1, window.data()).move(1, p2, window.data());
+ QQuickTouchUtils::flush(window.data());
p1 -= QPoint(10, 0);
p2 += QPoint(10, 0);
- QTest::touchEvent(window, device).move(0, p1, window).move(1, p2, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).move(0, p1, window.data()).move(1, p2, window.data());
+ QQuickTouchUtils::flush(window.data());
//QCOMPARE(button1->scale(), 1.5);
qDebug() << button1->scale();
p1 -= QPoint(10, 0);
p2 += QPoint(10, 0);
- QTest::touchEvent(window, device).move(0, p1, window).move(1, p2, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).move(0, p1, window.data()).move(1, p2, window.data());
+ QQuickTouchUtils::flush(window.data());
qDebug() << button1->scale();
//QCOMPARE(button1->scale(), 2.0);
- QTest::touchEvent(window, device).release(0, p1, window).release(1, p2, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).release(0, p1, window.data()).release(1, p2, window.data());
+ QQuickTouchUtils::flush(window.data());
// QCOMPARE(eventItem1->eventList.size(), 99);
qDebug() << button1->scale();
//QCOMPARE(button1->scale(), 2.0);
-
- delete window;
}
void tst_TouchMouse::pinchOnFlickable()
{
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
window->setSource(testFileUrl("pinchonflickable.qml"));
window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window));
- window->requestActivate();
- QVERIFY(QTest::qWaitForWindowActive(window));
+ QQuickViewTestUtil::centerOnScreen(window.data());
+ QVERIFY(QTest::qWaitForWindowActive(window.data()));
QVERIFY(window->rootObject() != 0);
QQuickPinchArea *pinchArea = window->rootObject()->findChild<QQuickPinchArea*>("pincharea");
@@ -901,23 +866,23 @@ void tst_TouchMouse::pinchOnFlickable()
// flickable - single touch point
QCOMPARE(flickable->contentX(), 0.0);
QPoint p = QPoint(100, 100);
- QTest::touchEvent(window, device).press(0, p, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).press(0, p, window.data());
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(rect->position(), QPointF(200.0, 200.0));
p -= QPoint(10, 0);
- QTest::touchEvent(window, device).move(0, p, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).move(0, p, window.data());
+ QQuickTouchUtils::flush(window.data());
p -= QPoint(10, 0);
- QTest::touchEvent(window, device).move(0, p, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).move(0, p, window.data());
+ QQuickTouchUtils::flush(window.data());
p -= QPoint(10, 0);
- QTest::touchEvent(window, device).move(0, p, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).move(0, p, window.data());
+ QQuickTouchUtils::flush(window.data());
p -= QPoint(10, 0);
- QTest::touchEvent(window, device).move(0, p, window);
- QQuickTouchUtils::flush(window);
- QTest::touchEvent(window, device).release(0, p, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).move(0, p, window.data());
+ QQuickTouchUtils::flush(window.data());
+ QTest::touchEvent(window.data(), device).release(0, p, window.data());
+ QQuickTouchUtils::flush(window.data());
QGuiApplication::processEvents();
QTest::qWait(10);
@@ -929,48 +894,47 @@ void tst_TouchMouse::pinchOnFlickable()
QPoint p1 = QPoint(40, 20);
QPoint p2 = QPoint(60, 20);
- QTest::QTouchEventSequence pinchSequence = QTest::touchEvent(window, device);
- QQuickTouchUtils::flush(window);
- pinchSequence.press(0, p1, window).commit();
- QQuickTouchUtils::flush(window);
+ QTest::QTouchEventSequence pinchSequence = QTest::touchEvent(window.data(), device);
+ QQuickTouchUtils::flush(window.data());
+ pinchSequence.press(0, p1, window.data()).commit();
+ QQuickTouchUtils::flush(window.data());
// In order for the stationary point to remember its previous position,
// we have to reuse the same pinchSequence object. Otherwise if we let it
// be destroyed and then start a new sequence, point 0 will default to being
// stationary at 0, 0, and PinchArea will filter out that touchpoint because
// it is outside its bounds.
- pinchSequence.stationary(0).press(1, p2, window).commit();
- QQuickTouchUtils::flush(window);
+ pinchSequence.stationary(0).press(1, p2, window.data()).commit();
+ QQuickTouchUtils::flush(window.data());
p1 -= QPoint(10,10);
p2 += QPoint(10,10);
- pinchSequence.move(0, p1, window).move(1, p2, window).commit();
- QQuickTouchUtils::flush(window);
+ pinchSequence.move(0, p1, window.data()).move(1, p2, window.data()).commit();
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(rect->scale(), 1.0);
p1 -= QPoint(10, 0);
p2 += QPoint(10, 0);
- pinchSequence.move(0, p1, window).move(1, p2, window).commit();
- QQuickTouchUtils::flush(window);
+ pinchSequence.move(0, p1, window.data()).move(1, p2, window.data()).commit();
+ QQuickTouchUtils::flush(window.data());
p1 -= QPoint(10, 0);
p2 += QPoint(10, 0);
- pinchSequence.move(0, p1, window).move(1, p2, window).commit();
- QQuickTouchUtils::flush(window);
+ pinchSequence.move(0, p1, window.data()).move(1, p2, window.data()).commit();
+ QQuickTouchUtils::flush(window.data());
p1 -= QPoint(10, 0);
p2 += QPoint(10, 0);
- pinchSequence.move(0, p1, window).move(1, p2, window).commit();
+ pinchSequence.move(0, p1, window.data()).move(1, p2, window.data()).commit();
QVERIFY(!flickable->isDragging());
- QQuickTouchUtils::flush(window);
- pinchSequence.release(0, p1, window).release(1, p2, window).commit();
- QQuickTouchUtils::flush(window);
+ QQuickTouchUtils::flush(window.data());
+ pinchSequence.release(0, p1, window.data()).release(1, p2, window.data()).commit();
+ QQuickTouchUtils::flush(window.data());
QVERIFY(rect->scale() > 1.0);
}
void tst_TouchMouse::flickableOnPinch()
{
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
window->setSource(testFileUrl("flickableonpinch.qml"));
window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window));
- window->requestActivate();
- QVERIFY(QTest::qWaitForWindowActive(window));
+ QQuickViewTestUtil::centerOnScreen(window.data());
+ QVERIFY(QTest::qWaitForWindowActive(window.data()));
QVERIFY(window->rootObject() != 0);
QQuickPinchArea *pinchArea = window->rootObject()->findChild<QQuickPinchArea*>("pincharea");
@@ -983,23 +947,23 @@ void tst_TouchMouse::flickableOnPinch()
// flickable - single touch point
QCOMPARE(flickable->contentX(), 0.0);
QPoint p = QPoint(100, 100);
- QTest::touchEvent(window, device).press(0, p, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).press(0, p, window.data());
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(rect->position(), QPointF(200.0, 200.0));
p -= QPoint(10, 0);
- QTest::touchEvent(window, device).move(0, p, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).move(0, p, window.data());
+ QQuickTouchUtils::flush(window.data());
p -= QPoint(10, 0);
- QTest::touchEvent(window, device).move(0, p, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).move(0, p, window.data());
+ QQuickTouchUtils::flush(window.data());
QTest::qWait(1000);
p -= QPoint(10, 0);
- QTest::touchEvent(window, device).move(0, p, window);
- QQuickTouchUtils::flush(window);
- QTest::touchEvent(window, device).release(0, p, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).move(0, p, window.data());
+ QQuickTouchUtils::flush(window.data());
+ QTest::touchEvent(window.data(), device).release(0, p, window.data());
+ QQuickTouchUtils::flush(window.data());
QTest::qWait(1000);
@@ -1011,45 +975,47 @@ void tst_TouchMouse::flickableOnPinch()
// pinch
QPoint p1 = QPoint(40, 20);
QPoint p2 = QPoint(60, 20);
- QTest::QTouchEventSequence pinchSequence = QTest::touchEvent(window, device);
- pinchSequence.press(0, p1, window).commit();
- QQuickTouchUtils::flush(window);
+ QTest::QTouchEventSequence pinchSequence = QTest::touchEvent(window.data(), device);
+ pinchSequence.press(0, p1, window.data()).commit();
+ QQuickTouchUtils::flush(window.data());
// In order for the stationary point to remember its previous position,
// we have to reuse the same pinchSequence object. Otherwise if we let it
// be destroyed and then start a new sequence, point 0 will default to being
// stationary at 0, 0, and PinchArea will filter out that touchpoint because
// it is outside its bounds.
- pinchSequence.stationary(0).press(1, p2, window).commit();
- QQuickTouchUtils::flush(window);
+ pinchSequence.stationary(0).press(1, p2, window.data()).commit();
+ QQuickTouchUtils::flush(window.data());
p1 -= QPoint(10,10);
p2 += QPoint(10,10);
- pinchSequence.move(0, p1, window).move(1, p2, window).commit();
- QQuickTouchUtils::flush(window);
+ pinchSequence.move(0, p1, window.data()).move(1, p2, window.data()).commit();
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(rect->scale(), 1.0);
p1 -= QPoint(10, 0);
p2 += QPoint(10, 0);
- pinchSequence.move(0, p1, window).move(1, p2, window).commit();
- QQuickTouchUtils::flush(window);
+ pinchSequence.move(0, p1, window.data()).move(1, p2, window.data()).commit();
+ QQuickTouchUtils::flush(window.data());
p1 -= QPoint(10, 0);
p2 += QPoint(10, 0);
- pinchSequence.move(0, p1, window).move(1, p2, window).commit();
- QQuickTouchUtils::flush(window);
+ pinchSequence.move(0, p1, window.data()).move(1, p2, window.data()).commit();
+ QQuickTouchUtils::flush(window.data());
p1 -= QPoint(10, 0);
p2 += QPoint(10, 0);
- pinchSequence.move(0, p1, window).move(1, p2, window).commit();
- QQuickTouchUtils::flush(window);
- pinchSequence.release(0, p1, window).release(1, p2, window).commit();
- QQuickTouchUtils::flush(window);
+ pinchSequence.move(0, p1, window.data()).move(1, p2, window.data()).commit();
+ QQuickTouchUtils::flush(window.data());
+ pinchSequence.release(0, p1, window.data()).release(1, p2, window.data()).commit();
+ QQuickTouchUtils::flush(window.data());
QVERIFY(rect->scale() > 1.0);
}
void tst_TouchMouse::mouseOnFlickableOnPinch()
{
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
window->setSource(testFileUrl("mouseonflickableonpinch.qml"));
window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window));
+ QQuickViewTestUtil::centerOnScreen(window.data());
+ QVERIFY(QTest::qWaitForWindowActive(window.data()));
QVERIFY(window->rootObject() != 0);
+
QRect windowRect = QRect(window->position(), window->size());
QCursor::setPos(windowRect.center());
@@ -1063,20 +1029,20 @@ void tst_TouchMouse::mouseOnFlickableOnPinch()
// flickable - single touch point
QCOMPARE(flickable->contentX(), 0.0);
QPoint p = QPoint(100, 100);
- QTest::touchEvent(window, device).press(0, p, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).press(0, p, window.data());
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(rect->position(), QPointF(200.0, 200.0));
p -= QPoint(10, 0);
- QTest::touchEvent(window, device).move(0, p, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).move(0, p, window.data());
+ QQuickTouchUtils::flush(window.data());
p -= QPoint(10, 0);
- QTest::touchEvent(window, device).move(0, p, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).move(0, p, window.data());
+ QQuickTouchUtils::flush(window.data());
p -= QPoint(10, 0);
- QTest::touchEvent(window, device).move(0, p, window);
- QQuickTouchUtils::flush(window);
- QTest::touchEvent(window, device).release(0, p, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).move(0, p, window.data());
+ QQuickTouchUtils::flush(window.data());
+ QTest::touchEvent(window.data(), device).release(0, p, window.data());
+ QQuickTouchUtils::flush(window.data());
//QVERIFY(flickable->isMovingHorizontally());
@@ -1087,81 +1053,81 @@ void tst_TouchMouse::mouseOnFlickableOnPinch()
// pinch
QPoint p1 = QPoint(40, 20);
QPoint p2 = QPoint(60, 20);
- QTest::QTouchEventSequence pinchSequence = QTest::touchEvent(window, device);
- pinchSequence.press(0, p1, window).commit();
- QQuickTouchUtils::flush(window);
+ QTest::QTouchEventSequence pinchSequence = QTest::touchEvent(window.data(), device);
+ pinchSequence.press(0, p1, window.data()).commit();
+ QQuickTouchUtils::flush(window.data());
// In order for the stationary point to remember its previous position,
// we have to reuse the same pinchSequence object. Otherwise if we let it
// be destroyed and then start a new sequence, point 0 will default to being
// stationary at 0, 0, and PinchArea will filter out that touchpoint because
// it is outside its bounds.
- pinchSequence.stationary(0).press(1, p2, window).commit();
- QQuickTouchUtils::flush(window);
+ pinchSequence.stationary(0).press(1, p2, window.data()).commit();
+ QQuickTouchUtils::flush(window.data());
p1 -= QPoint(10,10);
p2 += QPoint(10,10);
- pinchSequence.move(0, p1, window).move(1, p2, window).commit();
- QQuickTouchUtils::flush(window);
+ pinchSequence.move(0, p1, window.data()).move(1, p2, window.data()).commit();
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(rect->scale(), 1.0);
p1 -= QPoint(10, 0);
p2 += QPoint(10, 0);
- pinchSequence.move(0, p1, window).move(1, p2, window).commit();
- QQuickTouchUtils::flush(window);
+ pinchSequence.move(0, p1, window.data()).move(1, p2, window.data()).commit();
+ QQuickTouchUtils::flush(window.data());
p1 -= QPoint(10, 0);
p2 += QPoint(10, 0);
- pinchSequence.move(0, p1, window).move(1, p2, window).commit();
- QQuickTouchUtils::flush(window);
+ pinchSequence.move(0, p1, window.data()).move(1, p2, window.data()).commit();
+ QQuickTouchUtils::flush(window.data());
p1 -= QPoint(10, 0);
p2 += QPoint(10, 0);
- pinchSequence.move(0, p1, window).move(1, p2, window).commit();
- QQuickTouchUtils::flush(window);
- pinchSequence.release(0, p1, window).release(1, p2, window).commit();
- QQuickTouchUtils::flush(window);
+ pinchSequence.move(0, p1, window.data()).move(1, p2, window.data()).commit();
+ QQuickTouchUtils::flush(window.data());
+ pinchSequence.release(0, p1, window.data()).release(1, p2, window.data()).commit();
+ QQuickTouchUtils::flush(window.data());
QVERIFY(rect->scale() > 1.0);
// PinchArea should steal the event after flicking started
rect->setScale(1.0);
flickable->setContentX(0.0);
p = QPoint(100, 100);
- pinchSequence.press(0, p, window).commit();
- QQuickTouchUtils::flush(window);
+ pinchSequence.press(0, p, window.data()).commit();
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(rect->position(), QPointF(200.0, 200.0));
p -= QPoint(10, 0);
- pinchSequence.move(0, p, window).commit();
- QQuickTouchUtils::flush(window);
+ pinchSequence.move(0, p, window.data()).commit();
+ QQuickTouchUtils::flush(window.data());
p -= QPoint(10, 0);
- pinchSequence.move(0, p, window).commit();
- QQuickTouchUtils::flush(window);
+ pinchSequence.move(0, p, window.data()).commit();
+ QQuickTouchUtils::flush(window.data());
QGuiApplication::processEvents();
p -= QPoint(10, 0);
- pinchSequence.move(0, p, window).commit();
- QQuickTouchUtils::flush(window);
+ pinchSequence.move(0, p, window.data()).commit();
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(window->mouseGrabberItem(), flickable);
// Add a second finger, this should lead to stealing
p1 = QPoint(40, 100);
p2 = QPoint(60, 100);
- pinchSequence.stationary(0).press(1, p2, window).commit();
- QQuickTouchUtils::flush(window);
+ pinchSequence.stationary(0).press(1, p2, window.data()).commit();
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(rect->scale(), 1.0);
p1 -= QPoint(5, 0);
p2 += QPoint(5, 0);
- pinchSequence.move(0, p1, window).move(1, p2, window).commit();
- QQuickTouchUtils::flush(window);
+ pinchSequence.move(0, p1, window.data()).move(1, p2, window.data()).commit();
+ QQuickTouchUtils::flush(window.data());
p1 -= QPoint(5, 0);
p2 += QPoint(5, 0);
- pinchSequence.move(0, p1, window).move(1, p2, window).commit();
- QQuickTouchUtils::flush(window);
+ pinchSequence.move(0, p1, window.data()).move(1, p2, window.data()).commit();
+ QQuickTouchUtils::flush(window.data());
p1 -= QPoint(5, 0);
p2 += QPoint(5, 0);
- pinchSequence.move(0, p1, window).move(1, p2, window).commit();
- QQuickTouchUtils::flush(window);
- pinchSequence.release(0, p1, window).release(1, p2, window).commit();
- QQuickTouchUtils::flush(window);
+ pinchSequence.move(0, p1, window.data()).move(1, p2, window.data()).commit();
+ QQuickTouchUtils::flush(window.data());
+ pinchSequence.release(0, p1, window.data()).release(1, p2, window.data()).commit();
+ QQuickTouchUtils::flush(window.data());
QVERIFY(rect->scale() > 1.0);
- pinchSequence.release(0, p, window).commit();
- QQuickTouchUtils::flush(window);
+ pinchSequence.release(0, p, window.data()).commit();
+ QQuickTouchUtils::flush(window.data());
}
/*
@@ -1176,13 +1142,11 @@ void tst_TouchMouse::mouseOnFlickableOnPinch()
*/
void tst_TouchMouse::tapOnDismissiveTopMouseAreaClicksBottomOne()
{
- QQuickView *window = createView();
-
+ QScopedPointer<QQuickView> window(createView());
window->setSource(testFileUrl("twoMouseAreas.qml"));
window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window));
- window->requestActivate();
- QVERIFY(QTest::qWaitForWindowActive(window));
+ QQuickViewTestUtil::centerOnScreen(window.data());
+ QVERIFY(QTest::qWaitForWindowActive(window.data()));
QVERIFY(window->rootObject() != 0);
QQuickMouseArea *bottomMouseArea =
@@ -1194,23 +1158,21 @@ void tst_TouchMouse::tapOnDismissiveTopMouseAreaClicksBottomOne()
// tap the front mouse area (see qml file)
QPoint p1(20, 20);
- QTest::touchEvent(window, device).press(0, p1, window);
- QQuickTouchUtils::flush(window);
- QTest::touchEvent(window, device).release(0, p1, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).press(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
+ QTest::touchEvent(window.data(), device).release(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(bottomClickedSpy.count(), 1);
QCOMPARE(bottomDoubleClickedSpy.count(), 0);
- QTest::touchEvent(window, device).press(0, p1, window);
- QQuickTouchUtils::flush(window);
- QTest::touchEvent(window, device).release(0, p1, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).press(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
+ QTest::touchEvent(window.data(), device).release(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(bottomClickedSpy.count(), 1);
QCOMPARE(bottomDoubleClickedSpy.count(), 1);
-
- delete window;
}
/*
@@ -1220,13 +1182,11 @@ void tst_TouchMouse::tapOnDismissiveTopMouseAreaClicksBottomOne()
*/
void tst_TouchMouse::touchGrabCausesMouseUngrab()
{
- QQuickView *window = createView();
-
+ QScopedPointer<QQuickView> window(createView());
window->setSource(testFileUrl("twosiblingitems.qml"));
window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window));
- window->requestActivate();
- QVERIFY(QTest::qWaitForWindowActive(window));
+ QQuickViewTestUtil::centerOnScreen(window.data());
+ QVERIFY(QTest::qWaitForWindowActive(window.data()));
QVERIFY(window->rootObject() != 0);
EventItem *leftItem = window->rootObject()->findChild<EventItem*>("leftItem");
@@ -1242,8 +1202,8 @@ void tst_TouchMouse::touchGrabCausesMouseUngrab()
leftItem->setAcceptedMouseButtons(Qt::LeftButton);
QPoint p1;
p1 = QPoint(leftItem->width() / 2, leftItem->height() / 2);
- QTest::touchEvent(window, device).press(0, p1, window);
- QQuickTouchUtils::flush(window);
+ QTest::touchEvent(window.data(), device).press(0, p1, window.data());
+ QQuickTouchUtils::flush(window.data());
QCOMPARE(leftItem->eventList.size(), 2);
QCOMPARE(leftItem->eventList.at(0).type, QEvent::TouchBegin);
QCOMPARE(leftItem->eventList.at(1).type, QEvent::MouseButtonPress);
@@ -1262,16 +1222,17 @@ void tst_TouchMouse::touchGrabCausesMouseUngrab()
QCOMPARE(leftItem->eventList.size(), 1);
QCOMPARE(leftItem->eventList.at(0).type, QEvent::UngrabMouse);
QCOMPARE(window->mouseGrabberItem(), (QQuickItem*)0);
-
- delete window;
}
void tst_TouchMouse::touchPointDeliveryOrder()
{
// Touch points should be first delivered to the item under the primary finger
QScopedPointer<QQuickView> window(createView());
-
window->setSource(testFileUrl("touchpointdeliveryorder.qml"));
+ window->show();
+ QQuickViewTestUtil::centerOnScreen(window.data());
+ QVERIFY(QTest::qWaitForWindowActive(window.data()));
+
/*
The items are positioned from left to right:
| background |
@@ -1285,8 +1246,6 @@ void tst_TouchMouse::touchPointDeliveryOrder()
QPoint pLeftMiddle = QPoint(200, 100);
QPoint pRightMiddle = QPoint(350, 100);
- window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window.data()));
QVector<QQuickItem*> events;
EventItem *background = window->rootObject()->findChild<EventItem*>("background");
@@ -1371,16 +1330,12 @@ void tst_TouchMouse::hoverEnabled()
// device->setType(QTouchDevice::TouchScreen);
// QWindowSystemInterface::registerTouchDevice(device);
- // Ensure the cursor is away from the window
- QCursor::setPos(0, 0);
-
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
window->setSource(testFileUrl("hoverMouseAreas.qml"));
- window->setPosition(10, 10);
-
+ QQuickViewTestUtil::centerOnScreen(window.data());
+ QQuickViewTestUtil::moveMouseAway(window.data());
window->show();
- window->requestActivate();
- QVERIFY(QTest::qWaitForWindowExposed(window));
+ QVERIFY(QTest::qWaitForWindowActive(window.data()));
QQuickItem *root = window->rootObject();
QVERIFY(root != 0);
@@ -1403,14 +1358,14 @@ void tst_TouchMouse::hoverEnabled()
QPoint p2(150, 250);
// ------------------------- Mouse move to mouseArea1
- QTest::mouseMove(window, p1);
+ QTest::mouseMove(window.data(), p1);
QVERIFY(enterSpy1.count() == 1);
QVERIFY(mouseArea1->hovered());
QVERIFY(!mouseArea2->hovered());
// ------------------------- Touch click on mouseArea1
- QTest::touchEvent(window, device).press(0, p1, window);
+ QTest::touchEvent(window.data(), device).press(0, p1, window.data());
QCOMPARE(enterSpy1.count(), 1);
QCOMPARE(enterSpy2.count(), 0);
@@ -1418,7 +1373,7 @@ void tst_TouchMouse::hoverEnabled()
QVERIFY(mouseArea1->hovered());
QVERIFY(!mouseArea2->hovered());
- QTest::touchEvent(window, device).release(0, p1, window);
+ QTest::touchEvent(window.data(), device).release(0, p1, window.data());
QVERIFY(clickSpy1.count() == 1);
QVERIFY(mouseArea1->hovered());
QVERIFY(!mouseArea2->hovered());
@@ -1427,7 +1382,7 @@ void tst_TouchMouse::hoverEnabled()
if (QGuiApplication::platformName().compare(QLatin1String("xcb"), Qt::CaseInsensitive) == 0)
QSKIP("hover can be momentarily inconsistent on X11, depending on timing of flushFrameSynchronousEvents with touch and mouse movements (QTBUG-55350)");
- QTest::touchEvent(window, device).press(0, p2, window);
+ QTest::touchEvent(window.data(), device).press(0, p2, window.data());
QVERIFY(mouseArea1->hovered());
QVERIFY(mouseArea2->hovered());
@@ -1435,7 +1390,7 @@ void tst_TouchMouse::hoverEnabled()
QCOMPARE(enterSpy1.count(), 1);
QCOMPARE(enterSpy2.count(), 1);
- QTest::touchEvent(window, device).release(0, p2, window);
+ QTest::touchEvent(window.data(), device).release(0, p2, window.data());
QVERIFY(clickSpy2.count() == 1);
QVERIFY(mouseArea1->hovered());
@@ -1444,7 +1399,7 @@ void tst_TouchMouse::hoverEnabled()
QCOMPARE(exitSpy2.count(), 1);
// ------------------------- Another touch click on mouseArea1
- QTest::touchEvent(window, device).press(0, p1, window);
+ QTest::touchEvent(window.data(), device).press(0, p1, window.data());
QCOMPARE(enterSpy1.count(), 1);
QCOMPARE(enterSpy2.count(), 1);
@@ -1452,7 +1407,7 @@ void tst_TouchMouse::hoverEnabled()
QVERIFY(mouseArea1->hovered());
QVERIFY(!mouseArea2->hovered());
- QTest::touchEvent(window, device).release(0, p1, window);
+ QTest::touchEvent(window.data(), device).release(0, p1, window.data());
QCOMPARE(clickSpy1.count(), 2);
QVERIFY(mouseArea1->hovered());
QVERIFY(!mouseArea1->pressed());
diff --git a/tests/manual/text/SignalIndicator.qml b/tests/manual/text/SignalIndicator.qml
new file mode 100644
index 0000000000..3eaadde6d7
--- /dev/null
+++ b/tests/manual/text/SignalIndicator.qml
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the manual tests of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.9
+
+Rectangle {
+ implicitWidth: text.implicitWidth * 1.2
+ implicitHeight: text.implicitHeight * 1.1
+ color: "lightgrey"
+ property color blipColor: "green"
+ property int blipDuration: 30 // ms
+ property alias label: text.text
+
+ function blip() {
+ blipAnim.start()
+ }
+
+ SequentialAnimation on color {
+ id: blipAnim
+ PropertyAction { value: blipColor }
+ PauseAnimation { duration: blipDuration }
+ PropertyAction { value: "lightgrey" }
+ }
+
+ Text {
+ id: text
+ anchors.centerIn: parent
+ }
+}
diff --git a/tests/manual/text/main.cpp b/tests/manual/text/main.cpp
new file mode 100644
index 0000000000..a4e1060cf5
--- /dev/null
+++ b/tests/manual/text/main.cpp
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the manual tests of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QGuiApplication>
+#include <QQmlApplicationEngine>
+
+int main(int argc, char *argv[])
+{
+ QGuiApplication app(argc, argv);
+
+ QQmlApplicationEngine engine;
+ engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
+
+ return app.exec();
+}
diff --git a/tests/manual/text/main.qml b/tests/manual/text/main.qml
new file mode 100644
index 0000000000..d7e214ee38
--- /dev/null
+++ b/tests/manual/text/main.qml
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the manual tests of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.9
+import QtQuick.Window 2.2
+import "qrc:/quick/shared/" as Examples
+
+Window {
+ width: 800
+ height: 600
+ visible: true
+ Examples.LauncherList {
+ id: ll
+ anchors.fill: parent
+ Component.onCompleted: {
+ addExample("TextInput", "TextInput properties and signals", Qt.resolvedUrl("textInputPropertiesAndSignals.qml"))
+ }
+ }
+}
diff --git a/tests/manual/text/qml.qrc b/tests/manual/text/qml.qrc
new file mode 100644
index 0000000000..555e37bd69
--- /dev/null
+++ b/tests/manual/text/qml.qrc
@@ -0,0 +1,7 @@
+<RCC>
+ <qresource prefix="/">
+ <file>main.qml</file>
+ <file>textInputPropertiesAndSignals.qml</file>
+ <file>SignalIndicator.qml</file>
+ </qresource>
+</RCC>
diff --git a/tests/manual/text/text.pro b/tests/manual/text/text.pro
new file mode 100644
index 0000000000..3705d41df0
--- /dev/null
+++ b/tests/manual/text/text.pro
@@ -0,0 +1,7 @@
+TEMPLATE = app
+
+QT += qml quick
+
+SOURCES += main.cpp
+
+RESOURCES += qml.qrc ../../../examples/quick/shared/quick_shared.qrc
diff --git a/tests/manual/text/textInputPropertiesAndSignals.qml b/tests/manual/text/textInputPropertiesAndSignals.qml
new file mode 100644
index 0000000000..a3fd602c16
--- /dev/null
+++ b/tests/manual/text/textInputPropertiesAndSignals.qml
@@ -0,0 +1,134 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the manual tests of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.9
+import QtQuick.Layouts 1.1
+import "qrc:/quick/shared/" as Shared
+
+Item {
+ width: 600; height: 600
+ GridLayout {
+ columns: 3; rowSpacing: 6; columnSpacing: 6
+ anchors { left: parent.left; right: parent.right; top: parent.top; margins: 12 }
+
+ // ----------------------------------------------------
+ Text {
+ text: "try typing and input methods in the TextInput below:"
+ Layout.columnSpan: 3
+ }
+
+ // ----------------------------------------------------
+ Text {
+ text: "TextInput"
+ }
+
+ Rectangle {
+ Layout.fillWidth: true
+ implicitHeight: textInput.implicitHeight + 8
+ radius: 4; antialiasing: true
+ border.color: "black"; color: "transparent"
+
+ TextInput {
+ id: textInput
+ anchors.fill: parent; anchors.margins: 4
+
+ onTextEdited: textEditedInd.blip()
+ onTextChanged: textChangedInd.blip()
+ onPreeditTextChanged: preeditInd.blip()
+ onDisplayTextChanged: displayTextInd.blip()
+ }
+
+ }
+
+ SignalIndicator {
+ id: textEditedInd
+ label: "textEdited"
+ }
+
+ // ----------------------------------------------------
+ Text { text: "text" }
+
+ Text { text: textInput.text; Layout.fillWidth: true }
+
+ SignalIndicator {
+ id: textChangedInd
+ label: "textChanged"
+ }
+
+ // ----------------------------------------------------
+ Text { text: "preeditText" }
+
+ Text { text: textInput.preeditText; Layout.fillWidth: true }
+
+ SignalIndicator {
+ id: preeditInd
+ label: "preeditTextChanged"
+ }
+
+ // ----------------------------------------------------
+ Text { text: "displayText" }
+
+ Text { text: textInput.displayText; Layout.fillWidth: true }
+
+ SignalIndicator {
+ id: displayTextInd
+ label: "displayTextChanged"
+ }
+
+ // ----------------------------------------------------
+ Shared.TextField {
+ id: copyFrom
+ Layout.column: 1
+ Layout.row: 5
+ Layout.fillWidth: true
+ text: "copy this"
+ }
+
+ Shared.Button {
+ Layout.column: 2
+ Layout.row: 5
+ text: "setText"
+ onClicked: {
+ Qt.inputMethod.reset()
+ textInput.text = copyFrom.text
+ }
+ }
+ }
+}
diff --git a/tests/manual/touch/mpta-crosshairs.qml b/tests/manual/touch/mpta-crosshairs.qml
index 8b71e4fdc3..d1dbd0f188 100644
--- a/tests/manual/touch/mpta-crosshairs.qml
+++ b/tests/manual/touch/mpta-crosshairs.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2017 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the manual tests of the Qt Toolkit.
@@ -38,11 +38,13 @@
**
****************************************************************************/
-import QtQuick 2.4
+import QtQuick 2.9
import QtQuick.Window 2.2
Rectangle {
id: root
+ width: 480
+ height: 480
color: "black"
MultiPointTouchArea {
@@ -51,11 +53,11 @@ Rectangle {
touchPoints: [
TouchPoint { property color color: "red" },
TouchPoint { property color color: "orange" },
- TouchPoint { property color color: "yellow" },
+ TouchPoint { property color color: "lightsteelblue" },
TouchPoint { property color color: "green" },
TouchPoint { property color color: "blue" },
TouchPoint { property color color: "violet" },
- TouchPoint { property color color: "cyan" },
+ TouchPoint { property color color: "steelblue" },
TouchPoint { property color color: "magenta" },
TouchPoint { property color color: "goldenrod" },
TouchPoint { property color color: "darkgray" }
@@ -65,40 +67,81 @@ Rectangle {
model: 10
Item {
- anchors.fill: parent
+ id: crosshairs
property TouchPoint touchPoint
+ x: touchPoint.x - width / 2
+ y: touchPoint.y - height / 2
+ width: 300; height: 300
visible: touchPoint.pressed
+ rotation: touchPoint.rotation
Rectangle {
color: touchPoint.color
- anchors.top: parent.top
- anchors.bottom: parent.bottom
- width: 2
- x: touchPoint.x - 1
+ anchors.centerIn: parent
+ width: 2; height: parent.height
+ antialiasing: true
}
Rectangle {
color: touchPoint.color
- anchors.left: parent.left
- anchors.right: parent.right
- height: 2
- y: touchPoint.y - 1
+ anchors.centerIn: parent
+ width: parent.width; height: 2
+ antialiasing: true
}
Rectangle {
color: touchPoint.color
- width: 50 * touchPoint.pressure
- height: width
+ implicitWidth: label.implicitWidth + 8
+ implicitHeight: label.implicitHeight + 16
radius: width / 2
- x: touchPoint.x - width / 2
- y: touchPoint.y - width / 2
+ anchors.centerIn: parent
+ antialiasing: true
+ Rectangle {
+ color: "black"
+ opacity: 0.35
+ width: (parent.width - 8) * touchPoint.pressure
+ height: width
+ radius: width / 2
+ anchors.centerIn: parent
+ antialiasing: true
+ }
+ Rectangle {
+ color: "transparent"
+ border.color: "white"
+ border.width: 2
+ opacity: 0.75
+ visible: width > 0
+ width: touchPoint.ellipseDiameters.width
+ height: touchPoint.ellipseDiameters.height
+ radius: Math.min(width, height) / 2
+ anchors.centerIn: parent
+ antialiasing: true
+ }
+ Text {
+ id: label
+ anchors.centerIn: parent
+ color: "white"
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ property string uid: touchPoint.uniqueId === undefined || touchPoint.uniqueId.numericId === -1 ?
+ "" : "\nUID " + touchPoint.uniqueId.numericId
+ text: "x " + touchPoint.x.toFixed(1) +
+ "\ny " + touchPoint.y.toFixed(1) + uid +
+ "\nID " + touchPoint.pointId.toString(16) +
+ "\n∡" + touchPoint.rotation.toFixed(1) + "°"
+ }
}
Rectangle {
id: velocityVector
visible: width > 0
width: touchPoint.velocity.length()
- height: 1
- x: touchPoint.x
- y: touchPoint.y
- rotation: width > 0 ? Math.acos(touchPoint.velocity.x / width) : 0
+ height: 4
+ Behavior on width { SmoothedAnimation { duration: 200 } }
+ radius: height / 2
+ antialiasing: true
+ color: "gray"
+ x: crosshairs.width / 2
+ y: crosshairs.height / 2
+ rotation: width > 0 ? Math.atan2(touchPoint.velocity.y, touchPoint.velocity.x) * 180 / Math.PI - crosshairs.rotation : 0
+ Behavior on rotation { SmoothedAnimation { duration: 20 } }
transformOrigin: Item.BottomLeft
}
diff --git a/tests/manual/v4/tests.pro b/tests/manual/v4/tests.pro
index a86a6bf6af..ce4a34f7a0 100644
--- a/tests/manual/v4/tests.pro
+++ b/tests/manual/v4/tests.pro
@@ -1,7 +1,7 @@
TEMPLATE = aux
TESTSCRIPT=$$PWD/test262.py
-V4CMD = qmljs
+isEmpty(V4CMD): V4CMD = qmljs
checktarget.target = check
checktarget.commands = python $$TESTSCRIPT --command=$$V4CMD --parallel --with-test-expectations --update-expectations
diff --git a/tests/testapplications/textlayout/styledtext-layout.qml b/tests/testapplications/textlayout/styledtext-layout.qml
index 4ad0c7e279..80f62a6b8f 100644
--- a/tests/testapplications/textlayout/styledtext-layout.qml
+++ b/tests/testapplications/textlayout/styledtext-layout.qml
@@ -88,7 +88,7 @@ Rectangle {
drag.target: rect
acceptedButtons: Qt.LeftButton | Qt.RightButton
onClicked: mouse.button == Qt.RightButton ? myText.font.pixelSize -= 1 : myText.font.pixelSize += 1
- onPositionChanged: myText.doLayout()
+ onPositionChanged: myText.forceLayout()
}
}
}
diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp
index 5e8b872821..e8a506264c 100644
--- a/tools/qml/main.cpp
+++ b/tools/qml/main.cpp
@@ -46,7 +46,6 @@
#include <QDir>
#include <QFile>
#include <QFileInfo>
-#include <QRegularExpression>
#include <QStringList>
#include <QScopedPointer>
#include <QDebug>
@@ -568,29 +567,14 @@ int main(int argc, char *argv[])
loadDummyDataFiles(e, dummyDir);
for (const QString &path : qAsConst(files)) {
- //QUrl::fromUserInput doesn't treat no scheme as relative file paths
-#if QT_CONFIG(regularexpression)
- QRegularExpression urlRe("[[:word:]]+://.*");
- if (urlRe.match(path).hasMatch()) { //Treat as a URL
- QUrl url = QUrl::fromUserInput(path);
- if (verboseMode)
- printf("qml: loading %s\n",
- qPrintable(url.isLocalFile()
- ? QDir::toNativeSeparators(url.toLocalFile())
- : url.toString()));
+ QUrl url = QUrl::fromUserInput(path, QDir::currentPath());
+ if (verboseMode)
+ printf("qml: loading %s\n", qPrintable(url.toString()));
+ QByteArray strippedFile;
+ if (getFileSansBangLine(path, strippedFile))
+ e.loadData(strippedFile, e.baseUrl().resolved(url)); //QQmlComponent won't resolve it for us, it doesn't know it's a valid file if we loadData
+ else //Errors or no bang line
e.load(url);
- } else
-#endif
- { //Local file path
- if (verboseMode)
- printf("qml: loading %s\n", qPrintable(QDir::toNativeSeparators(path)));
-
- QByteArray strippedFile;
- if (getFileSansBangLine(path, strippedFile))
- e.loadData(strippedFile, e.baseUrl().resolved(QUrl::fromLocalFile(path))); //QQmlComponent won't resolve it for us, it doesn't know it's a valid file if we loadData
- else //Errors or no bang line
- e.load(path);
- }
}
if (lw->earlyExit)
diff --git a/tools/qmlimportscanner/main.cpp b/tools/qmlimportscanner/main.cpp
index 84f0d6deb1..ec52491322 100644
--- a/tools/qmlimportscanner/main.cpp
+++ b/tools/qmlimportscanner/main.cpp
@@ -58,6 +58,7 @@ QStringList g_qmlImportPaths;
static inline QString typeLiteral() { return QStringLiteral("type"); }
static inline QString versionLiteral() { return QStringLiteral("version"); }
static inline QString nameLiteral() { return QStringLiteral("name"); }
+static inline QString relativePathLiteral() { return QStringLiteral("relativePath"); }
static inline QString pluginsLiteral() { return QStringLiteral("plugins"); }
static inline QString pathLiteral() { return QStringLiteral("path"); }
static inline QString classnamesLiteral() { return QStringLiteral("classnames"); }
@@ -162,8 +163,9 @@ QVariantMap pluginsForModulePath(const QString &modulePath) {
return pluginInfo;
}
-// Search for a given qml import in g_qmlImportPaths.
-QString resolveImportPath(const QString &uri, const QString &version)
+// Search for a given qml import in g_qmlImportPaths and return a pair
+// of absolute / relative paths (for deployment).
+QPair<QString, QString> resolveImportPath(const QString &uri, const QString &version)
{
const QLatin1Char dot('.');
const QLatin1Char slash('/');
@@ -180,18 +182,21 @@ QString resolveImportPath(const QString &uri, const QString &version)
// - qml/QtQml.2/Models
// - qml/QtQml/Models
if (ver.isEmpty()) {
- const QString candidatePath = QDir::cleanPath(qmlImportPath + slash + parts.join(slash));
+ QString relativePath = parts.join(slash);
+ if (relativePath.endsWith(slash))
+ relativePath.chop(1);
+ const QString candidatePath = QDir::cleanPath(qmlImportPath + slash + relativePath);
if (QDir(candidatePath).exists())
- return candidatePath; // import found
+ return qMakePair(candidatePath, relativePath); // import found
} else {
for (int index = parts.count() - 1; index >= 0; --index) {
- const QString candidatePath = QDir::cleanPath(qmlImportPath + slash
- + parts.mid(0, index + 1).join(slash)
- + dot + ver + slash
- + parts.mid(index + 1).join(slash));
-
+ QString relativePath = parts.mid(0, index + 1).join(slash)
+ + dot + ver + slash + parts.mid(index + 1).join(slash);
+ if (relativePath.endsWith(slash))
+ relativePath.chop(1);
+ const QString candidatePath = QDir::cleanPath(qmlImportPath + slash + relativePath);
if (QDir(candidatePath).exists())
- return candidatePath; // import found
+ return qMakePair(candidatePath, relativePath); // import found
}
}
}
@@ -207,7 +212,7 @@ QString resolveImportPath(const QString &uri, const QString &version)
ver = ver.mid(0, lastDot);
}
- return QString(); // not found
+ return QPair<QString, QString>(); // not found
}
// Find absolute file system paths and plugins for a list of modules.
@@ -219,9 +224,12 @@ QVariantList findPathsForModuleImports(const QVariantList &imports)
for (int i = 0; i < importsCopy.length(); ++i) {
QVariantMap import = qvariant_cast<QVariantMap>(importsCopy.at(i));
if (import.value(typeLiteral()) == QLatin1String("module")) {
- QString path = resolveImportPath(import.value(nameLiteral()).toString(), import.value(versionLiteral()).toString());
- if (!path.isEmpty())
- import[pathLiteral()] = path;
+ const QPair<QString, QString> paths =
+ resolveImportPath(import.value(nameLiteral()).toString(), import.value(versionLiteral()).toString());
+ if (!paths.first.isEmpty()) {
+ import.insert(pathLiteral(), paths.first);
+ import.insert(relativePathLiteral(), paths.second);
+ }
QVariantMap plugininfo = pluginsForModulePath(import.value(pathLiteral()).toString());
QString plugins = plugininfo.value(pluginsLiteral()).toString();
QString classnames = plugininfo.value(classnamesLiteral()).toString();
diff --git a/tools/qmlplugindump/main.cpp b/tools/qmlplugindump/main.cpp
index 92a8465d9f..774be45aec 100644
--- a/tools/qmlplugindump/main.cpp
+++ b/tools/qmlplugindump/main.cpp
@@ -741,7 +741,7 @@ void sigSegvHandler(int) {
void printUsage(const QString &appName)
{
std::cerr << qPrintable(QString(
- "Usage: %1 [-v] [-noinstantiate] [-defaultplatform] [-[non]relocatable] [-dependencies <dependencies.json>] [-merge <file-to-merge.qmltypes>] [-noforceqtquick] module.uri version [module/import/path]\n"
+ "Usage: %1 [-v] [-noinstantiate] [-defaultplatform] [-[non]relocatable] [-dependencies <dependencies.json>] [-merge <file-to-merge.qmltypes>] [-output <output-file.qmltypes>] [-noforceqtquick] module.uri version [module/import/path]\n"
" %1 [-v] [-noinstantiate] -path path/to/qmldir/directory [version]\n"
" %1 [-v] -builtins\n"
"Example: %1 Qt.labs.folderlistmodel 2.0 /home/user/dev/qt-install/imports").arg(
@@ -998,6 +998,7 @@ int main(int argc, char *argv[])
return EXIT_INVALIDARGUMENTS;
}
+ QString outputFilename;
QString pluginImportUri;
QString pluginImportVersion;
bool relocatable = true;
@@ -1051,6 +1052,13 @@ int main(int argc, char *argv[])
} else if (arg == QLatin1String("--noforceqtquick")
|| arg == QLatin1String("-noforceqtquick")){
forceQtQuickDependency = false;
+ } else if (arg == QLatin1String("--output")
+ || arg == QLatin1String("-output")) {
+ if (++iArg == args.size()) {
+ std::cerr << "missing output file" << std::endl;
+ return EXIT_INVALIDARGUMENTS;
+ }
+ outputFilename = args.at(iArg);
} else if (arg == QLatin1String("--defaultplatform")
|| arg == QLatin1String("-defaultplatform")) {
continue;
@@ -1306,7 +1314,15 @@ int main(int argc, char *argv[])
qml.writeEndObject();
qml.writeEndDocument();
- std::cout << bytes.constData() << std::flush;
+ if (!outputFilename.isEmpty()) {
+ QFile file(outputFilename);
+ if (file.open(QIODevice::WriteOnly)) {
+ QTextStream stream(&file);
+ stream << bytes.constData();
+ }
+ } else {
+ std::cout << bytes.constData() << std::flush;
+ }
// workaround to avoid crashes on exit
QTimer timer;
diff --git a/tools/qmltime/qmltime.cpp b/tools/qmltime/qmltime.cpp
index 4c282dd8f4..b337ccac5c 100644
--- a/tools/qmltime/qmltime.cpp
+++ b/tools/qmltime/qmltime.cpp
@@ -222,7 +222,7 @@ int main(int argc, char ** argv)
QByteArray its(argv[ii]);
bool ok = false;
iterations = its.toUInt(&ok);
- if (!ok)
+ if (!ok || iterations == 0)
usage(argv[0]);
} else {
usage(argv[0]);