aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/3rdparty/masm/runtime/MatchResult.h2
-rw-r--r--src/qml/compiler/qv4bytecodegenerator.cpp1
-rw-r--r--src/qml/compiler/qv4codegen.cpp72
-rw-r--r--src/qml/compiler/qv4codegen_p.h20
-rw-r--r--src/quick/doc/src/concepts/modelviewsdata/cppmodels.qdoc76
-rw-r--r--src/quick/doc/src/concepts/modelviewsdata/modelview.qdoc32
-rw-r--r--src/quick/doc/src/includes/item.qdocinc9
-rw-r--r--src/quick/items/qquickitem.cpp53
-rw-r--r--src/quick/items/qquickitem_p.h1
-rw-r--r--src/quick/items/qquickwindow.cpp73
-rw-r--r--src/quick/util/qquickanimatorjob.cpp6
-rw-r--r--tests/auto/quick/qquickgridview/data/mirroring.qml9
-rw-r--r--tests/auto/quick/qquickgridview/data/unrequestedItems.qml3
-rw-r--r--tests/auto/quick/qquicklistview/data/itemlist-flicker.qml11
-rw-r--r--tests/auto/quick/qquicklistview/data/itemlist.qml11
-rw-r--r--tests/auto/quick/qquicklistview/data/listview-sections-package.qml3
-rw-r--r--tests/auto/quick/qquicklistview/data/listviewtest-package.qml3
-rw-r--r--tests/auto/quick/qquicklistview/data/repositionResizedDelegate.qml3
-rw-r--r--tests/auto/quick/qquicklistview/data/rightToLeft.qml9
-rw-r--r--tests/auto/quick/qquicklistview/data/unrequestedItems.qml3
-rw-r--r--tests/auto/quick/qquicklistview/tst_qquicklistview.cpp6
-rw-r--r--tests/auto/quick/qquickpathview/data/panels.qml3
-rw-r--r--tests/auto/quick/qquickpathview/data/pathview_package.qml3
-rw-r--r--tests/auto/quick/qquickpathview/data/treemodel.qml3
-rw-r--r--tests/auto/quick/qquickpathview/data/vdm.qml3
-rw-r--r--tests/auto/quick/qquickrepeater/data/itemlist.qml17
-rw-r--r--tests/auto/quick/qquickrepeater/data/visualitemmodel.qml3
-rw-r--r--tests/auto/quick/qquickvisualdatamodel/data/create.qml3
-rw-r--r--tests/auto/quick/qquickvisualdatamodel/data/datalist-package.qml3
-rw-r--r--tests/auto/quick/qquickvisualdatamodel/data/datalist.qml3
-rw-r--r--tests/auto/quick/qquickvisualdatamodel/data/groups-invalid.qml11
-rw-r--r--tests/auto/quick/qquickvisualdatamodel/data/groups-package.qml27
-rw-r--r--tests/auto/quick/qquickvisualdatamodel/data/groups.qml27
-rw-r--r--tests/auto/quick/qquickvisualdatamodel/data/invalidAttachment.qml7
-rw-r--r--tests/auto/quick/qquickvisualdatamodel/data/itemsDestroyed_package.qml3
-rw-r--r--tests/auto/quick/qquickvisualdatamodel/data/listmodelproperties-package.qml7
-rw-r--r--tests/auto/quick/qquickvisualdatamodel/data/listmodelproperties.qml7
-rw-r--r--tests/auto/quick/qquickvisualdatamodel/data/multipleroleproperties-package.qml7
-rw-r--r--tests/auto/quick/qquickvisualdatamodel/data/multipleroleproperties.qml7
-rw-r--r--tests/auto/quick/qquickvisualdatamodel/data/objectlistproperties-package.qml7
-rw-r--r--tests/auto/quick/qquickvisualdatamodel/data/objectlistproperties.qml7
-rw-r--r--tests/auto/quick/qquickvisualdatamodel/data/onChanged.qml7
-rw-r--r--tests/auto/quick/qquickvisualdatamodel/data/packageView.qml3
-rw-r--r--tests/auto/quick/qquickvisualdatamodel/data/singleroleproperties-package.qml7
-rw-r--r--tests/auto/quick/qquickvisualdatamodel/data/singleroleproperties.qml7
-rw-r--r--tests/auto/quick/qquickvisualdatamodel/data/stringlistproperties-package.qml7
-rw-r--r--tests/auto/quick/qquickvisualdatamodel/data/stringlistproperties.qml7
-rw-r--r--tests/auto/quick/qquickvisualdatamodel/data/visualdatamodel.qml3
-rw-r--r--tests/auto/quick/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp242
-rw-r--r--tests/auto/quick/touchmouse/tst_touchmouse.cpp104
-rw-r--r--tests/testapplications/elements/content/RepeaterElement.qml5
-rw-r--r--tests/testapplications/text/text.qml5
-rw-r--r--tests/testapplications/text/textedit.qml5
-rw-r--r--tests/testapplications/text/textinput.qml5
-rw-r--r--tools/qmlcachegen/qtquickcompiler.prf1
55 files changed, 545 insertions, 427 deletions
diff --git a/src/3rdparty/masm/runtime/MatchResult.h b/src/3rdparty/masm/runtime/MatchResult.h
index d87c8516b0..b7aaa6b6fc 100644
--- a/src/3rdparty/masm/runtime/MatchResult.h
+++ b/src/3rdparty/masm/runtime/MatchResult.h
@@ -35,6 +35,7 @@ struct MatchResult {
{
}
+#if !CPU(X86_64) && !CPU(ARM64)
explicit ALWAYS_INLINE MatchResult(EncodedMatchResult encoded)
{
union u {
@@ -48,6 +49,7 @@ struct MatchResult {
start = value.split.start;
end = value.split.end;
}
+#endif
ALWAYS_INLINE static MatchResult failed()
{
diff --git a/src/qml/compiler/qv4bytecodegenerator.cpp b/src/qml/compiler/qv4bytecodegenerator.cpp
index 8ecb762f9c..d0bca69b56 100644
--- a/src/qml/compiler/qv4bytecodegenerator.cpp
+++ b/src/qml/compiler/qv4bytecodegenerator.cpp
@@ -40,7 +40,6 @@
#include <private/qv4bytecodegenerator_p.h>
#include <private/qv4compilercontext_p.h>
#include <private/qqmljsastfwd_p.h>
-#include <private/qv4compileddata_p.h>
QT_USE_NAMESPACE
using namespace QV4;
diff --git a/src/qml/compiler/qv4codegen.cpp b/src/qml/compiler/qv4codegen.cpp
index 4af3c99df8..321cf21c54 100644
--- a/src/qml/compiler/qv4codegen.cpp
+++ b/src/qml/compiler/qv4codegen.cpp
@@ -42,10 +42,6 @@
#include <QtCore/QCoreApplication>
#include <QtCore/QStringList>
-#include <QtCore/QSet>
-#include <QtCore/QBuffer>
-#include <QtCore/QBitArray>
-#include <QtCore/QLinkedList>
#include <QtCore/QStack>
#include <QScopeGuard>
#include <private/qqmljsast_p.h>
@@ -56,6 +52,10 @@
#include <private/qv4bytecodegenerator_p.h>
#include <private/qv4compilerscanfunctions_p.h>
+#ifndef V4_BOOTSTRAP
+# include <qqmlerror.h>
+#endif
+
#include <cmath>
#include <iostream>
@@ -3965,70 +3965,6 @@ void Codegen::RValue::loadInAccumulator() const
}
-Codegen::Reference::Reference(const Codegen::Reference &other)
-{
- *this = other;
-}
-
-Codegen::Reference &Codegen::Reference::operator =(const Reference &other)
-{
- type = other.type;
-
- switch (type) {
- case Invalid:
- case Accumulator:
- break;
- case Super:
- break;
- case SuperProperty:
- property = other.property;
- break;
- case StackSlot:
- theStackSlot = other.theStackSlot;
- break;
- case ScopedLocal:
- index = other.index;
- scope = other.scope;
- break;
- case Name:
- // name is always copied
- break;
- case Member:
- propertyBase = other.propertyBase;
- propertyNameIndex = other.propertyNameIndex;
- break;
- case Subscript:
- elementBase = other.elementBase;
- elementSubscript = other.elementSubscript;
- break;
- case Import:
- index = other.index;
- break;
- case Const:
- constant = other.constant;
- break;
- case QmlScopeObject:
- case QmlContextObject:
- qmlBase = other.qmlBase;
- qmlCoreIndex = other.qmlCoreIndex;
- qmlNotifyIndex = other.qmlNotifyIndex;
- capturePolicy = other.capturePolicy;
- break;
- }
-
- // keep loaded reference
- isArgOrEval = other.isArgOrEval;
- codegen = other.codegen;
- isReadonly = other.isReadonly;
- isReferenceToConst = other.isReferenceToConst;
- name = other.name;
- requiresTDZCheck = other.requiresTDZCheck;
- stackSlotIsLocalOrArgument = other.stackSlotIsLocalOrArgument;
- isVolatile = other.isVolatile;
- global = other.global;
- return *this;
-}
-
bool Codegen::Reference::operator==(const Codegen::Reference &other) const
{
if (type != other.type)
diff --git a/src/qml/compiler/qv4codegen_p.h b/src/qml/compiler/qv4codegen_p.h
index aaf8baef34..49607256f9 100644
--- a/src/qml/compiler/qv4codegen_p.h
+++ b/src/qml/compiler/qv4codegen_p.h
@@ -53,17 +53,8 @@
#include "private/qv4global_p.h"
#include <private/qqmljsastvisitor_p.h>
#include <private/qqmljsast_p.h>
-#include <private/qqmljsengine_p.h>
-#include <private/qv4instr_moth_p.h>
#include <private/qv4compiler_p.h>
#include <private/qv4compilercontext_p.h>
-#include <private/qqmlrefcount_p.h>
-#include <QtCore/QStringList>
-#include <QtCore/QDateTime>
-#include <QStack>
-#ifndef V4_BOOTSTRAP
-#include <qqmlerror.h>
-#endif
#include <private/qv4util_p.h>
#include <private/qv4bytecodegenerator_p.h>
#include <private/qv4stackframe_p.h>
@@ -203,9 +194,10 @@ public:
Reference(Codegen *cg, Type type = Invalid) : type(type), codegen(cg) {}
Reference() {}
- Reference(const Reference &other);
-
- Reference &operator =(const Reference &other);
+ Reference(const Reference &) = default;
+ Reference(Reference &&) = default;
+ Reference &operator =(const Reference &) = default;
+ Reference &operator =(Reference &&) = default;
bool operator==(const Reference &other) const;
bool operator!=(const Reference &other) const
@@ -214,6 +206,10 @@ public:
bool isValid() const { return type != Invalid; }
bool loadTriggersSideEffect() const {
switch (type) {
+ case QmlScopeObject:
+ return capturePolicy != DontCapture;
+ case QmlContextObject:
+ return capturePolicy != DontCapture;
case Name:
case Member:
case Subscript:
diff --git a/src/quick/doc/src/concepts/modelviewsdata/cppmodels.qdoc b/src/quick/doc/src/concepts/modelviewsdata/cppmodels.qdoc
index e8265b92d2..a849a30b4e 100644
--- a/src/quick/doc/src/concepts/modelviewsdata/cppmodels.qdoc
+++ b/src/quick/doc/src/concepts/modelviewsdata/cppmodels.qdoc
@@ -233,34 +233,10 @@ contact details from an SQLite database.
\section3 Editable Data Model
-Besides the \c roleNames() and \c data(), the editable models must reimplement
-the \l{QSqlTableModel::}{setData} method to save changes to existing SQL data.
-The following version of the method checks if the given model index is valid
-and the \c role is equal to \l Qt::EditRole, before calling the parent class
-version:
-
-\code
-bool SqlEditableModel::setData(const QModelIndex &item, const QVariant &value, int role)
-{
- if (item.isValid() && role == Qt::EditRole) {
- QSqlTableModel::setData(item, value,role);
- emit dataChanged(item, item);
- return true;
- }
- return false;
+QSqlTableModel implements setData() as described \l{#changing-model-data}{below}.
-}
-\endcode
-
-\note It is important to emit the \l{QAbstractItemModel::}{dataChanged}()
-signal after saving the changes.
-
-Unlike the C++ item views such as QListView or QTableView, the \c setData()
-method must be explicitly invoked from QML whenever appropriate. For example,
-on the \l[QML]{TextField::}{editingFinished}() or \l[QML]{TextField::}{accepted}()
-signal of \l[QtQuickControls]{TextField}. Depending on the
-\l{QSqlTableModel::}{EditStrategy} used by the model, the changes are either
-queued for submission later or submitted immediately.
+Depending on the \l{QSqlTableModel::}{EditStrategy} used by the model, the
+changes are either queued for submission later or submitted immediately.
You can also insert new data into the model by calling
\l {QSqlTableModel::insertRecord}(). In the following example snippet,
@@ -327,5 +303,51 @@ ListView {
See \l {Writing QML Extensions with C++} for details on writing QML C++
plugins.
+\section2 Changing Model Data
+
+Besides the \c roleNames() and \c data(), editable models must reimplement
+the \l{QAbstractItemModel::}{setData} method to save changes to existing model data.
+The following version of the method checks if the given model index is valid
+and the \c role is equal to \l Qt::EditRole:
+
+\code
+bool EditableModel::setData(const QModelIndex &index, const QVariant &value, int role)
+{
+ if (index.isValid() && role == Qt::EditRole) {
+ // Set data in model here. It can also be a good idea to check whether
+ // the new value actually differs from the current value
+ if (m_entries[index.row()] != value.toString()) {
+ m_entries[index.row()] = value.toString();
+ emit dataChanged(index, index, { Qt::EditRole, Qt::DisplayRole });
+ return true;
+ }
+ }
+ return false;
+}
+\endcode
+
+\note It is important to emit the \l{QAbstractItemModel::}{dataChanged}()
+signal after saving the changes.
+
+Unlike the C++ item views such as QListView or QTableView, the \c setData()
+method must be explicitly invoked from QML delegates whenever appropriate. This is done
+by simply assigning a new value to the corresponding model property. For example,
+on the \l[QML]{TextField::}{editingFinished}() or \l[QML]{TextField::}{accepted}()
+signal of \l[QtQuickControls]{TextField}.
+
+\qml
+ListView {
+ anchors.fill: parent
+ model: EditableModel {}
+ delegate: TextField {
+ width: ListView.view.width
+ text: model.edit
+ onAccepted: model.edit = text
+ }
+}
+\endqml
+
+\note The \c edit role is equal to \l Qt::EditRole. See \l{QAbstractItemModel::}{roleNames}()
+for the built-in role names. However, real life models would usually register custom roles.
*/
diff --git a/src/quick/doc/src/concepts/modelviewsdata/modelview.qdoc b/src/quick/doc/src/concepts/modelviewsdata/modelview.qdoc
index 89b7929755..0c6aaecf42 100644
--- a/src/quick/doc/src/concepts/modelviewsdata/modelview.qdoc
+++ b/src/quick/doc/src/concepts/modelviewsdata/modelview.qdoc
@@ -46,7 +46,8 @@ types for creating models.
display the data in a list or a grid.
\li \b Delegate - dictates how the data should appear in the view.
The delegate takes each data in the model and encapsulates it. The data is
-accessible through the delegate.
+accessible through the delegate. The delegate can also write data
+back into editable models (e.g. in a TextField's onAccepted Handler).
\endlist
To visualize data, bind the view's \c model property to a model and the
@@ -390,6 +391,35 @@ If the model is a string list, the delegate is also exposed to a read-only
It is also possible to use a delegate as the template for the items created
by a Repeater. This is specified using the \l{Repeater::}{delegate} property.
+\section1 Changing Model Data
+
+To change model data, you can assign updated values to the \c model properties.
+The QML ListModel is editable by default whereas C++ models must implement
+setData() to become editable. Integer and JavaScript array models are read-only.
+
+Supposed a \l{QAbstractItemModel} based C++ model that implements the
+\l{QAbstractItemModel::}{setData} method is registered as a QML type named
+\c EditableModel. Data could then be written to the model like this:
+
+\qml
+ListView {
+ anchors.fill: parent
+ model: EditableModel {}
+ delegate: TextEdit {
+ width: ListView.view.width
+ height: 30
+ text: model.edit
+ Keys.onReturnPressed: model.edit = text
+ }
+}
+\endqml
+
+\note The \c edit role is equal to \l Qt::EditRole. See \l{QAbstractItemModel::}{roleNames}()
+for the built-in role names. However, real life models would usually register custom roles.
+
+For more information, visit the \l{qtquick-modelviewsdata-cppmodels.html#changing-model-data}{Using C++ Models with Qt Quick Views}
+article.
+
\section1 Using Transitions
Transitions can be used to animate items that are added to, moved within,
diff --git a/src/quick/doc/src/includes/item.qdocinc b/src/quick/doc/src/includes/item.qdocinc
index 12472cb928..4cb2652bbf 100644
--- a/src/quick/doc/src/includes/item.qdocinc
+++ b/src/quick/doc/src/includes/item.qdocinc
@@ -4,3 +4,12 @@ The following properties of the item are used in the mapping:
\l x, \l y, \l scale, \l rotation, \l transformOrigin, and \l [QML]{Item::}{transform}.
//! [mapping]
+
+
+//! [accepting-events]
+
+The event is accepted by default, so it is not necessary to explicitly
+accept the event if you reimplement this function. If you don't accept the
+event, call \c event->ignore().
+
+//! [accepting-events]
diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp
index f7e7a1b773..eba3842c10 100644
--- a/src/quick/items/qquickitem.cpp
+++ b/src/quick/items/qquickitem.cpp
@@ -3919,6 +3919,16 @@ void QQuickItemPrivate::addItemChangeListener(QQuickItemChangeListener *listener
changeListeners.append(ChangeListener(listener, types));
}
+void QQuickItemPrivate::updateOrAddItemChangeListener(QQuickItemChangeListener *listener, ChangeTypes types)
+{
+ const ChangeListener changeListener(listener, types);
+ const int index = changeListeners.indexOf(changeListener);
+ if (index > -1)
+ changeListeners[index].types = changeListener.types;
+ else
+ changeListeners.append(changeListener);
+}
+
void QQuickItemPrivate::removeItemChangeListener(QQuickItemChangeListener *listener, ChangeTypes types)
{
ChangeListener change(listener, types);
@@ -3953,6 +3963,8 @@ void QQuickItemPrivate::updateOrRemoveGeometryChangeListener(QQuickItemChangeLis
This event handler can be reimplemented in a subclass to receive key
press events for an item. The event information is provided by the
\a event parameter.
+
+ \input item.qdocinc accepting-events
*/
void QQuickItem::keyPressEvent(QKeyEvent *event)
{
@@ -3963,6 +3975,8 @@ void QQuickItem::keyPressEvent(QKeyEvent *event)
This event handler can be reimplemented in a subclass to receive key
release events for an item. The event information is provided by the
\a event parameter.
+
+ \input item.qdocinc accepting-events
*/
void QQuickItem::keyReleaseEvent(QKeyEvent *event)
{
@@ -3974,6 +3988,8 @@ void QQuickItem::keyReleaseEvent(QKeyEvent *event)
This event handler can be reimplemented in a subclass to receive input
method events for an item. The event information is provided by the
\a event parameter.
+
+ \input item.qdocinc accepting-events
*/
void QQuickItem::inputMethodEvent(QInputMethodEvent *event)
{
@@ -3985,6 +4001,11 @@ void QQuickItem::inputMethodEvent(QInputMethodEvent *event)
This event handler can be reimplemented in a subclass to receive focus-in
events for an item. The event information is provided by the \c event
parameter.
+
+ \input item.qdocinc accepting-events
+
+ If you do reimplement this function, you should call the base class
+ implementation.
*/
void QQuickItem::focusInEvent(QFocusEvent * /*event*/)
{
@@ -4002,6 +4023,8 @@ void QQuickItem::focusInEvent(QFocusEvent * /*event*/)
This event handler can be reimplemented in a subclass to receive focus-out
events for an item. The event information is provided by the \c event
parameter.
+
+ \input item.qdocinc accepting-events
*/
void QQuickItem::focusOutEvent(QFocusEvent * /*event*/)
{
@@ -4011,6 +4034,8 @@ void QQuickItem::focusOutEvent(QFocusEvent * /*event*/)
This event handler can be reimplemented in a subclass to receive mouse
press events for an item. The event information is provided by the
\a event parameter.
+
+ \input item.qdocinc accepting-events
*/
void QQuickItem::mousePressEvent(QMouseEvent *event)
{
@@ -4021,6 +4046,8 @@ void QQuickItem::mousePressEvent(QMouseEvent *event)
This event handler can be reimplemented in a subclass to receive mouse
move events for an item. The event information is provided by the
\a event parameter.
+
+ \input item.qdocinc accepting-events
*/
void QQuickItem::mouseMoveEvent(QMouseEvent *event)
{
@@ -4031,6 +4058,8 @@ void QQuickItem::mouseMoveEvent(QMouseEvent *event)
This event handler can be reimplemented in a subclass to receive mouse
release events for an item. The event information is provided by the
\a event parameter.
+
+ \input item.qdocinc accepting-events
*/
void QQuickItem::mouseReleaseEvent(QMouseEvent *event)
{
@@ -4041,6 +4070,8 @@ void QQuickItem::mouseReleaseEvent(QMouseEvent *event)
This event handler can be reimplemented in a subclass to receive mouse
double-click events for an item. The event information is provided by the
\a event parameter.
+
+ \input item.qdocinc accepting-events
*/
void QQuickItem::mouseDoubleClickEvent(QMouseEvent *)
{
@@ -4050,7 +4081,7 @@ void QQuickItem::mouseDoubleClickEvent(QMouseEvent *)
This event handler can be reimplemented in a subclass to be notified
when a mouse ungrab event has occurred on this item.
- \sa ungrabMouse()
+ \input item.qdocinc accepting-events
*/
void QQuickItem::mouseUngrabEvent()
{
@@ -4060,6 +4091,8 @@ void QQuickItem::mouseUngrabEvent()
/*!
This event handler can be reimplemented in a subclass to be notified
when a touch ungrab event has occurred on this item.
+
+ \input item.qdocinc accepting-events
*/
void QQuickItem::touchUngrabEvent()
{
@@ -4071,6 +4104,8 @@ void QQuickItem::touchUngrabEvent()
This event handler can be reimplemented in a subclass to receive
wheel events for an item. The event information is provided by the
\a event parameter.
+
+ \input item.qdocinc accepting-events
*/
void QQuickItem::wheelEvent(QWheelEvent *event)
{
@@ -4082,6 +4117,8 @@ void QQuickItem::wheelEvent(QWheelEvent *event)
This event handler can be reimplemented in a subclass to receive touch
events for an item. The event information is provided by the
\a event parameter.
+
+ \input item.qdocinc accepting-events
*/
void QQuickItem::touchEvent(QTouchEvent *event)
{
@@ -4094,6 +4131,8 @@ void QQuickItem::touchEvent(QTouchEvent *event)
\a event parameter.
Hover events are only provided if acceptHoverEvents() is true.
+
+ \input item.qdocinc accepting-events
*/
void QQuickItem::hoverEnterEvent(QHoverEvent *event)
{
@@ -4106,6 +4145,8 @@ void QQuickItem::hoverEnterEvent(QHoverEvent *event)
\a event parameter.
Hover events are only provided if acceptHoverEvents() is true.
+
+ \input item.qdocinc accepting-events
*/
void QQuickItem::hoverMoveEvent(QHoverEvent *event)
{
@@ -4118,6 +4159,8 @@ void QQuickItem::hoverMoveEvent(QHoverEvent *event)
\a event parameter.
Hover events are only provided if acceptHoverEvents() is true.
+
+ \input item.qdocinc accepting-events
*/
void QQuickItem::hoverLeaveEvent(QHoverEvent *event)
{
@@ -4133,6 +4176,8 @@ void QQuickItem::hoverLeaveEvent(QHoverEvent *event)
Drag and drop events are only provided if the ItemAcceptsDrops flag
has been set for this item.
+ \input item.qdocinc accepting-events
+
\sa Drag, {Drag and Drop}
*/
void QQuickItem::dragEnterEvent(QDragEnterEvent *event)
@@ -4148,6 +4193,8 @@ void QQuickItem::dragEnterEvent(QDragEnterEvent *event)
Drag and drop events are only provided if the ItemAcceptsDrops flag
has been set for this item.
+ \input item.qdocinc accepting-events
+
\sa Drag, {Drag and Drop}
*/
void QQuickItem::dragMoveEvent(QDragMoveEvent *event)
@@ -4163,6 +4210,8 @@ void QQuickItem::dragMoveEvent(QDragMoveEvent *event)
Drag and drop events are only provided if the ItemAcceptsDrops flag
has been set for this item.
+ \input item.qdocinc accepting-events
+
\sa Drag, {Drag and Drop}
*/
void QQuickItem::dragLeaveEvent(QDragLeaveEvent *event)
@@ -4178,6 +4227,8 @@ void QQuickItem::dragLeaveEvent(QDragLeaveEvent *event)
Drag and drop events are only provided if the ItemAcceptsDrops flag
has been set for this item.
+ \input item.qdocinc accepting-events
+
\sa Drag, {Drag and Drop}
*/
void QQuickItem::dropEvent(QDropEvent *event)
diff --git a/src/quick/items/qquickitem_p.h b/src/quick/items/qquickitem_p.h
index 24941ab264..11b47114cf 100644
--- a/src/quick/items/qquickitem_p.h
+++ b/src/quick/items/qquickitem_p.h
@@ -415,6 +415,7 @@ public:
QVector<QQuickItemPrivate::ChangeListener> changeListeners;
void addItemChangeListener(QQuickItemChangeListener *listener, ChangeTypes types);
+ void updateOrAddItemChangeListener(QQuickItemChangeListener *listener, ChangeTypes types);
void removeItemChangeListener(QQuickItemChangeListener *, ChangeTypes types);
void updateOrAddGeometryChangeListener(QQuickItemChangeListener *listener, QQuickGeometryChange types);
void updateOrRemoveGeometryChangeListener(QQuickItemChangeListener *listener, QQuickGeometryChange types);
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp
index 8caa568a6c..059886f41c 100644
--- a/src/quick/items/qquickwindow.cpp
+++ b/src/quick/items/qquickwindow.cpp
@@ -1738,48 +1738,49 @@ void QQuickWindowPrivate::deliverToPassiveGrabbers(const QVector<QPointer <QQuic
void QQuickWindowPrivate::deliverMouseEvent(QQuickPointerMouseEvent *pointerEvent)
{
+ Q_Q(QQuickWindow);
auto point = pointerEvent->point(0);
lastMousePosition = point->scenePosition();
const bool mouseIsReleased = (point->state() == QQuickEventPoint::Released && pointerEvent->buttons() == Qt::NoButton);
+ QQuickItem *grabberItem = point->grabberItem();
+ if (!grabberItem && isDeliveringTouchAsMouse())
+ grabberItem = q->mouseGrabberItem();
- if (point->exclusiveGrabber()) {
- if (auto grabber = point->grabberItem()) {
- bool handled = false;
- hasFiltered.clear();
- if (sendFilteredPointerEvent(pointerEvent, grabber))
- handled = true;
- // if the grabber is an Item:
- // if the update consists of changing button state, don't accept it unless
- // the button is one in which the grabber is interested
- Qt::MouseButtons acceptedButtons = grabber->acceptedMouseButtons();
- if (!handled && pointerEvent->button() != Qt::NoButton && acceptedButtons
- && !(acceptedButtons & pointerEvent->button())) {
- pointerEvent->setAccepted(false);
- handled = true;
- }
-
- // send update
- if (!handled) {
- QPointF localPos = grabber->mapFromScene(lastMousePosition);
- auto me = pointerEvent->asMouseEvent(localPos);
- me->accept();
- QCoreApplication::sendEvent(grabber, me);
- point->setAccepted(me->isAccepted());
- }
+ if (grabberItem) {
+ bool handled = false;
+ hasFiltered.clear();
+ if (sendFilteredPointerEvent(pointerEvent, grabberItem))
+ handled = true;
+ // if the grabber is an Item:
+ // if the update consists of changing button state, don't accept it unless
+ // the button is one in which the grabber is interested
+ Qt::MouseButtons acceptedButtons = grabberItem->acceptedMouseButtons();
+ if (!handled && pointerEvent->button() != Qt::NoButton && acceptedButtons
+ && !(acceptedButtons & pointerEvent->button())) {
+ pointerEvent->setAccepted(false);
+ handled = true;
+ }
- // release event: ungrab if no buttons are pressed anymore
- if (mouseIsReleased)
- removeGrabber(grabber, true, isDeliveringTouchAsMouse());
- } else {
- // if the grabber is not an Item, it must be a PointerHandler
- auto handler = point->grabberPointerHandler();
- pointerEvent->localize(handler->parentItem());
- hasFiltered.clear();
- if (!sendFilteredPointerEvent(pointerEvent, handler->parentItem()))
- handler->handlePointerEvent(pointerEvent);
- if (mouseIsReleased)
- point->setGrabberPointerHandler(nullptr, true);
+ // send update
+ if (!handled) {
+ QPointF localPos = grabberItem->mapFromScene(lastMousePosition);
+ auto me = pointerEvent->asMouseEvent(localPos);
+ me->accept();
+ QCoreApplication::sendEvent(grabberItem, me);
+ point->setAccepted(me->isAccepted());
}
+
+ // release event: ungrab if no buttons are pressed anymore
+ if (mouseIsReleased)
+ removeGrabber(grabberItem, true, isDeliveringTouchAsMouse());
+ deliverToPassiveGrabbers(point->passiveGrabbers(), pointerEvent);
+ } else if (auto handler = point->grabberPointerHandler()) {
+ pointerEvent->localize(handler->parentItem());
+ hasFiltered.clear();
+ if (!sendFilteredPointerEvent(pointerEvent, handler->parentItem()))
+ handler->handlePointerEvent(pointerEvent);
+ if (mouseIsReleased)
+ point->setGrabberPointerHandler(nullptr, true);
deliverToPassiveGrabbers(point->passiveGrabbers(), pointerEvent);
} else {
bool delivered = false;
diff --git a/src/quick/util/qquickanimatorjob.cpp b/src/quick/util/qquickanimatorjob.cpp
index 6574f8f67e..03be78ab15 100644
--- a/src/quick/util/qquickanimatorjob.cpp
+++ b/src/quick/util/qquickanimatorjob.cpp
@@ -217,8 +217,10 @@ void QQuickAnimatorProxyJob::setWindow(QQuickWindow *window)
void QQuickAnimatorProxyJob::sceneGraphInitialized()
{
- disconnect(m_controller->window(), &QQuickWindow::sceneGraphInitialized, this, &QQuickAnimatorProxyJob::sceneGraphInitialized);
- readyToAnimate();
+ if (m_controller) {
+ disconnect(m_controller->window(), &QQuickWindow::sceneGraphInitialized, this, &QQuickAnimatorProxyJob::sceneGraphInitialized);
+ readyToAnimate();
+ }
}
void QQuickAnimatorProxyJob::readyToAnimate()
diff --git a/tests/auto/quick/qquickgridview/data/mirroring.qml b/tests/auto/quick/qquickgridview/data/mirroring.qml
index b9aff501c1..b99f50b854 100644
--- a/tests/auto/quick/qquickgridview/data/mirroring.qml
+++ b/tests/auto/quick/qquickgridview/data/mirroring.qml
@@ -2,29 +2,30 @@
// changes in right-to-left layout direction
import QtQuick 2.0
+import QtQml.Models 2.12
Rectangle {
color: "lightgray"
width: 340
height: 370
- VisualItemModel {
+ ObjectModel {
id: itemModel
objectName: "itemModel"
Rectangle {
objectName: "item1"
height: 110; width: 120; color: "#FFFEF0"
- Text { objectName: "text1"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
+ Text { objectName: "text1"; text: "index: " + parent.ObjectModel.index; font.bold: true; anchors.centerIn: parent }
}
Rectangle {
objectName: "item2"
height: 130; width: 150; color: "#F0FFF7"
- Text { objectName: "text2"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
+ Text { objectName: "text2"; text: "index: " + parent.ObjectModel.index; font.bold: true; anchors.centerIn: parent }
}
Rectangle {
objectName: "item3"
height: 170; width: 190; color: "#F4F0FF"
- Text { objectName: "text3"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
+ Text { objectName: "text3"; text: "index: " + parent.ObjectModel.index; font.bold: true; anchors.centerIn: parent }
}
}
diff --git a/tests/auto/quick/qquickgridview/data/unrequestedItems.qml b/tests/auto/quick/qquickgridview/data/unrequestedItems.qml
index bedb90b849..4afe5ac8b3 100644
--- a/tests/auto/quick/qquickgridview/data/unrequestedItems.qml
+++ b/tests/auto/quick/qquickgridview/data/unrequestedItems.qml
@@ -1,4 +1,5 @@
import QtQuick 2.0
+import QtQml.Models 2.12
Item {
width: 240
@@ -38,7 +39,7 @@ Item {
}
- VisualDataModel {
+ DelegateModel {
id: visualModel
delegate: myDelegate
diff --git a/tests/auto/quick/qquicklistview/data/itemlist-flicker.qml b/tests/auto/quick/qquicklistview/data/itemlist-flicker.qml
index c0cc807bc0..89daadaaa5 100644
--- a/tests/auto/quick/qquicklistview/data/itemlist-flicker.qml
+++ b/tests/auto/quick/qquicklistview/data/itemlist-flicker.qml
@@ -1,33 +1,34 @@
// This example demonstrates placing items in a view using
-// a VisualItemModel
+// an ObjectModel
import QtQuick 2.0
+import QtQml.Models 2.12
Rectangle {
color: "lightgray"
width: 240
height: 320
- VisualItemModel {
+ ObjectModel {
id: itemModel
objectName: "itemModel"
Rectangle {
objectName: "item1"
height: view.height / 3
width: view.width; color: "#FFFEF0"
- Text { objectName: "text1"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
+ Text { objectName: "text1"; text: "index: " + parent.ObjectModel.index; font.bold: true; anchors.centerIn: parent }
}
Rectangle {
objectName: "item2"
height: view.height / 3
width: view.width; color: "#F0FFF7"
- Text { objectName: "text2"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
+ Text { objectName: "text2"; text: "index: " + parent.ObjectModel.index; font.bold: true; anchors.centerIn: parent }
}
Rectangle {
objectName: "item3"
height: view.height / 3
width: view.width; color: "#F4F0FF"
- Text { objectName: "text3"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
+ Text { objectName: "text3"; text: "index: " + parent.ObjectModel.index; font.bold: true; anchors.centerIn: parent }
}
}
diff --git a/tests/auto/quick/qquicklistview/data/itemlist.qml b/tests/auto/quick/qquicklistview/data/itemlist.qml
index 5c7ecdd5e8..00910ae60c 100644
--- a/tests/auto/quick/qquicklistview/data/itemlist.qml
+++ b/tests/auto/quick/qquicklistview/data/itemlist.qml
@@ -1,33 +1,34 @@
// This example demonstrates placing items in a view using
-// a VisualItemModel
+// an ObjectModel
import QtQuick 2.0
+import QtQml.Models 2.12
Rectangle {
color: "lightgray"
width: 240
height: 320
- VisualItemModel {
+ ObjectModel {
id: itemModel
objectName: "itemModel"
Rectangle {
objectName: "item1"
height: ListView.view ? ListView.view.height : 0
width: view.width; color: "#FFFEF0"
- Text { objectName: "text1"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
+ Text { objectName: "text1"; text: "index: " + parent.ObjectModel.index; font.bold: true; anchors.centerIn: parent }
}
Rectangle {
objectName: "item2"
height: ListView.view ? ListView.view.height : 0
width: view.width; color: "#F0FFF7"
- Text { objectName: "text2"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
+ Text { objectName: "text2"; text: "index: " + parent.ObjectModel.index; font.bold: true; anchors.centerIn: parent }
}
Rectangle {
objectName: "item3"
height: ListView.view ? ListView.view.height : 0
width: view.width; color: "#F4F0FF"
- Text { objectName: "text3"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
+ Text { objectName: "text3"; text: "index: " + parent.ObjectModel.index; font.bold: true; anchors.centerIn: parent }
}
}
diff --git a/tests/auto/quick/qquicklistview/data/listview-sections-package.qml b/tests/auto/quick/qquicklistview/data/listview-sections-package.qml
index 8bad73b5f6..4297ab1c69 100644
--- a/tests/auto/quick/qquicklistview/data/listview-sections-package.qml
+++ b/tests/auto/quick/qquicklistview/data/listview-sections-package.qml
@@ -1,4 +1,5 @@
import QtQuick 2.0
+import QtQml.Models 2.12
Rectangle {
width: 240
@@ -54,7 +55,7 @@ Rectangle {
}
}
},
- VisualDataModel {
+ DelegateModel {
id: visualModel
model: testModel
delegate: myDelegate
diff --git a/tests/auto/quick/qquicklistview/data/listviewtest-package.qml b/tests/auto/quick/qquicklistview/data/listviewtest-package.qml
index 452fe29b49..c26bbece03 100644
--- a/tests/auto/quick/qquicklistview/data/listviewtest-package.qml
+++ b/tests/auto/quick/qquicklistview/data/listviewtest-package.qml
@@ -1,4 +1,5 @@
import QtQuick 2.0
+import QtQml.Models 2.12
Rectangle {
id: root
@@ -120,7 +121,7 @@ Rectangle {
id: headerFooter
Rectangle { height: 30; width: 240; color: "blue" }
},
- VisualDataModel {
+ DelegateModel {
id: visualModel
model: testModel
diff --git a/tests/auto/quick/qquicklistview/data/repositionResizedDelegate.qml b/tests/auto/quick/qquicklistview/data/repositionResizedDelegate.qml
index d79ca100f4..fa16a8529e 100644
--- a/tests/auto/quick/qquicklistview/data/repositionResizedDelegate.qml
+++ b/tests/auto/quick/qquicklistview/data/repositionResizedDelegate.qml
@@ -1,4 +1,5 @@
import QtQuick 2.0
+import QtQml.Models 2.12
ListView {
id: root
@@ -9,7 +10,7 @@ ListView {
layoutDirection: (testRightToLeft == true) ? Qt.RightToLeft : Qt.LeftToRight
verticalLayoutDirection: (testBottomToTop == true) ? ListView.BottomToTop : ListView.TopToBottom
- model: VisualItemModel {
+ model: ObjectModel {
Rectangle {
objectName: "red"
width: 200; height: 200; color: "red"
diff --git a/tests/auto/quick/qquicklistview/data/rightToLeft.qml b/tests/auto/quick/qquicklistview/data/rightToLeft.qml
index 6d77de26f4..dec7e0abc1 100644
--- a/tests/auto/quick/qquicklistview/data/rightToLeft.qml
+++ b/tests/auto/quick/qquicklistview/data/rightToLeft.qml
@@ -2,29 +2,30 @@
// changes in right-to-left layout direction
import QtQuick 2.0
+import QtQml.Models 2.12
Rectangle {
color: "lightgray"
width: 640
height: 320
- VisualItemModel {
+ ObjectModel {
id: itemModel
objectName: "itemModel"
Rectangle {
objectName: "item1"
height: view.height; width: 100; color: "#FFFEF0"
- Text { objectName: "text1"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
+ Text { objectName: "text1"; text: "index: " + parent.ObjectModel.index; font.bold: true; anchors.centerIn: parent }
}
Rectangle {
objectName: "item2"
height: view.height; width: 200; color: "#F0FFF7"
- Text { objectName: "text2"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
+ Text { objectName: "text2"; text: "index: " + parent.ObjectModel.index; font.bold: true; anchors.centerIn: parent }
}
Rectangle {
objectName: "item3"
height: view.height; width: 240; color: "#F4F0FF"
- Text { objectName: "text3"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
+ Text { objectName: "text3"; text: "index: " + parent.ObjectModel.index; font.bold: true; anchors.centerIn: parent }
}
}
diff --git a/tests/auto/quick/qquicklistview/data/unrequestedItems.qml b/tests/auto/quick/qquicklistview/data/unrequestedItems.qml
index e3719a8be0..e6cb856c1e 100644
--- a/tests/auto/quick/qquicklistview/data/unrequestedItems.qml
+++ b/tests/auto/quick/qquicklistview/data/unrequestedItems.qml
@@ -1,4 +1,5 @@
import QtQuick 2.0
+import QtQml.Models 2.12
Item {
width: 240
@@ -34,7 +35,7 @@ Item {
}
- VisualDataModel {
+ DelegateModel {
id: visualModel
delegate: myDelegate
diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
index a9be9d4fa4..2574eb9c6c 100644
--- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
+++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2018 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
@@ -465,7 +465,7 @@ void tst_QQuickListView::items(const QUrl &source)
T model2;
ctxt->setContextProperty("testModel", &model2);
- // Force a layout, necessary if ListView is completed before VisualDataModel.
+ // Force a layout, necessary if ListView is completed before DelegateModel.
listview->forceLayout();
int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count();
@@ -504,7 +504,7 @@ void tst_QQuickListView::changed(const QUrl &source)
QQuickItem *contentItem = listview->contentItem();
QTRY_VERIFY(contentItem != nullptr);
- // Force a layout, necessary if ListView is completed before VisualDataModel.
+ // Force a layout, necessary if ListView is completed before DelegateModel.
listview->forceLayout();
model.modifyItem(1, "Will", "9876");
diff --git a/tests/auto/quick/qquickpathview/data/panels.qml b/tests/auto/quick/qquickpathview/data/panels.qml
index a111e45736..08e4636dca 100644
--- a/tests/auto/quick/qquickpathview/data/panels.qml
+++ b/tests/auto/quick/qquickpathview/data/panels.qml
@@ -1,4 +1,5 @@
import QtQuick 2.0
+import QtQml.Models 2.12
Item {
id: root
@@ -6,7 +7,7 @@ Item {
property bool enforceRange: false
width: 320; height: 480
- VisualItemModel {
+ ObjectModel {
id: itemModel
Rectangle {
diff --git a/tests/auto/quick/qquickpathview/data/pathview_package.qml b/tests/auto/quick/qquickpathview/data/pathview_package.qml
index 2af57e6bb1..34d4ee73ba 100644
--- a/tests/auto/quick/qquickpathview/data/pathview_package.qml
+++ b/tests/auto/quick/qquickpathview/data/pathview_package.qml
@@ -1,4 +1,5 @@
import QtQuick 2.0
+import QtQml.Models 2.12
Item {
width: 800; height: 600
@@ -37,7 +38,7 @@ Item {
ListElement { lColor: "brown" }
ListElement { lColor: "thistle" }
}
- VisualDataModel { id: visualModel; model: rssModel; delegate: photoDelegate }
+ DelegateModel { id: visualModel; model: rssModel; delegate: photoDelegate }
PathView {
id: photoPathView
diff --git a/tests/auto/quick/qquickpathview/data/treemodel.qml b/tests/auto/quick/qquickpathview/data/treemodel.qml
index fcf6922d00..b1e06f47d2 100644
--- a/tests/auto/quick/qquickpathview/data/treemodel.qml
+++ b/tests/auto/quick/qquickpathview/data/treemodel.qml
@@ -1,4 +1,5 @@
import QtQuick 2.0
+import QtQml.Models 2.12
PathView {
width: 320
@@ -6,7 +7,7 @@ PathView {
function setRoot(index) {
vdm.rootIndex = vdm.modelIndex(index);
}
- model: VisualDataModel {
+ model: DelegateModel {
id: vdm
model: myModel
delegate: Text { objectName: "wrapper"; text: display }
diff --git a/tests/auto/quick/qquickpathview/data/vdm.qml b/tests/auto/quick/qquickpathview/data/vdm.qml
index 839393d9bd..f24837b7a6 100644
--- a/tests/auto/quick/qquickpathview/data/vdm.qml
+++ b/tests/auto/quick/qquickpathview/data/vdm.qml
@@ -1,4 +1,5 @@
import QtQuick 2.0
+import QtQml.Models 2.12
PathView {
id: pathView
@@ -20,7 +21,7 @@ PathView {
ListElement { value: "three" }
}
- model: VisualDataModel {
+ model: DelegateModel {
delegate: Text { text: model.value }
model : mo
}
diff --git a/tests/auto/quick/qquickrepeater/data/itemlist.qml b/tests/auto/quick/qquickrepeater/data/itemlist.qml
index 174bfd4d18..12470f9fd9 100644
--- a/tests/auto/quick/qquickrepeater/data/itemlist.qml
+++ b/tests/auto/quick/qquickrepeater/data/itemlist.qml
@@ -1,7 +1,8 @@
// This example demonstrates placing items in a view using
-// a VisualItemModel
+// an ObjectModel
import QtQuick 2.0
+import QtQml.Models 2.12
Rectangle {
id: root
@@ -22,38 +23,38 @@ Rectangle {
root.itemModel = itemModel2
}
- VisualItemModel {
+ ObjectModel {
id: itemModel1
objectName: "itemModel1"
Rectangle {
objectName: "item1"
height: 50; width: 100; color: "#FFFEF0"
- Text { objectName: "text1"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
+ Text { objectName: "text1"; text: "index: " + parent.ObjectModel.index; font.bold: true; anchors.centerIn: parent }
}
Rectangle {
objectName: "item2"
height: 50; width: 100; color: "#F0FFF7"
- Text { objectName: "text2"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
+ Text { objectName: "text2"; text: "index: " + parent.ObjectModel.index; font.bold: true; anchors.centerIn: parent }
}
Rectangle {
objectName: "item3"
height: 50; width: 100; color: "#F4F0FF"
- Text { objectName: "text3"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
+ Text { objectName: "text3"; text: "index: " + parent.ObjectModel.index; font.bold: true; anchors.centerIn: parent }
}
}
- VisualItemModel {
+ ObjectModel {
id: itemModel2
objectName: "itemModel2"
Rectangle {
objectName: "item4"
height: 50; width: 100; color: "#FFFEF0"
- Text { objectName: "text4"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
+ Text { objectName: "text4"; text: "index: " + parent.ObjectModel.index; font.bold: true; anchors.centerIn: parent }
}
Rectangle {
objectName: "item5"
height: 50; width: 100; color: "#F0FFF7"
- Text { objectName: "text5"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
+ Text { objectName: "text5"; text: "index: " + parent.ObjectModel.index; font.bold: true; anchors.centerIn: parent }
}
}
diff --git a/tests/auto/quick/qquickrepeater/data/visualitemmodel.qml b/tests/auto/quick/qquickrepeater/data/visualitemmodel.qml
index b1b7b97881..0fb930449a 100644
--- a/tests/auto/quick/qquickrepeater/data/visualitemmodel.qml
+++ b/tests/auto/quick/qquickrepeater/data/visualitemmodel.qml
@@ -1,10 +1,11 @@
import QtQuick 2.0
+import QtQml.Models 2.12
Rectangle {
width: 360
height: 360
- VisualItemModel {
+ ObjectModel {
id: visItemModel
Rectangle {
width: 20
diff --git a/tests/auto/quick/qquickvisualdatamodel/data/create.qml b/tests/auto/quick/qquickvisualdatamodel/data/create.qml
index 9f4b754552..ba63bc778d 100644
--- a/tests/auto/quick/qquickvisualdatamodel/data/create.qml
+++ b/tests/auto/quick/qquickvisualdatamodel/data/create.qml
@@ -1,4 +1,5 @@
import QtQuick 2.0
+import QtQml.Models 2.12
ListView {
width: 200
@@ -6,7 +7,7 @@ ListView {
property var persistentHandle
- model: VisualDataModel {
+ model: DelegateModel {
id: visualModel
persistedItems.includeByDefault: true
diff --git a/tests/auto/quick/qquickvisualdatamodel/data/datalist-package.qml b/tests/auto/quick/qquickvisualdatamodel/data/datalist-package.qml
index ae3bd81d91..3fc33755d3 100644
--- a/tests/auto/quick/qquickvisualdatamodel/data/datalist-package.qml
+++ b/tests/auto/quick/qquickvisualdatamodel/data/datalist-package.qml
@@ -1,10 +1,11 @@
import QtQuick 2.0
+import QtQml.Models 2.12
ListView {
width: 100
height: 100
model: visualModel.parts.package
- VisualDataModel {
+ DelegateModel {
id: visualModel
objectName: "visualModel"
model: myModel
diff --git a/tests/auto/quick/qquickvisualdatamodel/data/datalist.qml b/tests/auto/quick/qquickvisualdatamodel/data/datalist.qml
index 8ce59caddc..074f5ad26f 100644
--- a/tests/auto/quick/qquickvisualdatamodel/data/datalist.qml
+++ b/tests/auto/quick/qquickvisualdatamodel/data/datalist.qml
@@ -1,9 +1,10 @@
import QtQuick 2.0
+import QtQml.Models 2.12
ListView {
width: 100
height: 100
- model: VisualDataModel {
+ model: DelegateModel {
id: visualModel
objectName: "visualModel"
model: myModel
diff --git a/tests/auto/quick/qquickvisualdatamodel/data/groups-invalid.qml b/tests/auto/quick/qquickvisualdatamodel/data/groups-invalid.qml
index 70c6f9f995..c40abc1112 100644
--- a/tests/auto/quick/qquickvisualdatamodel/data/groups-invalid.qml
+++ b/tests/auto/quick/qquickvisualdatamodel/data/groups-invalid.qml
@@ -1,14 +1,15 @@
import QtQuick 2.0
+import QtQml.Models 2.12
-VisualDataModel {
+DelegateModel {
id: visualModel
objectName: "visualModel"
groups: [
- VisualDataGroup { id: visibleItems; objectName: "visibleItems"; name: "visible"; includeByDefault: true },
- VisualDataGroup { id: selectedItems; objectName: "selectedItems"; name: "selected" },
- VisualDataGroup { id: unnamed; objectName: "unnamed" },
- VisualDataGroup { id: capitalised; objectName: "capitalised"; name: "Capitalised" }
+ DelegateModelGroup { id: visibleItems; objectName: "visibleItems"; name: "visible"; includeByDefault: true },
+ DelegateModelGroup { id: selectedItems; objectName: "selectedItems"; name: "selected" },
+ DelegateModelGroup { id: unnamed; objectName: "unnamed" },
+ DelegateModelGroup { id: capitalised; objectName: "capitalised"; name: "Capitalised" }
]
}
diff --git a/tests/auto/quick/qquickvisualdatamodel/data/groups-package.qml b/tests/auto/quick/qquickvisualdatamodel/data/groups-package.qml
index ea5ad5d3bd..ada472e376 100644
--- a/tests/auto/quick/qquickvisualdatamodel/data/groups-package.qml
+++ b/tests/auto/quick/qquickvisualdatamodel/data/groups-package.qml
@@ -1,4 +1,5 @@
import QtQuick 2.0
+import QtQml.Models 2.12
ListView {
width: 100
@@ -12,14 +13,14 @@ ListView {
}
model: visualModel.parts.package
- VisualDataModel {
+ DelegateModel {
id: visualModel
objectName: "visualModel"
groups: [
- VisualDataGroup { id: visibleItems; objectName: "visibleItems"; name: "visible"; includeByDefault: true },
- VisualDataGroup { id: selectedItems; objectName: "selectedItems"; name: "selected" }
+ DelegateModelGroup { id: visibleItems; objectName: "visibleItems"; name: "visible"; includeByDefault: true },
+ DelegateModelGroup { id: selectedItems; objectName: "selectedItems"; name: "selected" }
]
model: myModel
@@ -28,16 +29,16 @@ ListView {
property variant test1: name
property variant test2: index
- property variant test3: VisualDataModel.itemsIndex
- property variant test4: VisualDataModel.inItems
- property variant test5: VisualDataModel.visibleIndex
- property variant test6: VisualDataModel.inVisible
- property variant test7: VisualDataModel.selectedIndex
- property variant test8: VisualDataModel.inSelected
- property variant test9: VisualDataModel.groups
-
- function hide() { VisualDataModel.inVisible = false }
- function select() { VisualDataModel.inSelected = true }
+ property variant test3: DelegateModel.itemsIndex
+ property variant test4: DelegateModel.inItems
+ property variant test5: DelegateModel.visibleIndex
+ property variant test6: DelegateModel.inVisible
+ property variant test7: DelegateModel.selectedIndex
+ property variant test8: DelegateModel.inSelected
+ property variant test9: DelegateModel.groups
+
+ function hide() { DelegateModel.inVisible = false }
+ function select() { DelegateModel.inSelected = true }
Item {
Package.name: "package"
diff --git a/tests/auto/quick/qquickvisualdatamodel/data/groups.qml b/tests/auto/quick/qquickvisualdatamodel/data/groups.qml
index 7502dd2502..ba9b5e5e1f 100644
--- a/tests/auto/quick/qquickvisualdatamodel/data/groups.qml
+++ b/tests/auto/quick/qquickvisualdatamodel/data/groups.qml
@@ -1,4 +1,5 @@
import QtQuick 2.0
+import QtQml.Models 2.12
ListView {
width: 100
@@ -12,14 +13,14 @@ ListView {
}
model: visualModel
- VisualDataModel {
+ DelegateModel {
id: visualModel
objectName: "visualModel"
groups: [
- VisualDataGroup { id: visibleItems; objectName: "visibleItems"; name: "visible"; includeByDefault: true },
- VisualDataGroup { id: selectedItems; objectName: "selectedItems"; name: "selected" }
+ DelegateModelGroup { id: visibleItems; objectName: "visibleItems"; name: "visible"; includeByDefault: true },
+ DelegateModelGroup { id: selectedItems; objectName: "selectedItems"; name: "selected" }
]
model: myModel
@@ -31,16 +32,16 @@ ListView {
height: 2
property variant test1: name
property variant test2: index
- property variant test3: VisualDataModel.itemsIndex
- property variant test4: VisualDataModel.inItems
- property variant test5: VisualDataModel.visibleIndex
- property variant test6: VisualDataModel.inVisible
- property variant test7: VisualDataModel.selectedIndex
- property variant test8: VisualDataModel.inSelected
- property variant test9: VisualDataModel.groups
-
- function hide() { VisualDataModel.inVisible = false }
- function select() { VisualDataModel.inSelected = true }
+ property variant test3: DelegateModel.itemsIndex
+ property variant test4: DelegateModel.inItems
+ property variant test5: DelegateModel.visibleIndex
+ property variant test6: DelegateModel.inVisible
+ property variant test7: DelegateModel.selectedIndex
+ property variant test8: DelegateModel.inSelected
+ property variant test9: DelegateModel.groups
+
+ function hide() { DelegateModel.inVisible = false }
+ function select() { DelegateModel.inSelected = true }
}
}
}
diff --git a/tests/auto/quick/qquickvisualdatamodel/data/invalidAttachment.qml b/tests/auto/quick/qquickvisualdatamodel/data/invalidAttachment.qml
index 2758f56d0f..adc52a7281 100644
--- a/tests/auto/quick/qquickvisualdatamodel/data/invalidAttachment.qml
+++ b/tests/auto/quick/qquickvisualdatamodel/data/invalidAttachment.qml
@@ -1,15 +1,16 @@
import QtQuick 2.0
+import QtQml.Models 2.12
Item {
- property VisualDataModel invalidVdm: VisualDataModel.model
+ property DelegateModel invalidVdm: DelegateModel.model
Repeater {
model: 1
delegate: Item {
id: outer
objectName: "delegate"
- property VisualDataModel validVdm: outer.VisualDataModel.model
- property VisualDataModel invalidVdm: inner.VisualDataModel.model
+ property DelegateModel validVdm: outer.DelegateModel.model
+ property DelegateModel invalidVdm: inner.DelegateModel.model
Item {
id: inner
diff --git a/tests/auto/quick/qquickvisualdatamodel/data/itemsDestroyed_package.qml b/tests/auto/quick/qquickvisualdatamodel/data/itemsDestroyed_package.qml
index b47f22dc34..3c61991fcb 100644
--- a/tests/auto/quick/qquickvisualdatamodel/data/itemsDestroyed_package.qml
+++ b/tests/auto/quick/qquickvisualdatamodel/data/itemsDestroyed_package.qml
@@ -1,4 +1,5 @@
import QtQuick 2.0
+import QtQml.Models 2.12
Item {
width: 100
@@ -9,7 +10,7 @@ Item {
model: visualModel.parts.list
}
- VisualDataModel {
+ DelegateModel {
id: visualModel
model: myModel
diff --git a/tests/auto/quick/qquickvisualdatamodel/data/listmodelproperties-package.qml b/tests/auto/quick/qquickvisualdatamodel/data/listmodelproperties-package.qml
index b6b56727e8..827d6a609e 100644
--- a/tests/auto/quick/qquickvisualdatamodel/data/listmodelproperties-package.qml
+++ b/tests/auto/quick/qquickvisualdatamodel/data/listmodelproperties-package.qml
@@ -1,17 +1,18 @@
import QtQuick 2.0
+import QtQml.Models 2.12
ListView {
width: 100
height: 100
model: visualModel.parts.package
- VisualDataModel {
+ DelegateModel {
id: visualModel
objectName: "visualModel"
groups: [
- VisualDataGroup { id: visibleItems; objectName: "visibleItems"; name: "visible"; includeByDefault: true },
- VisualDataGroup { id: selectedItems; objectName: "selectedItems"; name: "selected" }
+ DelegateModelGroup { id: visibleItems; objectName: "visibleItems"; name: "visible"; includeByDefault: true },
+ DelegateModelGroup { id: selectedItems; objectName: "selectedItems"; name: "selected" }
]
model: ListModel {
diff --git a/tests/auto/quick/qquickvisualdatamodel/data/listmodelproperties.qml b/tests/auto/quick/qquickvisualdatamodel/data/listmodelproperties.qml
index d2dfc37e07..1c3e07ba4f 100644
--- a/tests/auto/quick/qquickvisualdatamodel/data/listmodelproperties.qml
+++ b/tests/auto/quick/qquickvisualdatamodel/data/listmodelproperties.qml
@@ -1,15 +1,16 @@
import QtQuick 2.0
+import QtQml.Models 2.12
ListView {
width: 100
height: 100
- model: VisualDataModel {
+ model: DelegateModel {
id: visualModel
objectName: "visualModel"
groups: [
- VisualDataGroup { id: visibleItems; objectName: "visibleItems"; name: "visible"; includeByDefault: true },
- VisualDataGroup { id: selectedItems; objectName: "selectedItems"; name: "selected" }
+ DelegateModelGroup { id: visibleItems; objectName: "visibleItems"; name: "visible"; includeByDefault: true },
+ DelegateModelGroup { id: selectedItems; objectName: "selectedItems"; name: "selected" }
]
model: ListModel {
diff --git a/tests/auto/quick/qquickvisualdatamodel/data/multipleroleproperties-package.qml b/tests/auto/quick/qquickvisualdatamodel/data/multipleroleproperties-package.qml
index 964ac426f8..32a7e8571e 100644
--- a/tests/auto/quick/qquickvisualdatamodel/data/multipleroleproperties-package.qml
+++ b/tests/auto/quick/qquickvisualdatamodel/data/multipleroleproperties-package.qml
@@ -1,17 +1,18 @@
import QtQuick 2.0
+import QtQml.Models 2.12
import tst_qquickvisualdatamodel 1.0
ListView {
width: 100
height: 100
model: visualModel.parts.package
- VisualDataModel {
+ DelegateModel {
id: visualModel
objectName: "visualModel"
groups: [
- VisualDataGroup { id: visibleItems; objectName: "visibleItems"; name: "visible"; includeByDefault: true },
- VisualDataGroup { id: selectedItems; objectName: "selectedItems"; name: "selected" }
+ DelegateModelGroup { id: visibleItems; objectName: "visibleItems"; name: "visible"; includeByDefault: true },
+ DelegateModelGroup { id: selectedItems; objectName: "selectedItems"; name: "selected" }
]
model: StandardItemModel {
diff --git a/tests/auto/quick/qquickvisualdatamodel/data/multipleroleproperties.qml b/tests/auto/quick/qquickvisualdatamodel/data/multipleroleproperties.qml
index 77e30b69b9..436aff3da9 100644
--- a/tests/auto/quick/qquickvisualdatamodel/data/multipleroleproperties.qml
+++ b/tests/auto/quick/qquickvisualdatamodel/data/multipleroleproperties.qml
@@ -1,16 +1,17 @@
import QtQuick 2.0
+import QtQml.Models 2.12
import tst_qquickvisualdatamodel 1.0
ListView {
width: 100
height: 100
- model: VisualDataModel {
+ model: DelegateModel {
id: visualModel
objectName: "visualModel"
groups: [
- VisualDataGroup { id: visibleItems; objectName: "visibleItems"; name: "visible"; includeByDefault: true },
- VisualDataGroup { id: selectedItems; objectName: "selectedItems"; name: "selected" }
+ DelegateModelGroup { id: visibleItems; objectName: "visibleItems"; name: "visible"; includeByDefault: true },
+ DelegateModelGroup { id: selectedItems; objectName: "selectedItems"; name: "selected" }
]
model: StandardItemModel {
diff --git a/tests/auto/quick/qquickvisualdatamodel/data/objectlistproperties-package.qml b/tests/auto/quick/qquickvisualdatamodel/data/objectlistproperties-package.qml
index c69e54c2f8..9b5198068f 100644
--- a/tests/auto/quick/qquickvisualdatamodel/data/objectlistproperties-package.qml
+++ b/tests/auto/quick/qquickvisualdatamodel/data/objectlistproperties-package.qml
@@ -1,4 +1,5 @@
import QtQuick 2.0
+import QtQml.Models 2.12
import tst_qquickvisualdatamodel 1.0
ListView {
@@ -6,7 +7,7 @@ ListView {
height: 100
model: visualModel.parts.package
- VisualDataModel {
+ DelegateModel {
id: visualModel
objectName: "visualModel"
@@ -18,8 +19,8 @@ ListView {
]
groups: [
- VisualDataGroup { id: visibleItems; objectName: "visibleItems"; name: "visible"; includeByDefault: true },
- VisualDataGroup { id: selectedItems; objectName: "selectedItems"; name: "selected" }
+ DelegateModelGroup { id: visibleItems; objectName: "visibleItems"; name: "visible"; includeByDefault: true },
+ DelegateModelGroup { id: selectedItems; objectName: "selectedItems"; name: "selected" }
]
model: objects
diff --git a/tests/auto/quick/qquickvisualdatamodel/data/objectlistproperties.qml b/tests/auto/quick/qquickvisualdatamodel/data/objectlistproperties.qml
index 0dbe2f5459..1941cdc6f2 100644
--- a/tests/auto/quick/qquickvisualdatamodel/data/objectlistproperties.qml
+++ b/tests/auto/quick/qquickvisualdatamodel/data/objectlistproperties.qml
@@ -1,10 +1,11 @@
import QtQuick 2.0
+import QtQml.Models 2.12
import tst_qquickvisualdatamodel 1.0
ListView {
width: 100
height: 100
- model: VisualDataModel {
+ model: DelegateModel {
id: visualModel
objectName: "visualModel"
@@ -16,8 +17,8 @@ ListView {
]
groups: [
- VisualDataGroup { id: visibleItems; objectName: "visibleItems"; name: "visible"; includeByDefault: true },
- VisualDataGroup { id: selectedItems; objectName: "selectedItems"; name: "selected" }
+ DelegateModelGroup { id: visibleItems; objectName: "visibleItems"; name: "visible"; includeByDefault: true },
+ DelegateModelGroup { id: selectedItems; objectName: "selectedItems"; name: "selected" }
]
model: objects
diff --git a/tests/auto/quick/qquickvisualdatamodel/data/onChanged.qml b/tests/auto/quick/qquickvisualdatamodel/data/onChanged.qml
index 71dc7d72d7..4a0d75b0f1 100644
--- a/tests/auto/quick/qquickvisualdatamodel/data/onChanged.qml
+++ b/tests/auto/quick/qquickvisualdatamodel/data/onChanged.qml
@@ -1,6 +1,7 @@
import QtQuick 2.0
+import QtQml.Models 2.12
-VisualDataModel {
+DelegateModel {
id: vm
property var inserted
@@ -42,7 +43,7 @@ VisualDataModel {
}
groups: [
- VisualDataGroup {
+ DelegateModelGroup {
id: vi;
property var inserted
@@ -56,7 +57,7 @@ VisualDataModel {
vi.removed = removed
}
},
- VisualDataGroup {
+ DelegateModelGroup {
id: si;
property var inserted
diff --git a/tests/auto/quick/qquickvisualdatamodel/data/packageView.qml b/tests/auto/quick/qquickvisualdatamodel/data/packageView.qml
index e3719a8be0..e6cb856c1e 100644
--- a/tests/auto/quick/qquickvisualdatamodel/data/packageView.qml
+++ b/tests/auto/quick/qquickvisualdatamodel/data/packageView.qml
@@ -1,4 +1,5 @@
import QtQuick 2.0
+import QtQml.Models 2.12
Item {
width: 240
@@ -34,7 +35,7 @@ Item {
}
- VisualDataModel {
+ DelegateModel {
id: visualModel
delegate: myDelegate
diff --git a/tests/auto/quick/qquickvisualdatamodel/data/singleroleproperties-package.qml b/tests/auto/quick/qquickvisualdatamodel/data/singleroleproperties-package.qml
index 1af1b3858d..8da63c8d22 100644
--- a/tests/auto/quick/qquickvisualdatamodel/data/singleroleproperties-package.qml
+++ b/tests/auto/quick/qquickvisualdatamodel/data/singleroleproperties-package.qml
@@ -1,4 +1,5 @@
import QtQuick 2.0
+import QtQml.Models 2.12
import tst_qquickvisualdatamodel 1.0
ListView {
@@ -6,13 +7,13 @@ ListView {
height: 100
model: visualModel.parts.package
- VisualDataModel {
+ DelegateModel {
id: visualModel
objectName: "visualModel"
groups: [
- VisualDataGroup { id: visibleItems; objectName: "visibleItems"; name: "visible"; includeByDefault: true },
- VisualDataGroup { id: selectedItems; objectName: "selectedItems"; name: "selected" }
+ DelegateModelGroup { id: visibleItems; objectName: "visibleItems"; name: "visible"; includeByDefault: true },
+ DelegateModelGroup { id: selectedItems; objectName: "selectedItems"; name: "selected" }
]
model: SingleRoleModel {
diff --git a/tests/auto/quick/qquickvisualdatamodel/data/singleroleproperties.qml b/tests/auto/quick/qquickvisualdatamodel/data/singleroleproperties.qml
index 50a5ded6ff..0c217ca763 100644
--- a/tests/auto/quick/qquickvisualdatamodel/data/singleroleproperties.qml
+++ b/tests/auto/quick/qquickvisualdatamodel/data/singleroleproperties.qml
@@ -1,16 +1,17 @@
import QtQuick 2.0
+import QtQml.Models 2.12
import tst_qquickvisualdatamodel 1.0
ListView {
width: 100
height: 100
- model: VisualDataModel {
+ model: DelegateModel {
id: visualModel
objectName: "visualModel"
groups: [
- VisualDataGroup { id: visibleItems; objectName: "visibleItems"; name: "visible"; includeByDefault: true },
- VisualDataGroup { id: selectedItems; objectName: "selectedItems"; name: "selected" }
+ DelegateModelGroup { id: visibleItems; objectName: "visibleItems"; name: "visible"; includeByDefault: true },
+ DelegateModelGroup { id: selectedItems; objectName: "selectedItems"; name: "selected" }
]
model: SingleRoleModel {
diff --git a/tests/auto/quick/qquickvisualdatamodel/data/stringlistproperties-package.qml b/tests/auto/quick/qquickvisualdatamodel/data/stringlistproperties-package.qml
index d1a4604b77..79a4c97b5b 100644
--- a/tests/auto/quick/qquickvisualdatamodel/data/stringlistproperties-package.qml
+++ b/tests/auto/quick/qquickvisualdatamodel/data/stringlistproperties-package.qml
@@ -1,17 +1,18 @@
import QtQuick 2.0
+import QtQml.Models 2.12
import tst_qquickvisualdatamodel 1.0
ListView {
width: 100
height: 100
model: visualModel.parts.package
- VisualDataModel {
+ DelegateModel {
id: visualModel
objectName: "visualModel"
groups: [
- VisualDataGroup { id: visibleItems; objectName: "visibleItems"; name: "visible"; includeByDefault: true },
- VisualDataGroup { id: selectedItems; objectName: "selectedItems"; name: "selected" }
+ DelegateModelGroup { id: visibleItems; objectName: "visibleItems"; name: "visible"; includeByDefault: true },
+ DelegateModelGroup { id: selectedItems; objectName: "selectedItems"; name: "selected" }
]
model: [
diff --git a/tests/auto/quick/qquickvisualdatamodel/data/stringlistproperties.qml b/tests/auto/quick/qquickvisualdatamodel/data/stringlistproperties.qml
index a075ccb4d9..69de807614 100644
--- a/tests/auto/quick/qquickvisualdatamodel/data/stringlistproperties.qml
+++ b/tests/auto/quick/qquickvisualdatamodel/data/stringlistproperties.qml
@@ -1,16 +1,17 @@
import QtQuick 2.0
+import QtQml.Models 2.12
import tst_qquickvisualdatamodel 1.0
ListView {
width: 100
height: 100
- model: VisualDataModel {
+ model: DelegateModel {
id: visualModel
objectName: "visualModel"
groups: [
- VisualDataGroup { id: visibleItems; objectName: "visibleItems"; name: "visible"; includeByDefault: true },
- VisualDataGroup { id: selectedItems; objectName: "selectedItems"; name: "selected" }
+ DelegateModelGroup { id: visibleItems; objectName: "visibleItems"; name: "visible"; includeByDefault: true },
+ DelegateModelGroup { id: selectedItems; objectName: "selectedItems"; name: "selected" }
]
model: [
diff --git a/tests/auto/quick/qquickvisualdatamodel/data/visualdatamodel.qml b/tests/auto/quick/qquickvisualdatamodel/data/visualdatamodel.qml
index e3ae1d1772..8779a0bae8 100644
--- a/tests/auto/quick/qquickvisualdatamodel/data/visualdatamodel.qml
+++ b/tests/auto/quick/qquickvisualdatamodel/data/visualdatamodel.qml
@@ -1,6 +1,7 @@
import QtQuick 2.0
+import QtQml.Models 2.12
-VisualDataModel {
+DelegateModel {
function setRoot() {
rootIndex = modelIndex(0);
}
diff --git a/tests/auto/quick/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp b/tests/auto/quick/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp
index 6498a80c79..1b8654ecdd 100644
--- a/tests/auto/quick/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp
+++ b/tests/auto/quick/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2018 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
@@ -1213,7 +1213,7 @@ void tst_qquickvisualdatamodel::watchedRoles()
QQmlDelegateModel *vdm = qobject_cast<QQmlDelegateModel*>(object.data());
QVERIFY(vdm);
- // VisualDataModel doesn't initialize model data until the first item is requested.
+ // DelegateModel doesn't initialize model data until the first item is requested.
QQuickItem *item = qobject_cast<QQuickItem*>(vdm->object(0));
QVERIFY(item);
vdm->release(item);
@@ -1456,22 +1456,22 @@ void tst_qquickvisualdatamodel::remove()
QCOMPARE(delegate->property("test3").toInt(), iIndex[i]);
}
} {
- QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML VisualDataGroup: remove: index out of range");
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML DelegateModelGroup: remove: index out of range");
evaluate<void>(visualModel, "items.remove(-8, 4)");
QCOMPARE(listview->count(), 7);
QCOMPARE(visualModel->items()->count(), 7);
} {
- QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML VisualDataGroup: remove: index out of range");
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML DelegateModelGroup: remove: index out of range");
evaluate<void>(visualModel, "items.remove(12, 2)");
QCOMPARE(listview->count(), 7);
QCOMPARE(visualModel->items()->count(), 7);
} {
- QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML VisualDataGroup: remove: invalid count");
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML DelegateModelGroup: remove: invalid count");
evaluate<void>(visualModel, "items.remove(5, 3)");
QCOMPARE(listview->count(), 7);
QCOMPARE(visualModel->items()->count(), 7);
} {
- QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML VisualDataGroup: remove: invalid count");
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML DelegateModelGroup: remove: invalid count");
evaluate<void>(visualModel, "items.remove(5, -2)");
QCOMPARE(listview->count(), 7);
QCOMPARE(visualModel->items()->count(), 7);
@@ -1593,37 +1593,37 @@ void tst_qquickvisualdatamodel::move()
QCOMPARE(delegate->property("test3").toInt(), iIndex[i]);
}
} {
- QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML VisualDataGroup: move: invalid count");
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML DelegateModelGroup: move: invalid count");
evaluate<void>(visualModel, "items.move(5, 2, -2)");
QCOMPARE(listview->count(), 12);
QCOMPARE(visualModel->items()->count(), 12);
} {
- QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML VisualDataGroup: move: from index out of range");
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML DelegateModelGroup: move: from index out of range");
evaluate<void>(visualModel, "items.move(-6, 2, 1)");
QCOMPARE(listview->count(), 12);
QCOMPARE(visualModel->items()->count(), 12);
} {
- QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML VisualDataGroup: move: from index out of range");
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML DelegateModelGroup: move: from index out of range");
evaluate<void>(visualModel, "items.move(15, 2, 1)");
QCOMPARE(listview->count(), 12);
QCOMPARE(visualModel->items()->count(), 12);
} {
- QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML VisualDataGroup: move: from index out of range");
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML DelegateModelGroup: move: from index out of range");
evaluate<void>(visualModel, "items.move(11, 1, 3)");
QCOMPARE(listview->count(), 12);
QCOMPARE(visualModel->items()->count(), 12);
} {
- QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML VisualDataGroup: move: to index out of range");
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML DelegateModelGroup: move: to index out of range");
evaluate<void>(visualModel, "items.move(2, -5, 1)");
QCOMPARE(listview->count(), 12);
QCOMPARE(visualModel->items()->count(), 12);
} {
- QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML VisualDataGroup: move: to index out of range");
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML DelegateModelGroup: move: to index out of range");
evaluate<void>(visualModel, "items.move(2, 14, 1)");
QCOMPARE(listview->count(), 12);
QCOMPARE(visualModel->items()->count(), 12);
} {
- QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML VisualDataGroup: move: to index out of range");
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML DelegateModelGroup: move: to index out of range");
evaluate<void>(visualModel, "items.move(2, 11, 4)");
QCOMPARE(listview->count(), 12);
QCOMPARE(visualModel->items()->count(), 12);
@@ -1786,82 +1786,82 @@ void tst_qquickvisualdatamodel::groups()
static const bool sMember[] = { f, f, f, f, f, f, f, f, t, t, f, f };
VERIFY_GROUPS;
} {
- QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML VisualDataGroup: addGroups: invalid count");
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML DelegateModelGroup: addGroups: invalid count");
evaluate<void>(visualModel, "items.addGroups(11, -4, \"items\")");
QCOMPARE(listview->count(), 12);
QCOMPARE(visualModel->items()->count(), 12);
QCOMPARE(visibleItems->count(), 9);
QCOMPARE(selectedItems->count(), 2);
} {
- QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML VisualDataGroup: addGroups: index out of range");
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML DelegateModelGroup: addGroups: index out of range");
evaluate<void>(visualModel, "items.addGroups(-1, 3, \"items\")");
QCOMPARE(listview->count(), 12);
QCOMPARE(visualModel->items()->count(), 12);
QCOMPARE(visibleItems->count(), 9);
QCOMPARE(selectedItems->count(), 2);
} {
- QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML VisualDataGroup: addGroups: index out of range");
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML DelegateModelGroup: addGroups: index out of range");
evaluate<void>(visualModel, "items.addGroups(14, 3, \"items\")");
QCOMPARE(listview->count(), 12);
QCOMPARE(visualModel->items()->count(), 12);
QCOMPARE(visibleItems->count(), 9);
QCOMPARE(selectedItems->count(), 2);
} {
- QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML VisualDataGroup: addGroups: invalid count");
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML DelegateModelGroup: addGroups: invalid count");
evaluate<void>(visualModel, "items.addGroups(11, 5, \"items\")");
QCOMPARE(listview->count(), 12);
QCOMPARE(visualModel->items()->count(), 12);
QCOMPARE(visibleItems->count(), 9);
QCOMPARE(selectedItems->count(), 2);
} {
- QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML VisualDataGroup: setGroups: invalid count");
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML DelegateModelGroup: setGroups: invalid count");
evaluate<void>(visualModel, "items.setGroups(11, -4, \"items\")");
QCOMPARE(listview->count(), 12);
QCOMPARE(visualModel->items()->count(), 12);
QCOMPARE(visibleItems->count(), 9);
QCOMPARE(selectedItems->count(), 2);
} {
- QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML VisualDataGroup: setGroups: index out of range");
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML DelegateModelGroup: setGroups: index out of range");
evaluate<void>(visualModel, "items.setGroups(-1, 3, \"items\")");
QCOMPARE(listview->count(), 12);
QCOMPARE(visualModel->items()->count(), 12);
QCOMPARE(visibleItems->count(), 9);
QCOMPARE(selectedItems->count(), 2);
} {
- QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML VisualDataGroup: setGroups: index out of range");
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML DelegateModelGroup: setGroups: index out of range");
evaluate<void>(visualModel, "items.setGroups(14, 3, \"items\")");
QCOMPARE(listview->count(), 12);
QCOMPARE(visualModel->items()->count(), 12);
QCOMPARE(visibleItems->count(), 9);
QCOMPARE(selectedItems->count(), 2);
} {
- QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML VisualDataGroup: setGroups: invalid count");
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML DelegateModelGroup: setGroups: invalid count");
evaluate<void>(visualModel, "items.setGroups(11, 5, \"items\")");
QCOMPARE(listview->count(), 12);
QCOMPARE(visualModel->items()->count(), 12);
QCOMPARE(visibleItems->count(), 9);
QCOMPARE(selectedItems->count(), 2);
} {
- QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML VisualDataGroup: removeGroups: invalid count");
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML DelegateModelGroup: removeGroups: invalid count");
evaluate<void>(visualModel, "items.removeGroups(11, -4, \"items\")");
QCOMPARE(listview->count(), 12);
QCOMPARE(visualModel->items()->count(), 12);
} {
- QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML VisualDataGroup: removeGroups: index out of range");
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML DelegateModelGroup: removeGroups: index out of range");
evaluate<void>(visualModel, "items.removeGroups(-1, 3, \"items\")");
QCOMPARE(listview->count(), 12);
QCOMPARE(visualModel->items()->count(), 12);
QCOMPARE(visibleItems->count(), 9);
QCOMPARE(selectedItems->count(), 2);
} {
- QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML VisualDataGroup: removeGroups: index out of range");
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML DelegateModelGroup: removeGroups: index out of range");
evaluate<void>(visualModel, "items.removeGroups(14, 3, \"items\")");
QCOMPARE(listview->count(), 12);
QCOMPARE(visualModel->items()->count(), 12);
QCOMPARE(visibleItems->count(), 9);
QCOMPARE(selectedItems->count(), 2);
} {
- QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML VisualDataGroup: removeGroups: invalid count");
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML DelegateModelGroup: removeGroups: invalid count");
evaluate<void>(visualModel, "items.removeGroups(11, 5, \"items\")");
QCOMPARE(listview->count(), 12);
QCOMPARE(visualModel->items()->count(), 12);
@@ -2150,7 +2150,7 @@ void tst_qquickvisualdatamodel::get()
void tst_qquickvisualdatamodel::invalidGroups()
{
QUrl source = testFileUrl("groups-invalid.qml");
- QTest::ignoreMessage(QtWarningMsg, (source.toString() + ":12:9: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("Group names must start with a lower case letter")).toUtf8());
+ QTest::ignoreMessage(QtWarningMsg, (source.toString() + ":13:9: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("Group names must start with a lower case letter")).toUtf8());
QQmlComponent component(&engine, source);
QScopedPointer<QObject> object(component.create());
@@ -2331,35 +2331,35 @@ void tst_qquickvisualdatamodel::create()
// persistedItems.includeByDefault is true, so all items belong to persistedItems initially.
QVERIFY(delegate = findItem<QQuickItem>(contentItem, "delegate", 1));
- QCOMPARE(evaluate<bool>(delegate, "VisualDataModel.inPersistedItems"), true);
+ QCOMPARE(evaluate<bool>(delegate, "DelegateModel.inPersistedItems"), true);
// changing include by default doesn't remove persistance.
evaluate<void>(visualModel, "persistedItems.includeByDefault = false");
- QCOMPARE(evaluate<bool>(delegate, "VisualDataModel.inPersistedItems"), true);
+ QCOMPARE(evaluate<bool>(delegate, "DelegateModel.inPersistedItems"), true);
// removing from persistedItems does.
evaluate<void>(visualModel, "persistedItems.remove(0, 20)");
QCOMPARE(listview->count(), 20);
- QCOMPARE(evaluate<bool>(delegate, "VisualDataModel.inPersistedItems"), false);
+ QCOMPARE(evaluate<bool>(delegate, "DelegateModel.inPersistedItems"), false);
// Request an item instantiated by the view.
QVERIFY(delegate = qobject_cast<QQuickItem *>(evaluate<QObject *>(visualModel, "items.create(1)")));
QCOMPARE(delegate.data(), findItem<QQuickItem>(contentItem, "delegate", 1));
- QCOMPARE(evaluate<bool>(delegate, "VisualDataModel.inPersistedItems"), true);
+ QCOMPARE(evaluate<bool>(delegate, "DelegateModel.inPersistedItems"), true);
QCOMPARE(evaluate<int>(visualModel, "persistedItems.count"), 1);
- evaluate<void>(delegate, "VisualDataModel.inPersistedItems = false");
+ evaluate<void>(delegate, "DelegateModel.inPersistedItems = false");
QCOMPARE(listview->count(), 20);
QCoreApplication::sendPostedEvents(delegate, QEvent::DeferredDelete);
QVERIFY(delegate);
- QCOMPARE(evaluate<bool>(delegate, "VisualDataModel.inPersistedItems"), false);
+ QCOMPARE(evaluate<bool>(delegate, "DelegateModel.inPersistedItems"), false);
QCOMPARE(evaluate<int>(visualModel, "persistedItems.count"), 0);
// Request an item not instantiated by the view.
QVERIFY(!findItem<QQuickItem>(contentItem, "delegate", 15));
QVERIFY(delegate = qobject_cast<QQuickItem *>(evaluate<QObject *>(visualModel, "items.create(15)")));
QCOMPARE(delegate.data(), findItem<QQuickItem>(contentItem, "delegate", 15));
- QCOMPARE(evaluate<bool>(delegate, "VisualDataModel.inPersistedItems"), true);
+ QCOMPARE(evaluate<bool>(delegate, "DelegateModel.inPersistedItems"), true);
QCOMPARE(evaluate<int>(visualModel, "persistedItems.count"), 1);
evaluate<void>(visualModel, "persistedItems.remove(0)");
@@ -2371,28 +2371,28 @@ void tst_qquickvisualdatamodel::create()
QVERIFY(!findItem<QQuickItem>(contentItem, "delegate", 16));
QVERIFY(delegate = qobject_cast<QQuickItem *>(evaluate<QObject *>(visualModel, "items.create(16)")));
QCOMPARE(delegate.data(), findItem<QQuickItem>(contentItem, "delegate", 16));
- QCOMPARE(evaluate<bool>(delegate, "VisualDataModel.inPersistedItems"), true);
+ QCOMPARE(evaluate<bool>(delegate, "DelegateModel.inPersistedItems"), true);
QCOMPARE(evaluate<int>(visualModel, "persistedItems.count"), 1);
evaluate<void>(listview, "positionViewAtIndex(19, ListView.End)");
QCOMPARE(listview->count(), 20);
- evaluate<void>(delegate, "VisualDataModel.groups = [\"items\"]");
+ evaluate<void>(delegate, "DelegateModel.groups = [\"items\"]");
QCoreApplication::sendPostedEvents(delegate, QEvent::DeferredDelete);
QVERIFY(delegate);
- QCOMPARE(evaluate<bool>(delegate, "VisualDataModel.inPersistedItems"), false);
+ QCOMPARE(evaluate<bool>(delegate, "DelegateModel.inPersistedItems"), false);
QCOMPARE(evaluate<int>(visualModel, "persistedItems.count"), 0);
// Request and release an item instantiated by the view, then scroll the view so it releases it.
QVERIFY(findItem<QQuickItem>(contentItem, "delegate", 17));
QVERIFY(delegate = qobject_cast<QQuickItem *>(evaluate<QObject *>(visualModel, "items.create(17)")));
QCOMPARE(delegate.data(), findItem<QQuickItem>(contentItem, "delegate", 17));
- QCOMPARE(evaluate<bool>(delegate, "VisualDataModel.inPersistedItems"), true);
+ QCOMPARE(evaluate<bool>(delegate, "DelegateModel.inPersistedItems"), true);
QCOMPARE(evaluate<int>(visualModel, "persistedItems.count"), 1);
evaluate<void>(visualModel, "items.removeGroups(17, \"persistedItems\")");
QCoreApplication::sendPostedEvents(delegate, QEvent::DeferredDelete);
QVERIFY(delegate);
- QCOMPARE(evaluate<bool>(delegate, "VisualDataModel.inPersistedItems"), false);
+ QCOMPARE(evaluate<bool>(delegate, "DelegateModel.inPersistedItems"), false);
QCOMPARE(evaluate<int>(visualModel, "persistedItems.count"), 0);
evaluate<void>(listview, "positionViewAtIndex(1, ListView.Beginning)");
QCOMPARE(listview->count(), 20);
@@ -2407,7 +2407,7 @@ void tst_qquickvisualdatamodel::create()
evaluate<void>(listview, "positionViewAtIndex(19, ListView.End)");
QCOMPARE(listview->count(), 20);
QVERIFY(delegate = findItem<QQuickItem>(contentItem, "delegate", 18));
- QCOMPARE(evaluate<bool>(delegate, "VisualDataModel.inPersistedItems"), true);
+ QCOMPARE(evaluate<bool>(delegate, "DelegateModel.inPersistedItems"), true);
QCoreApplication::sendPostedEvents(delegate, QEvent::DeferredDelete);
QVERIFY(delegate);
evaluate<void>(listview, "positionViewAtIndex(1, ListView.Beginning)");
@@ -2428,11 +2428,11 @@ void tst_qquickvisualdatamodel::create()
void tst_qquickvisualdatamodel::incompleteModel()
{
- // VisualDataModel is first populated in componentComplete. Verify various functions are
+ // DelegateModel is first populated in componentComplete. Verify various functions are
// harmlessly ignored until then.
QQmlComponent component(&engine);
- component.setData("import QtQuick 2.0\n VisualDataModel {}", testFileUrl(""));
+ component.setData("import QtQuick 2.0\nimport QtQml.Models 2.2\nDelegateModel {}", testFileUrl(""));
QScopedPointer<QObject> object(component.beginCreate(engine.rootContext()));
@@ -2462,7 +2462,7 @@ void tst_qquickvisualdatamodel::incompleteModel()
QCOMPARE(itemsSpy.count(), 0);
QCOMPARE(persistedItemsSpy.count(), 0);
- QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML VisualDataGroup: get: index out of range");
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML DelegateModelGroup: get: index out of range");
QVERIFY(evaluate<bool>(model, "items.get(0) === undefined"));
component.completeCreate();
@@ -3113,16 +3113,16 @@ void tst_qquickvisualdatamodel::insert()
QCOMPARE(evaluate<QString>(item, "test6"), propertyData.at(i));
}
- QCOMPARE(evaluate<bool>(item, "delegate.VisualDataModel.inItems"), true);
- QCOMPARE(evaluate<bool>(item, "delegate.VisualDataModel.inPersistedItems"), false);
- QCOMPARE(evaluate<bool>(item, "delegate.VisualDataModel.inVisible"), true);
- QCOMPARE(evaluate<bool>(item, "delegate.VisualDataModel.inSelected"), false);
- QCOMPARE(evaluate<bool>(item, "delegate.VisualDataModel.isUnresolved"), false);
+ QCOMPARE(evaluate<bool>(item, "delegate.DelegateModel.inItems"), true);
+ QCOMPARE(evaluate<bool>(item, "delegate.DelegateModel.inPersistedItems"), false);
+ QCOMPARE(evaluate<bool>(item, "delegate.DelegateModel.inVisible"), true);
+ QCOMPARE(evaluate<bool>(item, "delegate.DelegateModel.inSelected"), false);
+ QCOMPARE(evaluate<bool>(item, "delegate.DelegateModel.isUnresolved"), false);
- QCOMPARE(evaluate<int>(item, "delegate.VisualDataModel.itemsIndex"), itemsIndex);
- QCOMPARE(evaluate<int>(item, "delegate.VisualDataModel.persistedItemsIndex"), persisted && i > index ? 1 : 0);
- QCOMPARE(evaluate<int>(item, "delegate.VisualDataModel.visibleIndex"), visible || i <= index ? i : i - 1);
- QCOMPARE(evaluate<int>(item, "delegate.VisualDataModel.selectedIndex"), selected && i > index ? 1 : 0);
+ QCOMPARE(evaluate<int>(item, "delegate.DelegateModel.itemsIndex"), itemsIndex);
+ QCOMPARE(evaluate<int>(item, "delegate.DelegateModel.persistedItemsIndex"), persisted && i > index ? 1 : 0);
+ QCOMPARE(evaluate<int>(item, "delegate.DelegateModel.visibleIndex"), visible || i <= index ? i : i - 1);
+ QCOMPARE(evaluate<int>(item, "delegate.DelegateModel.selectedIndex"), selected && i > index ? 1 : 0);
} else if (inItems) {
get = QString("items.get(%1)").arg(index);
} else if (persisted) {
@@ -3176,16 +3176,16 @@ void tst_qquickvisualdatamodel::insert()
QCOMPARE(evaluate<QString>(item, "test6"), propertyData.at(index));
}
- QCOMPARE(evaluate<bool>(item, "delegate.VisualDataModel.inItems"), inItems);
- QCOMPARE(evaluate<bool>(item, "delegate.VisualDataModel.inPersistedItems"), true);
- QCOMPARE(evaluate<bool>(item, "delegate.VisualDataModel.inVisible"), visible);
- QCOMPARE(evaluate<bool>(item, "delegate.VisualDataModel.inSelected"), selected);
- QCOMPARE(evaluate<bool>(item, "delegate.VisualDataModel.isUnresolved"), true);
+ QCOMPARE(evaluate<bool>(item, "delegate.DelegateModel.inItems"), inItems);
+ QCOMPARE(evaluate<bool>(item, "delegate.DelegateModel.inPersistedItems"), true);
+ QCOMPARE(evaluate<bool>(item, "delegate.DelegateModel.inVisible"), visible);
+ QCOMPARE(evaluate<bool>(item, "delegate.DelegateModel.inSelected"), selected);
+ QCOMPARE(evaluate<bool>(item, "delegate.DelegateModel.isUnresolved"), true);
- QCOMPARE(evaluate<int>(item, "delegate.VisualDataModel.itemsIndex"), index);
- QCOMPARE(evaluate<int>(item, "delegate.VisualDataModel.persistedItemsIndex"), 0);
- QCOMPARE(evaluate<int>(item, "delegate.VisualDataModel.visibleIndex"), index);
- QCOMPARE(evaluate<int>(item, "delegate.VisualDataModel.selectedIndex"), 0);
+ QCOMPARE(evaluate<int>(item, "delegate.DelegateModel.itemsIndex"), index);
+ QCOMPARE(evaluate<int>(item, "delegate.DelegateModel.persistedItemsIndex"), 0);
+ QCOMPARE(evaluate<int>(item, "delegate.DelegateModel.visibleIndex"), index);
+ QCOMPARE(evaluate<int>(item, "delegate.DelegateModel.selectedIndex"), 0);
}
void tst_qquickvisualdatamodel::resolve_data()
@@ -3577,16 +3577,16 @@ void tst_qquickvisualdatamodel::resolve()
QCOMPARE(evaluate<QString>(item, "test6"), propertyData.at(i));
}
- QCOMPARE(evaluate<bool>(item, "delegate.VisualDataModel.inItems"), true);
- QCOMPARE(evaluate<bool>(item, "delegate.VisualDataModel.inPersistedItems"), false);
- QCOMPARE(evaluate<bool>(item, "delegate.VisualDataModel.inVisible"), true);
- QCOMPARE(evaluate<bool>(item, "delegate.VisualDataModel.inSelected"), false);
- QCOMPARE(evaluate<bool>(item, "delegate.VisualDataModel.isUnresolved"), false);
+ QCOMPARE(evaluate<bool>(item, "delegate.DelegateModel.inItems"), true);
+ QCOMPARE(evaluate<bool>(item, "delegate.DelegateModel.inPersistedItems"), false);
+ QCOMPARE(evaluate<bool>(item, "delegate.DelegateModel.inVisible"), true);
+ QCOMPARE(evaluate<bool>(item, "delegate.DelegateModel.inSelected"), false);
+ QCOMPARE(evaluate<bool>(item, "delegate.DelegateModel.isUnresolved"), false);
- QCOMPARE(evaluate<int>(item, "delegate.VisualDataModel.itemsIndex"), itemsIndex);
- QCOMPARE(evaluate<int>(item, "delegate.VisualDataModel.persistedItemsIndex"), persisted && i > index ? 1 : 0);
- QCOMPARE(evaluate<int>(item, "delegate.VisualDataModel.visibleIndex"), visible || i <= index ? i : i - 1);
- QCOMPARE(evaluate<int>(item, "delegate.VisualDataModel.selectedIndex"), selected && i > index ? 1 : 0);
+ QCOMPARE(evaluate<int>(item, "delegate.DelegateModel.itemsIndex"), itemsIndex);
+ QCOMPARE(evaluate<int>(item, "delegate.DelegateModel.persistedItemsIndex"), persisted && i > index ? 1 : 0);
+ QCOMPARE(evaluate<int>(item, "delegate.DelegateModel.visibleIndex"), visible || i <= index ? i : i - 1);
+ QCOMPARE(evaluate<int>(item, "delegate.DelegateModel.selectedIndex"), selected && i > index ? 1 : 0);
} else if (inItems) {
get = QString("items.get(%1)").arg(index);
} else if (persisted) {
@@ -3640,16 +3640,16 @@ void tst_qquickvisualdatamodel::resolve()
QCOMPARE(evaluate<QString>(item, "test6"), propertyData.at(index));
}
- QCOMPARE(evaluate<bool>(item, "delegate.VisualDataModel.inItems"), inItems);
- QCOMPARE(evaluate<bool>(item, "delegate.VisualDataModel.inPersistedItems"), true);
- QCOMPARE(evaluate<bool>(item, "delegate.VisualDataModel.inVisible"), visible);
- QCOMPARE(evaluate<bool>(item, "delegate.VisualDataModel.inSelected"), selected);
- QCOMPARE(evaluate<bool>(item, "delegate.VisualDataModel.isUnresolved"), false);
+ QCOMPARE(evaluate<bool>(item, "delegate.DelegateModel.inItems"), inItems);
+ QCOMPARE(evaluate<bool>(item, "delegate.DelegateModel.inPersistedItems"), true);
+ QCOMPARE(evaluate<bool>(item, "delegate.DelegateModel.inVisible"), visible);
+ QCOMPARE(evaluate<bool>(item, "delegate.DelegateModel.inSelected"), selected);
+ QCOMPARE(evaluate<bool>(item, "delegate.DelegateModel.isUnresolved"), false);
- QCOMPARE(evaluate<int>(item, "delegate.VisualDataModel.itemsIndex"), index);
- QCOMPARE(evaluate<int>(item, "delegate.VisualDataModel.persistedItemsIndex"), 0);
- QCOMPARE(evaluate<int>(item, "delegate.VisualDataModel.visibleIndex"), index);
- QCOMPARE(evaluate<int>(item, "delegate.VisualDataModel.selectedIndex"), 0);
+ QCOMPARE(evaluate<int>(item, "delegate.DelegateModel.itemsIndex"), index);
+ QCOMPARE(evaluate<int>(item, "delegate.DelegateModel.persistedItemsIndex"), 0);
+ QCOMPARE(evaluate<int>(item, "delegate.DelegateModel.visibleIndex"), index);
+ QCOMPARE(evaluate<int>(item, "delegate.DelegateModel.selectedIndex"), 0);
}
void tst_qquickvisualdatamodel::warnings_data()
@@ -3662,67 +3662,67 @@ void tst_qquickvisualdatamodel::warnings_data()
QTest::newRow("insert < 0")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.insert(-2, {\"number\": \"eight\"})")
- << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("insert: index out of range"))
+ << ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("insert: index out of range"))
<< 4;
QTest::newRow("insert > length")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.insert(8, {\"number\": \"eight\"})")
- << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("insert: index out of range"))
+ << ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("insert: index out of range"))
<< 4;
QTest::newRow("create < 0")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.create(-2, {\"number\": \"eight\"})")
- << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("create: index out of range"))
+ << ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("create: index out of range"))
<< 4;
QTest::newRow("create > length")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.create(8, {\"number\": \"eight\"})")
- << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("create: index out of range"))
+ << ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("create: index out of range"))
<< 4;
QTest::newRow("resolve from < 0")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.resolve(-2, 3)")
- << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("resolve: from index out of range"))
+ << ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("resolve: from index out of range"))
<< 4;
QTest::newRow("resolve from > length")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.resolve(8, 3)")
- << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("resolve: from index out of range"))
+ << ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("resolve: from index out of range"))
<< 4;
QTest::newRow("resolve to < 0")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.resolve(3, -2)")
- << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("resolve: to index out of range"))
+ << ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("resolve: to index out of range"))
<< 4;
QTest::newRow("resolve to > length")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.resolve(3, 8)")
- << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("resolve: to index out of range"))
+ << ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("resolve: to index out of range"))
<< 4;
QTest::newRow("resolve from invalid index")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.resolve(\"two\", 3)")
- << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("resolve: from index invalid"))
+ << ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("resolve: from index invalid"))
<< 4;
QTest::newRow("resolve to invalid index")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.resolve(3, \"two\")")
- << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("resolve: to index invalid"))
+ << ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("resolve: to index invalid"))
<< 4;
QTest::newRow("resolve already resolved item")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.resolve(3, 2)")
- << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("resolve: from is not an unresolved item"))
+ << ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("resolve: from is not an unresolved item"))
<< 4;
QTest::newRow("resolve already resolved item")
@@ -3730,193 +3730,193 @@ void tst_qquickvisualdatamodel::warnings_data()
<< QString("{ items.insert(0, {\"number\": \"eight\"});"
"items.insert(1, {\"number\": \"seven\"});"
"items.resolve(0, 1)}")
- << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("resolve: to is not a model item"))
+ << ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("resolve: to is not a model item"))
<< 6;
QTest::newRow("remove index < 0")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.remove(-2, 1)")
- << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("remove: index out of range"))
+ << ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("remove: index out of range"))
<< 4;
QTest::newRow("remove index == length")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.remove(4, 1)")
- << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("remove: index out of range"))
+ << ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("remove: index out of range"))
<< 4;
QTest::newRow("remove index > length")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.remove(9, 1)")
- << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("remove: index out of range"))
+ << ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("remove: index out of range"))
<< 4;
QTest::newRow("remove invalid index")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.remove(\"nine\", 1)")
- << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("remove: invalid index"))
+ << ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("remove: invalid index"))
<< 4;
QTest::newRow("remove count < 0")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.remove(1, -2)")
- << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("remove: invalid count"))
+ << ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("remove: invalid count"))
<< 4;
QTest::newRow("remove index + count > length")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.remove(2, 4, \"selected\")")
- << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("remove: invalid count"))
+ << ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("remove: invalid count"))
<< 4;
QTest::newRow("addGroups index < 0")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.addGroups(-2, 1, \"selected\")")
- << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("addGroups: index out of range"))
+ << ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("addGroups: index out of range"))
<< 4;
QTest::newRow("addGroups index == length")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.addGroups(4, 1, \"selected\")")
- << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("addGroups: index out of range"))
+ << ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("addGroups: index out of range"))
<< 4;
QTest::newRow("addGroups index > length")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.addGroups(9, 1, \"selected\")")
- << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("addGroups: index out of range"))
+ << ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("addGroups: index out of range"))
<< 4;
QTest::newRow("addGroups count < 0")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.addGroups(1, -2, \"selected\")")
- << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("addGroups: invalid count"))
+ << ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("addGroups: invalid count"))
<< 4;
QTest::newRow("addGroups index + count > length")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.addGroups(2, 4, \"selected\")")
- << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("addGroups: invalid count"))
+ << ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("addGroups: invalid count"))
<< 4;
QTest::newRow("removeGroups index < 0")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.removeGroups(-2, 1, \"selected\")")
- << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("removeGroups: index out of range"))
+ << ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("removeGroups: index out of range"))
<< 4;
QTest::newRow("removeGroups index == length")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.removeGroups(4, 1, \"selected\")")
- << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("removeGroups: index out of range"))
+ << ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("removeGroups: index out of range"))
<< 4;
QTest::newRow("removeGroups index > length")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.removeGroups(9, 1, \"selected\")")
- << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("removeGroups: index out of range"))
+ << ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("removeGroups: index out of range"))
<< 4;
QTest::newRow("removeGroups count < 0")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.removeGroups(1, -2, \"selected\")")
- << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("removeGroups: invalid count"))
+ << ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("removeGroups: invalid count"))
<< 4;
QTest::newRow("removeGroups index + count > length")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.removeGroups(2, 4, \"selected\")")
- << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("removeGroups: invalid count"))
+ << ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("removeGroups: invalid count"))
<< 4;
QTest::newRow("setGroups index < 0")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.setGroups(-2, 1, \"selected\")")
- << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("setGroups: index out of range"))
+ << ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("setGroups: index out of range"))
<< 4;
QTest::newRow("setGroups index == length")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.setGroups(4, 1, \"selected\")")
- << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("setGroups: index out of range"))
+ << ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("setGroups: index out of range"))
<< 4;
QTest::newRow("setGroups index > length")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.setGroups(9, 1, \"selected\")")
- << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("setGroups: index out of range"))
+ << ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("setGroups: index out of range"))
<< 4;
QTest::newRow("setGroups count < 0")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.setGroups(1, -2, \"selected\")")
- << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("setGroups: invalid count"))
+ << ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("setGroups: invalid count"))
<< 4;
QTest::newRow("setGroups index + count > length")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.setGroups(2, 4, \"selected\")")
- << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("setGroups: invalid count"))
+ << ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("setGroups: invalid count"))
<< 4;
QTest::newRow("move from < 0")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.move(-2, 1, 1)")
- << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("move: from index out of range"))
+ << ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("move: from index out of range"))
<< 4;
QTest::newRow("move from == length")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.move(4, 1, 1)")
- << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("move: from index out of range"))
+ << ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("move: from index out of range"))
<< 4;
QTest::newRow("move from > length")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.move(9, 1, 1)")
- << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("move: from index out of range"))
+ << ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("move: from index out of range"))
<< 4;
QTest::newRow("move invalid from")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.move(\"nine\", 1, 1)")
- << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("move: invalid from index"))
+ << ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("move: invalid from index"))
<< 4;
QTest::newRow("move to < 0")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.move(1, -2, 1)")
- << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("move: to index out of range"))
+ << ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("move: to index out of range"))
<< 4;
QTest::newRow("move to == length")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.move(1, 4, 1)")
- << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("move: to index out of range"))
+ << ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("move: to index out of range"))
<< 4;
QTest::newRow("move to > length")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.move(1, 9, 1)")
- << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("move: to index out of range"))
+ << ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("move: to index out of range"))
<< 4;
QTest::newRow("move invalid to")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.move(1, \"nine\", 1)")
- << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("move: invalid to index"))
+ << ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("move: invalid to index"))
<< 4;
QTest::newRow("move count < 0")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.move(1, 1, -2)")
- << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("move: invalid count"))
+ << ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("move: invalid count"))
<< 4;
QTest::newRow("move from + count > length")
<< testFileUrl("listmodelproperties.qml")
<< QString("items.move(2, 1, 4)")
- << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("move: from index out of range"))
+ << ("<Unknown File>: QML DelegateModelGroup: " + QQmlDelegateModelGroup::tr("move: from index out of range"))
<< 4;
}
diff --git a/tests/auto/quick/touchmouse/tst_touchmouse.cpp b/tests/auto/quick/touchmouse/tst_touchmouse.cpp
index 052d81b6de..7fccb895db 100644
--- a/tests/auto/quick/touchmouse/tst_touchmouse.cpp
+++ b/tests/auto/quick/touchmouse/tst_touchmouse.cpp
@@ -28,6 +28,7 @@
#include <QtTest/QtTest>
+#include <QDebug>
#include <QtGui/qstylehints.h>
#include <private/qdebug_p.h>
@@ -47,6 +48,8 @@
#include "../../shared/util.h"
#include "../shared/viewtestutil.h"
+Q_LOGGING_CATEGORY(lcTests, "qt.quick.tests")
+
struct Event
{
Event(QEvent::Type t, QPoint mouse, QPoint global)
@@ -703,14 +706,18 @@ void tst_TouchMouse::touchButtonOnFlickable()
void tst_TouchMouse::buttonOnDelayedPressFlickable_data()
{
QTest::addColumn<bool>("scrollBeforeDelayIsOver");
+ QTest::addColumn<bool>("releaseBeforeDelayIsOver");
// the item should never see the event,
// due to the pressDelay which never delivers if we start moving
- QTest::newRow("scroll before press delay is over") << true;
+ QTest::newRow("scroll before press delay is over") << true << false;
+
+ // after release, the item should see the press and release via event replay (QTBUG-61144)
+ QTest::newRow("release before press delay is over") << false << true;
// wait until the "button" sees the press but then
// start moving: the button gets a press and cancel event
- QTest::newRow("scroll after press delay is over") << false;
+ QTest::newRow("scroll after press delay is over") << false << false;
}
void tst_TouchMouse::buttonOnDelayedPressFlickable()
@@ -719,6 +726,7 @@ void tst_TouchMouse::buttonOnDelayedPressFlickable()
// - eventItem1 y: 100, height 100
// - eventItem2 y: 300, height 100
QFETCH(bool, scrollBeforeDelayIsOver);
+ QFETCH(bool, releaseBeforeDelayIsOver);
qApp->setAttribute(Qt::AA_SynthesizeMouseForUnhandledTouchEvents, true);
filteredEventList.clear();
@@ -757,11 +765,12 @@ void tst_TouchMouse::buttonOnDelayedPressFlickable()
// touch press
QPoint p1 = QPoint(10, 110);
+ QPoint pEnd = p1;
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
+ if (scrollBeforeDelayIsOver || releaseBeforeDelayIsOver) {
+ // no events yet: press is delayed
QCOMPARE(eventItem1->eventList.size(), 0);
} else {
// wait until the button sees the press
@@ -770,45 +779,64 @@ void tst_TouchMouse::buttonOnDelayedPressFlickable()
QCOMPARE(filteredEventList.count(), 1);
}
- p1 += QPoint(0, -10);
- QPoint p2 = p1 + QPoint(0, -10);
- QPoint p3 = p2 + QPoint(0, -10);
- 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 (!releaseBeforeDelayIsOver) {
+ // move the touchpoint: try to flick
+ p1 += QPoint(0, -10);
+ QPoint p2 = p1 + QPoint(0, -10);
+ pEnd = p2 + QPoint(0, -10);
+ 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, pEnd, window.data());
+ QQuickTouchUtils::flush(window.data());
+ QTRY_VERIFY(flickable->isMovingVertically());
+
+ if (scrollBeforeDelayIsOver) {
+ QCOMPARE(eventItem1->eventList.size(), 0);
+ QCOMPARE(filteredEventList.count(), 0);
+ } else {
+ // see at least press, move and ungrab
+ QTRY_VERIFY(eventItem1->eventList.size() > 2);
+ QCOMPARE(eventItem1->eventList.at(0).type, QEvent::MouseButtonPress);
+ QCOMPARE(eventItem1->eventList.last().type, QEvent::UngrabMouse);
+ QCOMPARE(filteredEventList.count(), 1);
+ }
- if (scrollBeforeDelayIsOver) {
- QCOMPARE(eventItem1->eventList.size(), 0);
- QCOMPARE(filteredEventList.count(), 0);
- } else {
- // see at least press, move and ungrab
- QTRY_VERIFY(eventItem1->eventList.size() > 2);
- QCOMPARE(eventItem1->eventList.at(0).type, QEvent::MouseButtonPress);
- QCOMPARE(eventItem1->eventList.last().type, QEvent::UngrabMouse);
- QCOMPARE(filteredEventList.count(), 1);
+ // flickable should have the mouse grab, and have moved the itemForTouchPointId
+ // for the touchMouseId to the new grabber.
+ QCOMPARE(window->mouseGrabberItem(), flickable);
+ QVERIFY(windowPriv->touchMouseId != -1);
+ auto pointerEvent = windowPriv->pointerEventInstance(QQuickPointerDevice::touchDevices().at(0));
+ QCOMPARE(pointerEvent->point(0)->grabberItem(), flickable);
}
- // flickable should have the mouse grab, and have moved the itemForTouchPointId
- // for the touchMouseId to the new grabber.
- QCOMPARE(window->mouseGrabberItem(), flickable);
- QVERIFY(windowPriv->touchMouseId != -1);
- auto pointerEvent = windowPriv->pointerEventInstance(QQuickPointerDevice::touchDevices().at(0));
- QCOMPARE(pointerEvent->point(0)->grabberItem(), flickable);
-
- QTest::touchEvent(window.data(), device).release(0, p3, window.data());
+ QTest::touchEvent(window.data(), device).release(0, pEnd, window.data());
QQuickTouchUtils::flush(window.data());
- // We should not have received any synthesised mouse events from Qt gui,
- // just the delayed press.
- if (scrollBeforeDelayIsOver)
- QCOMPARE(filteredEventList.count(), 0);
- else
- QCOMPARE(filteredEventList.count(), 1);
+ if (releaseBeforeDelayIsOver) {
+ // when the touchpoint was released, the child saw the delayed press and the release in sequence
+ qCDebug(lcTests) << "expected delivered events: press, release, ungrab" << eventItem1->eventList;
+ qCDebug(lcTests) << "expected filtered events: delayed press, release" << filteredEventList;
+ QTRY_COMPARE(eventItem1->eventList.size(), 3);
+ QCOMPARE(eventItem1->eventList.at(0).type, QEvent::MouseButtonPress);
+ QCOMPARE(eventItem1->eventList.at(1).type, QEvent::MouseButtonRelease);
+ QCOMPARE(eventItem1->eventList.last().type, QEvent::UngrabMouse);
+ // QQuickWindow filters the delayed press and release
+ QCOMPARE(filteredEventList.count(), 2);
+ QCOMPARE(filteredEventList.at(0).type, QEvent::MouseButtonPress);
+ QCOMPARE(filteredEventList.at(1).type, QEvent::MouseButtonRelease);
+ } else {
+ // QQuickWindow filters the delayed press if there was one; otherwise nothing
+ if (scrollBeforeDelayIsOver) {
+ QCOMPARE(filteredEventList.count(), 0);
+ } else {
+ qCDebug(lcTests) << "expected filtered event: delayed press" << filteredEventList;
+ QCOMPARE(filteredEventList.count(), 1);
+ QCOMPARE(filteredEventList.at(0).type, QEvent::MouseButtonPress);
+ }
+ }
}
void tst_TouchMouse::buttonOnTouch()
diff --git a/tests/testapplications/elements/content/RepeaterElement.qml b/tests/testapplications/elements/content/RepeaterElement.qml
index e825a0ac2c..fc4b3488ea 100644
--- a/tests/testapplications/elements/content/RepeaterElement.qml
+++ b/tests/testapplications/elements/content/RepeaterElement.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2018 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
@@ -27,6 +27,7 @@
****************************************************************************/
import QtQuick 2.0
+import QtQml.Models 2.12
Item {
id: repeaterelementtest
@@ -48,7 +49,7 @@ Item {
}
- VisualItemModel {
+ ObjectModel {
id: repeatermodel
Rectangle { color: "blue"; height: 40; width: 150; border.color: "black"; border.width: 3; opacity: .9; radius: 5; clip: true
Text { text: "I am Thing 1"; anchors.centerIn: parent } }
diff --git a/tests/testapplications/text/text.qml b/tests/testapplications/text/text.qml
index d2a8cff181..1737e70f30 100644
--- a/tests/testapplications/text/text.qml
+++ b/tests/testapplications/text/text.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2018 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
@@ -27,6 +27,7 @@
****************************************************************************/
import QtQuick 2.0
+import QtQml.Models 2.12
Rectangle {
height: 360; width: 640
@@ -105,7 +106,7 @@ Rectangle {
anchors.right: parent.right
Rectangle { anchors.fill: parent; color: "transparent"; border.color: "black" }
ListView { id: controls; model: controlsmodel; anchors.fill: parent; clip: true; cacheBuffer: 500 }
- VisualItemModel {
+ ObjectModel {
id: controlsmodel
ControlView {
id: textvalue
diff --git a/tests/testapplications/text/textedit.qml b/tests/testapplications/text/textedit.qml
index 677784a978..b96193307a 100644
--- a/tests/testapplications/text/textedit.qml
+++ b/tests/testapplications/text/textedit.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2018 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
@@ -27,6 +27,7 @@
****************************************************************************/
import QtQuick 2.1
+import QtQml.Models 2.12
Rectangle {
height: 360; width: 640
@@ -102,7 +103,7 @@ Rectangle {
anchors.right: parent.right
Rectangle { anchors.fill: parent; color: "transparent"; border.color: "black" }
ListView { id: controls; model: controlsmodel; anchors.fill: parent; clip: true; cacheBuffer: 500 }
- VisualItemModel {
+ ObjectModel {
id: controlsmodel
ControlView {
id: textvalue
diff --git a/tests/testapplications/text/textinput.qml b/tests/testapplications/text/textinput.qml
index f1f9c7ac4f..72e6d83931 100644
--- a/tests/testapplications/text/textinput.qml
+++ b/tests/testapplications/text/textinput.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2018 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
@@ -27,6 +27,7 @@
****************************************************************************/
import QtQuick 2.0
+import QtQml.Models 2.12
Rectangle {
height: 360; width: 640
@@ -148,7 +149,7 @@ Rectangle {
anchors.right: parent.right
Rectangle { anchors.fill: parent; color: "transparent"; border.color: "black" }
ListView { id: controls; model: controlsmodel; anchors.fill: parent; clip: true; cacheBuffer: 500 }
- VisualItemModel {
+ ObjectModel {
id: controlsmodel
ControlView {
id: textvalue
diff --git a/tools/qmlcachegen/qtquickcompiler.prf b/tools/qmlcachegen/qtquickcompiler.prf
index 7d8a857847..608b5c9143 100644
--- a/tools/qmlcachegen/qtquickcompiler.prf
+++ b/tools/qmlcachegen/qtquickcompiler.prf
@@ -6,6 +6,7 @@ isEmpty(QMLCACHE_DIR): QMLCACHE_DIR = .
defineReplace(qmlCacheResourceFileOutputName) {
name = $$relative_path($$1, $$_PRO_FILE_PWD_)
+ contains(name, ^\\.\\..*): name = $$relative_path($$1, $$OUT_PWD)
name = $$replace(name,/,_)
name = $$replace(name, \\.qrc$, _qmlcache.qrc)
name = $$replace(name,\.\.,)