aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/particles/qquickimageparticle.cpp14
-rw-r--r--src/qml/jsruntime/qv4engine.cpp25
-rw-r--r--src/qml/qml/qqmlengine_p.h16
-rw-r--r--src/qml/qml/qqmlobjectcreator.cpp4
-rw-r--r--src/qml/qml/qqmlproperty.cpp38
-rw-r--r--src/qml/qml/qqmlvaluetype.cpp92
-rw-r--r--src/qml/qml/qqmlvaluetype_p.h49
-rw-r--r--src/qml/qml/qqmlvmemetaobject.cpp12
-rw-r--r--src/qml/types/qqmlbind.cpp8
-rw-r--r--src/quick/designer/qquickdesignersupportproperties.cpp8
-rw-r--r--src/quick/items/qquickflickable.cpp19
-rw-r--r--src/quick/items/qquicklistview.cpp168
-rw-r--r--src/quick/items/qquickshadereffectsource.cpp4
-rw-r--r--tests/auto/qml/qqmlecmascript/data/sequenceConversion.write.error.qml2
-rw-r--r--tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp9
-rw-r--r--tests/auto/qml/qqmllanguage/data/arrayToContainer.qml7
-rw-r--r--tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp27
-rw-r--r--tests/auto/quick/qquickflickable/data/visibleAreaBinding.qml38
-rw-r--r--tests/auto/quick/qquickflickable/tst_qquickflickable.cpp11
-rw-r--r--tests/auto/quick/qquicklistview/data/headerSnapToItem.qml67
-rw-r--r--tests/auto/quick/qquicklistview/tst_qquicklistview.cpp601
-rw-r--r--tests/auto/quick/qquickmousearea/BLACKLIST4
-rw-r--r--tools/qmlcachegen/qtquickcompiler.prf1
23 files changed, 1115 insertions, 109 deletions
diff --git a/src/particles/qquickimageparticle.cpp b/src/particles/qquickimageparticle.cpp
index 4ce8186c7c..c6fe2f516d 100644
--- a/src/particles/qquickimageparticle.cpp
+++ b/src/particles/qquickimageparticle.cpp
@@ -1,4 +1,4 @@
-/****************************************************************************
+/****************************************************************************
**
** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
@@ -389,10 +389,10 @@ private:
QSGMaterialType DeformableMaterial::m_type;
-class SpriteMaterialShader : public QSGMaterialShader
+class ParticleSpriteMaterialShader : public QSGMaterialShader
{
public:
- SpriteMaterialShader()
+ ParticleSpriteMaterialShader()
{
QSGShaderSourceBuilder builder;
const bool isES = QOpenGLContext::currentContext()->isOpenGLES();
@@ -478,10 +478,10 @@ public:
QOpenGLFunctions* glFuncs;
};
-class SpriteMaterialRhiShader : public QSGMaterialRhiShader
+class ParticleSpriteMaterialRhiShader : public QSGMaterialRhiShader
{
public:
- SpriteMaterialRhiShader()
+ ParticleSpriteMaterialRhiShader()
{
setShaderFileName(VertexStage, QStringLiteral(":/particles/shaders_ng/imageparticle_sprite.vert.qsb"));
setShaderFileName(FragmentStage, QStringLiteral(":/particles/shaders_ng/imageparticle_sprite.frag.qsb"));
@@ -544,9 +544,9 @@ public:
SpriteMaterial() { setFlag(SupportsRhiShader, true); }
QSGMaterialShader *createShader() const override {
if (flags().testFlag(RhiShaderWanted))
- return new SpriteMaterialRhiShader;
+ return new ParticleSpriteMaterialRhiShader;
else
- return new SpriteMaterialShader;
+ return new ParticleSpriteMaterialShader;
}
QSGMaterialType *type() const override { return &m_type; }
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp
index 86e178d568..04650ab979 100644
--- a/src/qml/jsruntime/qv4engine.cpp
+++ b/src/qml/jsruntime/qv4engine.cpp
@@ -1512,12 +1512,35 @@ static QVariant toVariant(QV4::ExecutionEngine *e, const QV4::Value &value, int
return QVariant::fromValue(QV4::JsonObject::toJsonArray(a));
}
+ QVariant retn;
#if QT_CONFIG(qml_sequence_object)
bool succeeded = false;
- QVariant retn = QV4::SequencePrototype::toVariant(value, typeHint, &succeeded);
+ retn = QV4::SequencePrototype::toVariant(value, typeHint, &succeeded);
if (succeeded)
return retn;
#endif
+ retn = QVariant(typeHint, QMetaType::create(typeHint));
+ auto retnAsIterable = retn.value<QtMetaTypePrivate::QSequentialIterableImpl>();
+ if (retnAsIterable._iteratorCapabilities & QtMetaTypePrivate::ContainerIsAppendable) {
+ auto const length = a->getLength();
+ QV4::ScopedValue arrayValue(scope);
+ for (qint64 i = 0; i < length; ++i) {
+ arrayValue = a->get(i);
+ QVariant asVariant = toVariant(e, arrayValue, retnAsIterable._metaType_id, false, visitedObjects);
+ auto originalType = asVariant.userType();
+ bool couldConvert = asVariant.convert(retnAsIterable._metaType_id);
+ if (!couldConvert) {
+ qWarning() << QLatin1String("Could not convert array value at position %1 from %2 to %3")
+ .arg(QString::number(i),
+ QMetaType::typeName(originalType),
+ QMetaType::typeName(retnAsIterable._metaType_id));
+ // create default constructed value
+ asVariant = QVariant(retnAsIterable._metaType_id, nullptr);
+ }
+ retnAsIterable.append(asVariant.constData());
+ }
+ return retn;
+ }
}
if (value.isUndefined())
diff --git a/src/qml/qml/qqmlengine_p.h b/src/qml/qml/qqmlengine_p.h
index ed81e055e5..263c69e2d8 100644
--- a/src/qml/qml/qqmlengine_p.h
+++ b/src/qml/qml/qqmlengine_p.h
@@ -271,8 +271,24 @@ public:
mutable QMutex networkAccessManagerMutex;
+ QQmlGadgetPtrWrapper *valueTypeInstance(int typeIndex)
+ {
+ auto it = cachedValueTypeInstances.find(typeIndex);
+ if (it != cachedValueTypeInstances.end())
+ return *it;
+
+ if (QQmlValueType *valueType = QQmlValueTypeFactory::valueType(typeIndex)) {
+ QQmlGadgetPtrWrapper *instance = new QQmlGadgetPtrWrapper(valueType, q_func());
+ cachedValueTypeInstances.insert(typeIndex, instance);
+ return instance;
+ }
+
+ return nullptr;
+ }
+
private:
QHash<QQmlType, QJSValue> singletonInstances;
+ QHash<int, QQmlGadgetPtrWrapper *> cachedValueTypeInstances;
// These members must be protected by a QQmlEnginePrivate::Locker as they are required by
// the threaded loader. Only access them through their respective accessor methods.
diff --git a/src/qml/qml/qqmlobjectcreator.cpp b/src/qml/qml/qqmlobjectcreator.cpp
index 50e1918b6c..28dd3d4ab4 100644
--- a/src/qml/qml/qqmlobjectcreator.cpp
+++ b/src/qml/qml/qqmlobjectcreator.cpp
@@ -856,12 +856,12 @@ bool QQmlObjectCreator::setPropertyBinding(const QQmlPropertyData *bindingProper
if (stringAt(obj->inheritedTypeNameIndex).isEmpty()) {
QObject *groupObject = nullptr;
- QQmlValueType *valueType = nullptr;
+ QQmlGadgetPtrWrapper *valueType = nullptr;
const QQmlPropertyData *valueTypeProperty = nullptr;
QObject *bindingTarget = _bindingTarget;
if (QQmlValueTypeFactory::isValueType(bindingProperty->propType())) {
- valueType = QQmlValueTypeFactory::valueType(bindingProperty->propType());
+ valueType = QQmlGadgetPtrWrapper::instance(engine, bindingProperty->propType());
if (!valueType) {
recordError(binding->location, tr("Cannot set properties on %1 as it is null").arg(stringAt(binding->propertyNameIndex)));
return false;
diff --git a/src/qml/qml/qqmlproperty.cpp b/src/qml/qml/qqmlproperty.cpp
index 93020661e2..92fb6209af 100644
--- a/src/qml/qml/qqmlproperty.cpp
+++ b/src/qml/qml/qqmlproperty.cpp
@@ -1044,13 +1044,19 @@ QVariant QQmlProperty::read(const QObject *object, const QString &name, QQmlEngi
QVariant QQmlPropertyPrivate::readValueProperty()
{
- if (isValueType()) {
-
- QQmlValueType *valueType = QQmlValueTypeFactory::valueType(core.propType());
- Q_ASSERT(valueType);
- valueType->read(object, core.coreIndex());
- return valueType->metaObject()->property(valueTypeData.coreIndex()).read(valueType);
+ auto doRead = [&](QQmlGadgetPtrWrapper *wrapper) {
+ wrapper->read(object, core.coreIndex());
+ return wrapper->property(valueTypeData.coreIndex()).read(wrapper);
+ };
+ if (isValueType()) {
+ if (QQmlGadgetPtrWrapper *wrapper = QQmlGadgetPtrWrapper::instance(engine, core.propType()))
+ return doRead(wrapper);
+ if (QQmlValueType *valueType = QQmlValueTypeFactory::valueType(core.propType())) {
+ QQmlGadgetPtrWrapper wrapper(valueType, nullptr);
+ return doRead(&wrapper);
+ }
+ return QVariant();
} else if (core.isQList()) {
QQmlListProperty<QObject> prop;
@@ -1183,10 +1189,22 @@ QQmlPropertyPrivate::writeValueProperty(QObject *object,
bool rv = false;
if (valueTypeData.isValid()) {
- QQmlValueType *writeBack = QQmlValueTypeFactory::valueType(core.propType());
- writeBack->read(object, core.coreIndex());
- rv = write(writeBack, valueTypeData, value, context, flags);
- writeBack->write(object, core.coreIndex(), flags);
+ auto doWrite = [&](QQmlGadgetPtrWrapper *wrapper) {
+ wrapper->read(object, core.coreIndex());
+ rv = write(wrapper, valueTypeData, value, context, flags);
+ wrapper->write(object, core.coreIndex(), flags);
+ };
+
+ QQmlGadgetPtrWrapper *wrapper = context
+ ? QQmlGadgetPtrWrapper::instance(context->engine, core.propType())
+ : nullptr;
+ if (wrapper) {
+ doWrite(wrapper);
+ } else if (QQmlValueType *valueType = QQmlValueTypeFactory::valueType(core.propType())) {
+ QQmlGadgetPtrWrapper wrapper(valueType, nullptr);
+ doWrite(&wrapper);
+ }
+
} else {
rv = write(object, core, value, context, flags);
}
diff --git a/src/qml/qml/qqmlvaluetype.cpp b/src/qml/qml/qqmlvaluetype.cpp
index cb3f572e1f..a86564a49a 100644
--- a/src/qml/qml/qqmlvaluetype.cpp
+++ b/src/qml/qml/qqmlvaluetype.cpp
@@ -42,11 +42,11 @@
#include <QtCore/qmutex.h>
#include <private/qqmlglobal_p.h>
#include <QtCore/qdebug.h>
+#include <private/qqmlengine_p.h>
#include <private/qmetaobjectbuilder_p.h>
#if QT_CONFIG(qml_itemmodel)
#include <private/qqmlmodelindexvaluetype_p.h>
#endif
-#include <private/qmetatype_p.h>
Q_DECLARE_METATYPE(QQmlProperty)
@@ -217,61 +217,82 @@ void QQmlValueTypeFactory::registerValueTypes(const char *uri, int versionMajor,
qmlRegisterValueTypeEnums<QQmlEasingValueType>(uri, versionMajor, versionMinor, "Easing");
}
-QQmlValueType::QQmlValueType() :
- _metaObject(nullptr),
- gadgetPtr(nullptr),
- metaType(QMetaType::UnknownType)
+QQmlValueType::QQmlValueType(int typeId, const QMetaObject *gadgetMetaObject)
+ : metaType(typeId)
{
+ QMetaObjectBuilder builder(gadgetMetaObject);
+ dynamicMetaObject = builder.toMetaObject();
+ *static_cast<QMetaObject*>(this) = *dynamicMetaObject;
}
-QQmlValueType::QQmlValueType(int typeId, const QMetaObject *gadgetMetaObject)
- : gadgetPtr(QMetaType::create(typeId))
- , metaType(typeId)
+QQmlValueType::~QQmlValueType()
{
- QObjectPrivate *op = QObjectPrivate::get(this);
- Q_ASSERT(!op->metaObject);
- op->metaObject = this;
+ ::free(dynamicMetaObject);
+}
- QMetaObjectBuilder builder(gadgetMetaObject);
- _metaObject = builder.toMetaObject();
+QQmlGadgetPtrWrapper *QQmlGadgetPtrWrapper::instance(QQmlEngine *engine, int index)
+{
+ return engine ? QQmlEnginePrivate::get(engine)->valueTypeInstance(index) : nullptr;
+}
- *static_cast<QMetaObject*>(this) = *_metaObject;
+QQmlGadgetPtrWrapper::QQmlGadgetPtrWrapper(QQmlValueType *valueType, QObject *parent)
+ : QObject(parent), m_gadgetPtr(valueType->create())
+{
+ QObjectPrivate *d = QObjectPrivate::get(this);
+ Q_ASSERT(!d->metaObject);
+ d->metaObject = valueType;
}
-QQmlValueType::~QQmlValueType()
+QQmlGadgetPtrWrapper::~QQmlGadgetPtrWrapper()
{
- QObjectPrivate *op = QObjectPrivate::get(this);
- Q_ASSERT(op->metaObject == nullptr || op->metaObject == this);
- op->metaObject = nullptr;
- ::free(const_cast<QMetaObject *>(_metaObject));
- metaType.destroy(gadgetPtr);
+ QObjectPrivate *d = QObjectPrivate::get(this);
+ static_cast<const QQmlValueType *>(d->metaObject)->destroy(m_gadgetPtr);
+ d->metaObject = nullptr;
}
-void QQmlValueType::read(QObject *obj, int idx)
+void QQmlGadgetPtrWrapper::read(QObject *obj, int idx)
{
- void *a[] = { gadgetPtr, nullptr };
+ Q_ASSERT(m_gadgetPtr);
+ void *a[] = { m_gadgetPtr, nullptr };
QMetaObject::metacall(obj, QMetaObject::ReadProperty, idx, a);
}
-void QQmlValueType::write(QObject *obj, int idx, QQmlPropertyData::WriteFlags flags)
+void QQmlGadgetPtrWrapper::write(QObject *obj, int idx, QQmlPropertyData::WriteFlags flags)
{
- Q_ASSERT(gadgetPtr);
+ Q_ASSERT(m_gadgetPtr);
int status = -1;
- void *a[] = { gadgetPtr, nullptr, &status, &flags };
+ void *a[] = { m_gadgetPtr, nullptr, &status, &flags };
QMetaObject::metacall(obj, QMetaObject::WriteProperty, idx, a);
}
-QVariant QQmlValueType::value()
+QVariant QQmlGadgetPtrWrapper::value()
+{
+ Q_ASSERT(m_gadgetPtr);
+ return QVariant(metaTypeId(), m_gadgetPtr);
+}
+
+void QQmlGadgetPtrWrapper::setValue(const QVariant &value)
+{
+ Q_ASSERT(m_gadgetPtr);
+ Q_ASSERT(metaTypeId() == value.userType());
+ const QQmlValueType *type = valueType();
+ type->destruct(m_gadgetPtr);
+ type->construct(m_gadgetPtr, value.constData());
+}
+
+int QQmlGadgetPtrWrapper::metaCall(QMetaObject::Call type, int id, void **argv)
{
- Q_ASSERT(gadgetPtr);
- return QVariant(metaType.id(), gadgetPtr);
+ Q_ASSERT(m_gadgetPtr);
+ const QMetaObject *metaObject = valueType();
+ QQmlMetaObject::resolveGadgetMethodOrPropertyIndex(type, &metaObject, &id);
+ metaObject->d.static_metacall(static_cast<QObject *>(m_gadgetPtr), type, id, argv);
+ return id;
}
-void QQmlValueType::setValue(const QVariant &value)
+const QQmlValueType *QQmlGadgetPtrWrapper::valueType() const
{
- Q_ASSERT(metaType.id() == value.userType());
- metaType.destruct(gadgetPtr);
- metaType.construct(gadgetPtr, value.constData());
+ const QObjectPrivate *d = QObjectPrivate::get(this);
+ return static_cast<const QQmlValueType *>(d->metaObject);
}
QAbstractDynamicMetaObject *QQmlValueType::toDynamicMetaObject(QObject *)
@@ -283,12 +304,9 @@ void QQmlValueType::objectDestroyed(QObject *)
{
}
-int QQmlValueType::metaCall(QObject *, QMetaObject::Call type, int _id, void **argv)
+int QQmlValueType::metaCall(QObject *object, QMetaObject::Call type, int _id, void **argv)
{
- const QMetaObject *mo = _metaObject;
- QQmlMetaObject::resolveGadgetMethodOrPropertyIndex(type, &mo, &_id);
- mo->d.static_metacall(reinterpret_cast<QObject*>(gadgetPtr), type, _id, argv);
- return _id;
+ return static_cast<QQmlGadgetPtrWrapper *>(object)->metaCall(type, _id, argv);
}
QString QQmlPointFValueType::toString() const
diff --git a/src/qml/qml/qqmlvaluetype_p.h b/src/qml/qml/qqmlvaluetype_p.h
index 0d581c7be8..29fa999725 100644
--- a/src/qml/qml/qqmlvaluetype_p.h
+++ b/src/qml/qml/qqmlvaluetype_p.h
@@ -54,7 +54,9 @@
#include "qqml.h"
#include "qqmlproperty.h"
#include "qqmlproperty_p.h"
+
#include <private/qqmlnullablevalue_p.h>
+#include <private/qmetatype_p.h>
#include <QtCore/qobject.h>
#include <QtCore/qrect.h>
@@ -63,16 +65,20 @@
QT_BEGIN_NAMESPACE
-class Q_QML_PRIVATE_EXPORT QQmlValueType : public QObject, public QAbstractDynamicMetaObject
+class Q_QML_PRIVATE_EXPORT QQmlValueType : public QAbstractDynamicMetaObject
{
public:
- QQmlValueType();
+ QQmlValueType() : metaType(QMetaType::UnknownType) {}
QQmlValueType(int userType, const QMetaObject *metaObject);
- ~QQmlValueType() override;
- void read(QObject *, int);
- void write(QObject *, int, QQmlPropertyData::WriteFlags flags);
- QVariant value();
- void setValue(const QVariant &);
+ ~QQmlValueType();
+
+ void *create() const { return metaType.create(); }
+ void destroy(void *gadgetPtr) const { metaType.destroy(gadgetPtr); }
+
+ void construct(void *gadgetPtr, const void *copy) const { metaType.construct(gadgetPtr, copy); }
+ void destruct(void *gadgetPtr) const { metaType.destruct(gadgetPtr); }
+
+ int metaTypeId() const { return metaType.id(); }
// ---- dynamic meta object data interface
QAbstractDynamicMetaObject *toDynamicMetaObject(QObject *) override;
@@ -80,12 +86,33 @@ public:
int metaCall(QObject *obj, QMetaObject::Call type, int _id, void **argv) override;
// ----
-private:
- const QMetaObject *_metaObject;
- void *gadgetPtr;
-
public:
QMetaType metaType;
+ QMetaObject *dynamicMetaObject = nullptr;
+};
+
+class Q_QML_PRIVATE_EXPORT QQmlGadgetPtrWrapper : public QObject
+{
+ Q_OBJECT
+public:
+ static QQmlGadgetPtrWrapper *instance(QQmlEngine *engine, int index);
+
+ QQmlGadgetPtrWrapper(QQmlValueType *valueType, QObject *parent);
+ ~QQmlGadgetPtrWrapper();
+
+ void read(QObject *obj, int idx);
+ void write(QObject *obj, int idx, QQmlPropertyData::WriteFlags flags);
+ QVariant value();
+ void setValue(const QVariant &value);
+
+ int metaTypeId() const { return valueType()->metaTypeId(); }
+ int metaCall(QMetaObject::Call type, int id, void **argv);
+ QMetaProperty property(int index) { return valueType()->property(index); }
+
+private:
+ const QQmlValueType *valueType() const;
+
+ void *m_gadgetPtr = nullptr;
};
class Q_QML_PRIVATE_EXPORT QQmlValueTypeFactory
diff --git a/src/qml/qml/qqmlvmemetaobject.cpp b/src/qml/qml/qqmlvmemetaobject.cpp
index ecb86e2f10..c20bc24a49 100644
--- a/src/qml/qml/qqmlvmemetaobject.cpp
+++ b/src/qml/qml/qqmlvmemetaobject.cpp
@@ -289,11 +289,13 @@ bool QQmlInterceptorMetaObject::intercept(QMetaObject::Call c, int id, void **a)
continue;
const int valueIndex = vi->m_propertyIndex.valueTypeIndex();
- int type = QQmlData::get(object)->propertyCache->property(id)->propType();
+ const QQmlData *data = QQmlData::get(object);
+ const int type = data->propertyCache->property(id)->propType();
if (type != QMetaType::UnknownType) {
if (valueIndex != -1) {
- QQmlValueType *valueType = QQmlValueTypeFactory::valueType(type);
+ QQmlGadgetPtrWrapper *valueType = QQmlGadgetPtrWrapper::instance(
+ data->context->engine, type);
Q_ASSERT(valueType);
//
@@ -327,7 +329,7 @@ bool QQmlInterceptorMetaObject::intercept(QMetaObject::Call c, int id, void **a)
// (7) Issue the interceptor call with the new component value.
//
- QMetaProperty valueProp = valueType->metaObject()->property(valueIndex);
+ QMetaProperty valueProp = valueType->property(valueIndex);
QVariant newValue(type, a[0]);
valueType->read(object, id);
@@ -879,9 +881,9 @@ int QQmlVMEMetaObject::metaCall(QObject *o, QMetaObject::Call c, int _id, void *
return -1;
const QQmlPropertyData *pd = targetDData->propertyCache->property(coreIndex);
// Value type property or deep alias
- QQmlValueType *valueType = QQmlValueTypeFactory::valueType(pd->propType());
+ QQmlGadgetPtrWrapper *valueType = QQmlGadgetPtrWrapper::instance(
+ ctxt->engine, pd->propType());
if (valueType) {
-
valueType->read(target, coreIndex);
int rv = QMetaObject::metacall(valueType, c, valueTypePropertyIndex, a);
diff --git a/src/qml/types/qqmlbind.cpp b/src/qml/types/qqmlbind.cpp
index 64c135b392..6d6553259e 100644
--- a/src/qml/types/qqmlbind.cpp
+++ b/src/qml/types/qqmlbind.cpp
@@ -486,9 +486,10 @@ void QQmlBind::eval()
qmlWarning(this)
<< "Not restoring previous value because restoreMode has not been set.\n"
<< "This behavior is deprecated.\n"
- << "You have to import QtQml 2.15 and set the restoreMode of the binding to fix this warning.\n"
+ << "You have to import QtQml 2.15 after any QtQuick imports and set\n"
+ << "the restoreMode of the binding to fix this warning.\n"
<< "In Qt < 6.0 the default is Binding.RestoreBinding.\n"
- << "In Qt >= 6.0 the default is Binding.RestoreBindingOrValue.\n";
+ << "In Qt >= 6.0 the default is Binding.RestoreBindingOrValue.";
}
} else if (d->prevIsVariant) {
if (d->restoreValue) {
@@ -498,7 +499,8 @@ void QQmlBind::eval()
qmlWarning(this)
<< "Not restoring previous value because restoreMode has not been set.\n"
<< "This behavior is deprecated.\n"
- << "You have to import QtQml 2.15 and set the restoreMode of the binding to fix this warning.\n"
+ << "You have to import QtQml 2.15 after any QtQuick imports and set\n"
+ << "the restoreMode of the binding to fix this warning.\n"
<< "In Qt < 6.0 the default is Binding.RestoreBinding.\n"
<< "In Qt >= 6.0 the default is Binding.RestoreBindingOrValue.\n";
}
diff --git a/src/quick/designer/qquickdesignersupportproperties.cpp b/src/quick/designer/qquickdesignersupportproperties.cpp
index c746f55daa..335795acf1 100644
--- a/src/quick/designer/qquickdesignersupportproperties.cpp
+++ b/src/quick/designer/qquickdesignersupportproperties.cpp
@@ -155,8 +155,8 @@ QQuickDesignerSupport::PropertyNameList QQuickDesignerSupportProperties::propert
baseName + QQuickDesignerSupport::PropertyName(metaProperty.name())
+ '.', inspectedObjects));
}
- } else if (QQmlValueTypeFactory::valueType(metaProperty.userType())) {
- QQmlValueType *valueType = QQmlValueTypeFactory::valueType(metaProperty.userType());
+ } else if (QQmlGadgetPtrWrapper *valueType
+ = QQmlGadgetPtrWrapper::instance(qmlEngine(object), metaProperty.userType())) {
valueType->setValue(metaProperty.read(object));
propertyNameList.append(propertyNameListForWritableProperties(valueType,
baseName + QQuickDesignerSupport::PropertyName(metaProperty.name())
@@ -223,8 +223,8 @@ QQuickDesignerSupport::PropertyNameList QQuickDesignerSupportProperties::allProp
+ QQuickDesignerSupport::PropertyName(metaProperty.name())
+ '.', inspectedObjects));
}
- } else if (QQmlValueTypeFactory::valueType(metaProperty.userType())) {
- QQmlValueType *valueType = QQmlValueTypeFactory::valueType(metaProperty.userType());
+ } else if (QQmlGadgetPtrWrapper *valueType
+ = QQmlGadgetPtrWrapper::instance(qmlEngine(object), metaProperty.userType())) {
valueType->setValue(metaProperty.read(object));
propertyNameList.append(baseName + QQuickDesignerSupport::PropertyName(metaProperty.name()));
propertyNameList.append(allPropertyNames(valueType,
diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp
index 8ade5b7e37..27c57e147a 100644
--- a/src/quick/items/qquickflickable.cpp
+++ b/src/quick/items/qquickflickable.cpp
@@ -128,8 +128,13 @@ void QQuickFlickableVisibleArea::updateVisible()
// Vertical
const qreal viewheight = flickable->height();
const qreal maxyextent = -flickable->maxYExtent() + flickable->minYExtent();
- qreal pagePos = (-p->vData.move.value() + flickable->minYExtent()) / (maxyextent + viewheight);
- qreal pageSize = viewheight / (maxyextent + viewheight);
+ const qreal maxYBounds = maxyextent + viewheight;
+ qreal pagePos = 0;
+ qreal pageSize = 0;
+ if (!qFuzzyIsNull(maxYBounds)) {
+ pagePos = (-p->vData.move.value() + flickable->minYExtent()) / maxYBounds;
+ pageSize = viewheight / maxYBounds;
+ }
if (pageSize != m_heightRatio) {
m_heightRatio = pageSize;
@@ -143,8 +148,14 @@ void QQuickFlickableVisibleArea::updateVisible()
// Horizontal
const qreal viewwidth = flickable->width();
const qreal maxxextent = -flickable->maxXExtent() + flickable->minXExtent();
- pagePos = (-p->hData.move.value() + flickable->minXExtent()) / (maxxextent + viewwidth);
- pageSize = viewwidth / (maxxextent + viewwidth);
+ const qreal maxXBounds = maxxextent + viewwidth;
+ if (!qFuzzyIsNull(maxXBounds)) {
+ pagePos = (-p->hData.move.value() + flickable->minXExtent()) / maxXBounds;
+ pageSize = viewwidth / maxXBounds;
+ } else {
+ pagePos = 0;
+ pageSize = 0;
+ }
if (pageSize != m_widthRatio) {
m_widthRatio = pageSize;
diff --git a/src/quick/items/qquicklistview.cpp b/src/quick/items/qquicklistview.cpp
index e1203fc761..e75a4ccd83 100644
--- a/src/quick/items/qquicklistview.cpp
+++ b/src/quick/items/qquicklistview.cpp
@@ -141,6 +141,8 @@ public:
QQuickItemViewAttached *getAttachedObject(const QObject *object) const override;
+ void fixupHeader();
+ void fixupHeaderCompleted();
QQuickListView::Orientation orient;
qreal visiblePos;
qreal averageSize;
@@ -169,6 +171,12 @@ public:
QString nextSection;
qreal overshootDist;
+
+ qreal desiredViewportPosition;
+ qreal fixupHeaderPosition;
+ bool headerNeedsSeparateFixup : 1;
+ bool desiredHeaderVisible : 1;
+
bool correctFlick : 1;
bool inFlickCorrection : 1;
@@ -182,7 +190,9 @@ public:
, highlightPosAnimator(nullptr), highlightWidthAnimator(nullptr), highlightHeightAnimator(nullptr)
, highlightMoveVelocity(400), highlightResizeVelocity(400), highlightResizeDuration(-1)
, sectionCriteria(nullptr), currentSectionItem(nullptr), nextSectionItem(nullptr)
- , overshootDist(0.0), correctFlick(false), inFlickCorrection(false)
+ , overshootDist(0.0), desiredViewportPosition(0.0), fixupHeaderPosition(0.0)
+ , headerNeedsSeparateFixup(false), desiredHeaderVisible(false)
+ , correctFlick(false), inFlickCorrection(false)
{
highlightMoveDuration = -1; //override default value set in base class
}
@@ -1402,6 +1412,31 @@ void QQuickListViewPrivate::updateFooter()
emit q->footerItemChanged();
}
+void QQuickListViewPrivate::fixupHeaderCompleted()
+{
+ headerNeedsSeparateFixup = false;
+ QObjectPrivate::disconnect(&timeline, &QQuickTimeLine::updated, this, &QQuickListViewPrivate::fixupHeader);
+}
+
+void QQuickListViewPrivate::fixupHeader()
+{
+ FxListItemSG *listItem = static_cast<FxListItemSG*>(header);
+ const bool fixingUp = (orient == QQuickListView::Vertical ? vData : hData).fixingUp;
+ if (fixingUp && headerPositioning == QQuickListView::PullBackHeader && visibleItems.count()) {
+ int fixupDura = timeline.duration();
+ if (fixupDura < 0)
+ fixupDura = fixupDuration/2;
+ const int t = timeline.time();
+
+ const qreal progress = qreal(t)/fixupDura;
+ const qreal ultimateHeaderPosition = desiredHeaderVisible ? desiredViewportPosition : desiredViewportPosition - headerSize();
+ const qreal headerPosition = fixupHeaderPosition * (1 - progress) + ultimateHeaderPosition * progress;
+ const qreal viewPos = isContentFlowReversed() ? -position() - size() : position();
+ const qreal clampedPos = qBound(originPosition() - headerSize(), headerPosition, lastPosition() - size());
+ listItem->setPosition(qBound(viewPos - headerSize(), clampedPos, viewPos));
+ }
+}
+
void QQuickListViewPrivate::updateHeader()
{
Q_Q(QQuickListView);
@@ -1419,9 +1454,14 @@ void QQuickListViewPrivate::updateHeader()
if (headerPositioning == QQuickListView::OverlayHeader) {
listItem->setPosition(isContentFlowReversed() ? -position() - size() : position());
} else if (visibleItems.count()) {
+ const bool fixingUp = (orient == QQuickListView::Vertical ? vData : hData).fixingUp;
if (headerPositioning == QQuickListView::PullBackHeader) {
- qreal viewPos = isContentFlowReversed() ? -position() - size() : position();
- qreal clampedPos = qBound(originPosition() - headerSize(), listItem->position(), lastPosition() - headerSize() - size());
+ qreal headerPosition = listItem->position();
+ const qreal viewPos = isContentFlowReversed() ? -position() - size() : position();
+ // Make sure the header is not shown if we absolutely do not have any plans to show it
+ if (fixingUp && !headerNeedsSeparateFixup)
+ headerPosition = viewPos - headerSize();
+ qreal clampedPos = qBound(originPosition() - headerSize(), headerPosition, lastPosition() - size());
listItem->setPosition(qBound(viewPos - headerSize(), clampedPos, viewPos));
} else {
qreal startPos = originPosition();
@@ -1539,13 +1579,46 @@ void QQuickListViewPrivate::fixup(AxisData &data, qreal minExtent, qreal maxExte
bias = -bias;
tempPosition -= bias;
}
- FxViewItem *topItem = snapItemAt(tempPosition+highlightRangeStart);
+
+ qreal snapOffset = 0;
+ qreal overlayHeaderOffset = 0;
+ bool isHeaderWithinBounds = false;
+ if (header) {
+ qreal visiblePartOfHeader = header->position() + header->size() - tempPosition;
+ isHeaderWithinBounds = visiblePartOfHeader > 0;
+ switch (headerPositioning) {
+ case QQuickListView::OverlayHeader:
+ snapOffset = header->size();
+ overlayHeaderOffset = header->size();
+ break;
+ case QQuickListView::InlineHeader:
+ if (isHeaderWithinBounds && tempPosition < originPosition())
+ // For the inline header, we want to snap to the first item
+ // if we're more than halfway down the inline header.
+ // So if we look for an item halfway down of the header
+ snapOffset = header->size() / 2;
+ break;
+ case QQuickListView::PullBackHeader:
+ desiredHeaderVisible = visiblePartOfHeader > header->size()/2;
+ if (qFuzzyCompare(header->position(), tempPosition)) {
+ // header was pulled down; make sure it remains visible and snap items to bottom of header
+ snapOffset = header->size();
+ } else if (desiredHeaderVisible) {
+ // More than 50% of the header is shown. Show it fully.
+ // Scroll the view so the next item snaps to the header.
+ snapOffset = header->size();
+ overlayHeaderOffset = header->size();
+ }
+ break;
+ }
+ }
+ FxViewItem *topItem = snapItemAt(tempPosition + snapOffset + highlightRangeStart);
if (strictHighlightRange && currentItem && (!topItem || (topItem->index != currentIndex && fixupMode == Immediate))) {
// StrictlyEnforceRange always keeps an item in range
updateHighlight();
topItem = currentItem;
}
- FxViewItem *bottomItem = snapItemAt(tempPosition+highlightRangeEnd);
+ FxViewItem *bottomItem = snapItemAt(tempPosition + snapOffset + highlightRangeEnd);
if (strictHighlightRange && currentItem && (!bottomItem || (bottomItem->index != currentIndex && fixupMode == Immediate))) {
// StrictlyEnforceRange always keeps an item in range
updateHighlight();
@@ -1553,27 +1626,92 @@ void QQuickListViewPrivate::fixup(AxisData &data, qreal minExtent, qreal maxExte
}
qreal pos;
bool isInBounds = -position() > maxExtent && -position() <= minExtent;
- if (topItem && (isInBounds || strictHighlightRange)) {
- if (topItem->index == 0 && header && tempPosition+highlightRangeStart < header->position()+header->size()/2 && !strictHighlightRange) {
- pos = isContentFlowReversed() ? - header->position() + highlightRangeStart - size() : header->position() - highlightRangeStart;
+
+ if (header && !topItem && isInBounds) {
+ // We are trying to pull back further than needed
+ switch (headerPositioning) {
+ case QQuickListView::OverlayHeader:
+ pos = startPosition() - overlayHeaderOffset;
+ break;
+ case QQuickListView::InlineHeader:
+ pos = isContentFlowReversed() ? header->size() - size() : header->position();
+ break;
+ case QQuickListView::PullBackHeader:
+ pos = isContentFlowReversed() ? -size() : startPosition();
+ break;
+ }
+ } else if (topItem && (isInBounds || strictHighlightRange)) {
+ if (topItem->index == 0 && header && !hasStickyHeader() && tempPosition+highlightRangeStart < header->position()+header->size()/2 && !strictHighlightRange) {
+ pos = isContentFlowReversed() ? -header->position() + highlightRangeStart - size() : (header->position() - highlightRangeStart + header->size());
} else {
- if (isContentFlowReversed())
- pos = qMax(qMin(-static_cast<FxListItemSG*>(topItem)->itemPosition() + highlightRangeStart - size(), -maxExtent), -minExtent);
- else
- pos = qMax(qMin(static_cast<FxListItemSG*>(topItem)->itemPosition() - highlightRangeStart, -maxExtent), -minExtent);
+ if (header && headerPositioning == QQuickListView::PullBackHeader) {
+ // We pulled down the header. If it isn't pulled all way down, we need to snap
+ // the header.
+ if (qFuzzyCompare(tempPosition, header->position())) {
+ // It is pulled all way down. Scroll-snap the content, but not the header.
+ if (isContentFlowReversed())
+ pos = -static_cast<FxListItemSG*>(topItem)->itemPosition() + highlightRangeStart - size() + snapOffset;
+ else
+ pos = static_cast<FxListItemSG*>(topItem)->itemPosition() - highlightRangeStart - snapOffset;
+ } else {
+ // Header is not pulled all way down, make it completely visible or hide it.
+ // Depends on how much of the header is visible.
+ if (desiredHeaderVisible) {
+ // More than half of the header is visible - show it.
+ // Scroll so that the topItem is aligned to a fully visible header
+ if (isContentFlowReversed())
+ pos = -static_cast<FxListItemSG*>(topItem)->itemPosition() + highlightRangeStart - size() + headerSize();
+ else
+ pos = static_cast<FxListItemSG*>(topItem)->itemPosition() - highlightRangeStart - headerSize();
+ } else {
+ // Less than half is visible - hide the header. Scroll so
+ // that the topItem is aligned to the top of the view
+ if (isContentFlowReversed())
+ pos = -static_cast<FxListItemSG*>(topItem)->itemPosition() + highlightRangeStart - size();
+ else
+ pos = static_cast<FxListItemSG*>(topItem)->itemPosition() - highlightRangeStart;
+ }
+ }
+
+ headerNeedsSeparateFixup = isHeaderWithinBounds || desiredHeaderVisible;
+ if (headerNeedsSeparateFixup) {
+ // We need to animate the header independently if it starts visible or should end as visible,
+ // since the header should not necessarily follow the content.
+ // Store the desired viewport position.
+ // Also store the header position so we know where to animate the header from (fixupHeaderPosition).
+ // We deduce the desired header position from the desiredViewportPosition variable.
+ pos = qBound(-minExtent, pos, -maxExtent);
+ desiredViewportPosition = isContentFlowReversed() ? -pos - size() : pos;
+
+ FxListItemSG *headerItem = static_cast<FxListItemSG*>(header);
+ fixupHeaderPosition = headerItem->position();
+
+ // follow the same fixup timeline
+ QObjectPrivate::connect(&timeline, &QQuickTimeLine::updated, this, &QQuickListViewPrivate::fixupHeader);
+ QObjectPrivate::connect(&timeline, &QQuickTimeLine::completed, this, &QQuickListViewPrivate::fixupHeaderCompleted);
+ }
+ } else if (isContentFlowReversed()) {
+ pos = -static_cast<FxListItemSG*>(topItem)->itemPosition() + highlightRangeStart - size() + overlayHeaderOffset;
+ } else {
+ pos = static_cast<FxListItemSG*>(topItem)->itemPosition() - highlightRangeStart - overlayHeaderOffset;
+ }
}
} else if (bottomItem && isInBounds) {
if (isContentFlowReversed())
- pos = qMax(qMin(-static_cast<FxListItemSG*>(bottomItem)->itemPosition() + highlightRangeEnd - size(), -maxExtent), -minExtent);
+ pos = -static_cast<FxListItemSG*>(bottomItem)->itemPosition() + highlightRangeEnd - size() + overlayHeaderOffset;
else
- pos = qMax(qMin(static_cast<FxListItemSG*>(bottomItem)->itemPosition() - highlightRangeEnd, -maxExtent), -minExtent);
+ pos = static_cast<FxListItemSG*>(bottomItem)->itemPosition() - highlightRangeEnd - overlayHeaderOffset;
} else {
QQuickItemViewPrivate::fixup(data, minExtent, maxExtent);
return;
}
+ pos = qBound(-minExtent, pos, -maxExtent);
qreal dist = qAbs(data.move + pos);
- if (dist > 0) {
+ if (dist >= 0) {
+ // Even if dist == 0 we still start the timeline, because we use the same timeline for
+ // moving the header. And we might need to move the header while the content does not
+ // need moving
timeline.reset(data.move);
if (fixupMode != Immediate) {
timeline.move(data.move, -pos, QEasingCurve(QEasingCurve::InOutQuad), fixupDuration/2);
diff --git a/src/quick/items/qquickshadereffectsource.cpp b/src/quick/items/qquickshadereffectsource.cpp
index f9f3e5cfa3..b298ed74da 100644
--- a/src/quick/items/qquickshadereffectsource.cpp
+++ b/src/quick/items/qquickshadereffectsource.cpp
@@ -161,10 +161,6 @@ public:
\l sourceItem while still handling input. For this, you can use
the \l hideSource property.
- \note If \l sourceItem is a \l Rectangle with border, by default half the
- border width falls outside the texture. To get the whole border, you can
- extend the \l sourceRect.
-
\note The ShaderEffectSource relies on FBO multisampling support
to antialias edges. If the underlying hardware does not support this,
which is the case for most embedded graphics chips, edges rendered
diff --git a/tests/auto/qml/qqmlecmascript/data/sequenceConversion.write.error.qml b/tests/auto/qml/qqmlecmascript/data/sequenceConversion.write.error.qml
index 75beafd1ee..c2c8c1b52b 100644
--- a/tests/auto/qml/qqmlecmascript/data/sequenceConversion.write.error.qml
+++ b/tests/auto/qml/qqmlecmascript/data/sequenceConversion.write.error.qml
@@ -12,7 +12,7 @@ Item {
function performTest() {
// we have NOT registered QList<QPoint> as a type
- var pointList = [ Qt.point(7,7), Qt.point(8,8), Qt.point(9,9) ];
+ var pointList = [ Qt.point(7,7), "hello world", Qt.point(8,8), Qt.point(9,9) ];
msco.pointListProperty = pointList; // error.
}
}
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
index 558647e17a..2a1457d818 100644
--- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
+++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
@@ -5823,13 +5823,12 @@ void tst_qqmlecmascript::sequenceConversionWrite()
MySequenceConversionObject *seq = object->findChild<MySequenceConversionObject*>("msco");
QVERIFY(seq != nullptr);
- // we haven't registered QList<QPoint> as a sequence type, so writing shouldn't work.
- QString warningOne = qmlFile.toString() + QLatin1String(":16: Error: Cannot assign QJSValue to QList<QPoint>");
- QTest::ignoreMessage(QtWarningMsg, warningOne.toLatin1().constData());
-
+ // Behavior change in 5.14: due to added auto-magical conversions, it is possible to assign to
+ // QList<QPoint>, even though it is not a registered sequence type
+ QTest::ignoreMessage(QtMsgType::QtWarningMsg, QRegularExpression("Could not convert array value at position 1 from QString to QPoint"));
QMetaObject::invokeMethod(object, "performTest");
- QList<QPoint> pointList; pointList << QPoint(1, 2) << QPoint(3, 4) << QPoint(5, 6); // original values, shouldn't have changed
+ QList<QPoint> pointList; pointList << QPoint(7, 7) << QPoint(0,0) << QPoint(8, 8) << QPoint(9, 9); // original values, shouldn't have changed
QCOMPARE(seq->pointListProperty(), pointList);
delete object;
diff --git a/tests/auto/qml/qqmllanguage/data/arrayToContainer.qml b/tests/auto/qml/qqmllanguage/data/arrayToContainer.qml
new file mode 100644
index 0000000000..ee400eb41f
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/arrayToContainer.qml
@@ -0,0 +1,7 @@
+import QtQml 2.14
+import qt.test 1.0
+
+TestItem {
+ property var vector
+ positions: vector
+}
diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
index 5966831183..4f2e203ec2 100644
--- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
+++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
@@ -324,6 +324,8 @@ private slots:
void listContainingDeletedObject();
void overrideSingleton();
+ void arrayToContainer();
+
private:
QQmlEngine engine;
QStringList defaultImportPathList;
@@ -5640,6 +5642,31 @@ void tst_qqmllanguage::nonExistingInlineComponent()
QCOMPARE(error.column(), column);
}
+class TestItem : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY( QVector<QPointF> positions MEMBER m_points )
+
+public:
+ TestItem() = default;
+ QVector< QPointF > m_points;
+};
+
+
+Q_DECLARE_METATYPE(QVector<QPointF>);
+void tst_qqmllanguage::arrayToContainer()
+{
+ QQmlEngine engine;
+ qmlRegisterType<TestItem>("qt.test", 1, 0, "TestItem");
+ QVector<QPointF> points { QPointF (2.0, 3.0) };
+ engine.rootContext()->setContextProperty("test", QVariant::fromValue(points));
+ QQmlComponent component(&engine, testFileUrl("arrayToContainer.qml"));
+ VERIFY_ERRORS(0);
+ QScopedPointer<TestItem> root(qobject_cast<TestItem *>(component.createWithInitialProperties( {{"vector", QVariant::fromValue(points)}} )));
+ QVERIFY(root);
+ QCOMPARE(root->m_points.at(0), QPointF (2.0, 3.0) );
+}
+
QTEST_MAIN(tst_qqmllanguage)
#include "tst_qqmllanguage.moc"
diff --git a/tests/auto/quick/qquickflickable/data/visibleAreaBinding.qml b/tests/auto/quick/qquickflickable/data/visibleAreaBinding.qml
new file mode 100644
index 0000000000..6f7bc89793
--- /dev/null
+++ b/tests/auto/quick/qquickflickable/data/visibleAreaBinding.qml
@@ -0,0 +1,38 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.14
+
+Flickable {
+ id: flickable
+ // Deliberately has no size set.
+
+ Text {
+ text: flickable.visibleArea.xPosition
+ }
+}
diff --git a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
index 5364530ca8..f3659290eb 100644
--- a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
+++ b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
@@ -205,6 +205,7 @@ private slots:
void overshoot_reentrant();
void synchronousDrag_data();
void synchronousDrag();
+ void visibleAreaBinding();
private:
void flickWithTouch(QQuickWindow *window, const QPoint &from, const QPoint &to);
@@ -2540,6 +2541,16 @@ void tst_qquickflickable::synchronousDrag()
QTest::touchEvent(window, touchDevice).release(0, p5, window);
}
+// QTBUG-81098: tests that a binding to visibleArea doesn't result
+// in a division-by-zero exception (when exceptions are enabled).
+void tst_qquickflickable::visibleAreaBinding()
+{
+ QScopedPointer<QQuickView> window(new QQuickView);
+ window->setSource(testFileUrl("visibleAreaBinding.qml"));
+ QTRY_COMPARE(window->status(), QQuickView::Ready);
+ // Shouldn't crash.
+}
+
QTEST_MAIN(tst_qquickflickable)
#include "tst_qquickflickable.moc"
diff --git a/tests/auto/quick/qquicklistview/data/headerSnapToItem.qml b/tests/auto/quick/qquicklistview/data/headerSnapToItem.qml
new file mode 100644
index 0000000000..1e5a811630
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/headerSnapToItem.qml
@@ -0,0 +1,67 @@
+import QtQuick 2.12
+
+Rectangle {
+
+ width: 240
+ height: 320
+ color: "#ffffff"
+
+ Component {
+ id: myDelegate
+ Rectangle {
+ id: wrapper
+ objectName: "wrapper"
+ width: list.orientation == ListView.Vertical ? 240 : 20
+ height: list.orientation == ListView.Vertical ? 20 : 240
+ border.width: 1
+ border.color: "black"
+ Text {
+ text: index + ":" + (list.orientation == ListView.Vertical ? parent.y : parent.x).toFixed(0)
+ }
+ color: ListView.isCurrentItem ? "lightsteelblue" : "white"
+ }
+ }
+
+ ListView {
+ id: list
+ objectName: "list"
+ focus: true
+ width: 240
+ height: 200
+ clip: true
+ snapMode: ListView.SnapToItem
+ headerPositioning: ListView.OverlayHeader
+ model: 30
+ delegate: myDelegate
+ orientation: ListView.Vertical
+ verticalLayoutDirection: ListView.BottomToTop
+
+ header: Rectangle {
+ width: list.orientation == Qt.Vertical ? 240 : 30
+ height: list.orientation == Qt.Vertical ? 30 : 240
+ objectName: "header";
+ color: "green"
+ z: 11
+ Text {
+ anchors.centerIn: parent
+ text: "header " + (list.orientation == ListView.Vertical ? parent.y : parent.x).toFixed(1)
+ }
+ }
+ }
+
+ Rectangle {
+ color: "red"
+ opacity: 0.5
+ width: txt.implicitWidth + 50
+ height: txt.implicitHeight
+ anchors.bottom: parent.bottom
+ anchors.right: parent.right
+
+ Text {
+ id: txt
+ anchors.centerIn: parent
+ text: "header position: " + (list.orientation == ListView.Vertical ? list.headerItem.y : list.headerItem.x).toFixed(1)
+ + "\ncontent position: " + (list.orientation == ListView.Vertical ? list.contentY : list.contentX).toFixed(1)
+ }
+ }
+}
diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
index 9a8dfee9d2..45d16cc415 100644
--- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
+++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
@@ -30,6 +30,7 @@
#include <QtCore/QStringListModel>
#include <QtCore/QSortFilterProxyModel>
#include <QtGui/QStandardItemModel>
+#include <QtGui/QStyleHints>
#include <QtQuick/qquickview.h>
#include <QtQuickTest/QtQuickTest>
#include <QtQml/qqmlengine.h>
@@ -185,6 +186,8 @@ private slots:
void creationContext();
void snapToItem_data();
void snapToItem();
+ void headerSnapToItem_data();
+ void headerSnapToItem();
void snapToItemWithSpacing_QTBUG_59852();
void snapOneItemResize_QTBUG_43555();
void snapOneItem_data();
@@ -5412,6 +5415,604 @@ void tst_QQuickListView::snapToItemWithSpacing_QTBUG_59852()
releaseView(window);
}
+static void drag_helper(QWindow *window, QPoint *startPos, const QPoint &delta)
+{
+ QPoint pos = *startPos;
+ int dragDistance = delta.manhattanLength();
+ Q_ASSERT(qAbs(delta.x()) >= 1 || qAbs(delta.y()) >= 1);
+
+ const int stepSize = 8;
+ QPoint unitVector(0, 0);
+ if (delta.x())
+ unitVector.setX(qBound(-1, delta.x(), 1));
+ if (delta.y())
+ unitVector.setY(qBound(-1, delta.y(), 1));
+ QPoint dragStepSize = unitVector * stepSize;
+ int nDragSteps = qAbs(dragDistance/stepSize);
+
+ for (int i = 0 ; i < nDragSteps; ++i) {
+ QTest::mouseMove(window, pos);
+ pos += dragStepSize;
+ }
+ // Move to the final position
+ pos = *startPos + delta;
+ QTest::mouseMove(window, pos);
+ *startPos = pos;
+}
+
+static void dragtwice(QWindow *window, QPoint *startPos, const QPoint &delta1, const QPoint &delta2)
+{
+ const int dragThreshold = QGuiApplication::styleHints()->startDragDistance();
+ QPoint &pos = *startPos;
+ QPoint unitVector(0, 0);
+ if (delta1.x())
+ unitVector.setX(qBound(-1, delta1.x(), 1));
+ if (delta1.y())
+ unitVector.setY(qBound(-1, delta1.y(), 1));
+
+ // go just beyond the drag theshold
+ drag_helper(window, &pos, unitVector * (dragThreshold + 1));
+ drag_helper(window, &pos, unitVector);
+
+ // next drag will actually scroll the listview
+ if (delta1.manhattanLength() >= 1)
+ drag_helper(window, &pos, delta1);
+ if (delta2.manhattanLength() >= 1)
+ drag_helper(window, &pos, delta2);
+}
+
+struct MyListView : public QQuickListView{
+ qreal contentPosition() const
+ {
+ return (orientation() == QQuickListView::Horizontal ? contentX(): contentY());
+ }
+
+ qreal headerPosition() const
+ {
+ return (orientation() == QQuickListView::Horizontal ? headerItem()->x() : headerItem()->y());
+ }
+};
+
+void tst_QQuickListView::headerSnapToItem()
+{
+ QFETCH(QQuickItemView::LayoutDirection, layoutDirection);
+ QFETCH(QQuickListView::HeaderPositioning, headerPositioning);
+ QFETCH(int, firstDragDistance);
+ QFETCH(int, secondDragDistance);
+ QFETCH(int, expectedContentPosition);
+ QFETCH(int, expectedHeaderPosition);
+
+ QQuickView *window = getView();
+ window->setSource(testFileUrl("headerSnapToItem.qml"));
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+
+ MyListView *listview = static_cast<MyListView *>(findItem<QQuickListView>(window->rootObject(), "list"));
+ QVERIFY(listview != nullptr);
+
+ const bool horizontal = layoutDirection < QQuickItemView::VerticalTopToBottom;
+ listview->setOrientation(horizontal ? QQuickListView::Horizontal : QQuickListView::Vertical);
+
+ if (horizontal)
+ listview->setLayoutDirection(static_cast<Qt::LayoutDirection>(layoutDirection));
+ else
+ listview->setVerticalLayoutDirection(static_cast<QQuickItemView::VerticalLayoutDirection>(layoutDirection));
+
+ listview->setHeaderPositioning(headerPositioning);
+ QVERIFY(QQuickTest::qWaitForItemPolished(listview));
+
+ QQuickItem *contentItem = listview->contentItem();
+ QVERIFY(contentItem != nullptr);
+ QQuickItem *header = findItem<QQuickItem>(contentItem, "header");
+ QVERIFY(header != nullptr);
+ QCOMPARE(header, listview->headerItem());
+
+ QPoint startPos = (QPointF(listview->width(), listview->height())/2).toPoint();
+ QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, startPos, 200);
+
+ QPoint firstDragDelta(0, firstDragDistance);
+ QPoint secondDragDelta = QPoint(0, secondDragDistance);
+ if (horizontal) {
+ firstDragDelta = firstDragDelta.transposed();
+ secondDragDelta = secondDragDelta.transposed();
+ }
+
+ dragtwice(window, &startPos, firstDragDelta, secondDragDelta);
+
+ QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, startPos, 200); // Wait 200 ms before we release to avoid trigger a flick
+
+ // wait for the "fixup" animation to finish
+ QTest::qWaitFor([&]()
+ { return !listview->isMoving();}
+ );
+
+ QCOMPARE(listview->contentPosition(), expectedContentPosition);
+ QCOMPARE(listview->headerPosition(), expectedHeaderPosition);
+}
+
+void tst_QQuickListView::headerSnapToItem_data()
+{
+ QTest::addColumn<QQuickItemView::LayoutDirection>("layoutDirection");
+ QTest::addColumn<QQuickListView::HeaderPositioning>("headerPositioning");
+ QTest::addColumn<int>("firstDragDistance");
+ QTest::addColumn<int>("secondDragDistance");
+ QTest::addColumn<int>("expectedContentPosition");
+ QTest::addColumn<int>("expectedHeaderPosition");
+
+ // --------------------
+ // InlineHeader TopToBottom
+ QTest::newRow("InlineHeader TopToBottom -10") << QQuickItemView::VerticalTopToBottom
+ << QQuickListView::InlineHeader
+ << -10 << 0
+ << -30 << -30;
+
+ QTest::newRow("InlineHeader TopToBottom -14") << QQuickItemView::VerticalTopToBottom
+ << QQuickListView::InlineHeader
+ << -14 << 0
+ << -30 << -30;
+
+ QTest::newRow("InlineHeader TopToBottom -16") << QQuickItemView::VerticalTopToBottom
+ << QQuickListView::InlineHeader
+ << -16 << 0
+ << 0 << -30;
+
+ QTest::newRow("InlineHeader TopToBottom -30") << QQuickItemView::VerticalTopToBottom
+ << QQuickListView::InlineHeader
+ << -30 << 0
+ << 0 << -30;
+
+ QTest::newRow("InlineHeader TopToBottom -39") << QQuickItemView::VerticalTopToBottom
+ << QQuickListView::InlineHeader
+ << -39 << 0
+ << 0 << -30;
+
+ QTest::newRow("InlineHeader TopToBottom -41") << QQuickItemView::VerticalTopToBottom
+ << QQuickListView::InlineHeader
+ << -41 << 0
+ << 20 << -30;
+
+ QTest::newRow("InlineHeader TopToBottom -65+10") << QQuickItemView::VerticalTopToBottom
+ << QQuickListView::InlineHeader
+ << -65 << 10
+ << 20 << -30;
+
+ // --------------------
+ // InlineHeader BottomToTop
+ QTest::newRow("InlineHeader BottomToTop +10") << QQuickItemView::VerticalBottomToTop
+ << QQuickListView::InlineHeader
+ << 10 << 0
+ << -170 << 0;
+
+ QTest::newRow("InlineHeader BottomToTop +14") << QQuickItemView::VerticalBottomToTop
+ << QQuickListView::InlineHeader
+ << 14 << 0
+ << -170 << 0;
+
+ QTest::newRow("InlineHeader BottomToTop +16") << QQuickItemView::VerticalBottomToTop
+ << QQuickListView::InlineHeader
+ << 16 << 0
+ << -200 << 0;
+
+ QTest::newRow("InlineHeader BottomToTop +30") << QQuickItemView::VerticalBottomToTop
+ << QQuickListView::InlineHeader
+ << 30 << 0
+ << -200 << 0;
+
+ QTest::newRow("InlineHeader BottomToTop +39") << QQuickItemView::VerticalBottomToTop
+ << QQuickListView::InlineHeader
+ << 39 << 0
+ << -200 << 0;
+
+ QTest::newRow("InlineHeader BottomToTop +41") << QQuickItemView::VerticalBottomToTop
+ << QQuickListView::InlineHeader
+ << 41 << 0
+ << -220 << 0;
+
+ QTest::newRow("InlineHeader BottomToTop +65-10") << QQuickItemView::VerticalBottomToTop
+ << QQuickListView::InlineHeader
+ << 65 << -10
+ << -220 << 0;
+
+ // --------------------
+ // InlineHeader LeftToRight
+ QTest::newRow("InlineHeader LeftToRight -10") << QQuickItemView::LeftToRight
+ << QQuickListView::InlineHeader
+ << -10 << 0
+ << -30 << -30;
+
+ QTest::newRow("InlineHeader LeftToRight -14") << QQuickItemView::LeftToRight
+ << QQuickListView::InlineHeader
+ << -14 << 0
+ << -30 << -30;
+
+ QTest::newRow("InlineHeader LeftToRight -16") << QQuickItemView::LeftToRight
+ << QQuickListView::InlineHeader
+ << -16 << 0
+ << 0 << -30;
+
+ QTest::newRow("InlineHeader LeftToRight -30") << QQuickItemView::LeftToRight
+ << QQuickListView::InlineHeader
+ << -30 << 0
+ << 0 << -30;
+
+ QTest::newRow("InlineHeader LeftToRight -39") << QQuickItemView::LeftToRight
+ << QQuickListView::InlineHeader
+ << -39 << 0
+ << 0 << -30;
+
+ QTest::newRow("InlineHeader LeftToRight -41") << QQuickItemView::LeftToRight
+ << QQuickListView::InlineHeader
+ << -41 << 0
+ << 20 << -30;
+
+ QTest::newRow("InlineHeader LeftToRight -65+10") << QQuickItemView::LeftToRight
+ << QQuickListView::InlineHeader
+ << -65 << 10
+ << 20 << -30;
+
+ // --------------------
+ // InlineHeader RightToLeft
+ QTest::newRow("InlineHeader RightToLeft +10") << QQuickItemView::RightToLeft
+ << QQuickListView::InlineHeader
+ << 10 << 0
+ << -210 << 0;
+
+ QTest::newRow("InlineHeader RightToLeft +14") << QQuickItemView::RightToLeft
+ << QQuickListView::InlineHeader
+ << 14 << 0
+ << -210 << 0;
+
+ QTest::newRow("InlineHeader RightToLeft +16") << QQuickItemView::RightToLeft
+ << QQuickListView::InlineHeader
+ << 16 << 0
+ << -240 << 0;
+
+ QTest::newRow("InlineHeader RightToLeft +30") << QQuickItemView::RightToLeft
+ << QQuickListView::InlineHeader
+ << 30 << 0
+ << -240 << 0;
+
+ QTest::newRow("InlineHeader RightToLeft +39") << QQuickItemView::RightToLeft
+ << QQuickListView::InlineHeader
+ << 39 << 0
+ << -240 << 0;
+
+ QTest::newRow("InlineHeader RightToLeft +41") << QQuickItemView::RightToLeft
+ << QQuickListView::InlineHeader
+ << 41 << 0
+ << -260 << 0;
+
+ QTest::newRow("InlineHeader RightToLeft +65-10") << QQuickItemView::RightToLeft
+ << QQuickListView::InlineHeader
+ << 65 << -10
+ << -260 << 0;
+
+ // --------------------
+ // OverlayHeader TopToBottom
+ QTest::newRow("OverlayHeader TopToBottom +9") << QQuickItemView::VerticalTopToBottom
+ << QQuickListView::OverlayHeader
+ << 9 << 0
+ << -30 << -30;
+
+ QTest::newRow("OverlayHeader TopToBottom -9") << QQuickItemView::VerticalTopToBottom
+ << QQuickListView::OverlayHeader
+ << -9 << 0
+ << -30 << -30;
+
+ QTest::newRow("OverlayHeader TopToBottom -11") << QQuickItemView::VerticalTopToBottom
+ << QQuickListView::OverlayHeader
+ << -11 << 0
+ << -10 << -10;
+
+ QTest::newRow("OverlayHeader TopToBottom -29") << QQuickItemView::VerticalTopToBottom
+ << QQuickListView::OverlayHeader
+ << -29 << 0
+ << -10 << -10;
+
+ QTest::newRow("OverlayHeader TopToBottom -31") << QQuickItemView::VerticalTopToBottom
+ << QQuickListView::OverlayHeader
+ << -31 << 0
+ << 10 << 10;
+
+ // --------------------
+ // OverlayHeader BottomToTop
+ QTest::newRow("OverlayHeader BottomToTop -9") << QQuickItemView::VerticalBottomToTop
+ << QQuickListView::OverlayHeader
+ << -9 << 0
+ << -170 << 0;
+
+ QTest::newRow("OverlayHeader BottomToTop +9") << QQuickItemView::VerticalBottomToTop
+ << QQuickListView::OverlayHeader
+ << 9 << 0
+ << -170 << 0;
+
+ QTest::newRow("OverlayHeader BottomToTop +11") << QQuickItemView::VerticalBottomToTop
+ << QQuickListView::OverlayHeader
+ << 11 << 0
+ << -190 << -20;
+
+ QTest::newRow("OverlayHeader BottomToTop +29") << QQuickItemView::VerticalBottomToTop
+ << QQuickListView::OverlayHeader
+ << 29 << 0
+ << -190 << -20;
+
+ QTest::newRow("OverlayHeader BottomToTop +31") << QQuickItemView::VerticalBottomToTop
+ << QQuickListView::OverlayHeader
+ << 31 << 0
+ << -210 << -40;
+
+ // --------------------
+ // OverlayHeader LeftToRight
+ QTest::newRow("OverlayHeader LeftToRight +9") << QQuickItemView::LeftToRight
+ << QQuickListView::OverlayHeader
+ << 9 << 0
+ << -30 << -30;
+
+ QTest::newRow("OverlayHeader LeftToRight -9") << QQuickItemView::LeftToRight
+ << QQuickListView::OverlayHeader
+ << -9 << 0
+ << -30 << -30;
+
+ QTest::newRow("OverlayHeader LeftToRight -11") << QQuickItemView::LeftToRight
+ << QQuickListView::OverlayHeader
+ << -11 << 0
+ << -10 << -10;
+
+ QTest::newRow("OverlayHeader LeftToRight -29") << QQuickItemView::LeftToRight
+ << QQuickListView::OverlayHeader
+ << -29 << 0
+ << -10 << -10;
+
+ QTest::newRow("OverlayHeader LeftToRight -31") << QQuickItemView::LeftToRight
+ << QQuickListView::OverlayHeader
+ << -31 << 0
+ << 10 << 10;
+
+ // --------------------
+ // OverlayHeader RightToLeft
+ QTest::newRow("OverlayHeader RightToLeft -9") << QQuickItemView::RightToLeft
+ << QQuickListView::OverlayHeader
+ << -9 << 0
+ << -210 << 0;
+
+ QTest::newRow("OverlayHeader RightToLeft +9") << QQuickItemView::RightToLeft
+ << QQuickListView::OverlayHeader
+ << 9 << 0
+ << -210 << 0;
+
+ QTest::newRow("OverlayHeader RightToLeft +11") << QQuickItemView::RightToLeft
+ << QQuickListView::OverlayHeader
+ << 11 << 0
+ << -230 << -20;
+
+ QTest::newRow("OverlayHeader RightToLeft +29") << QQuickItemView::RightToLeft
+ << QQuickListView::OverlayHeader
+ << 29 << 0
+ << -230 << -20;
+
+ QTest::newRow("OverlayHeader RightToLeft +31") << QQuickItemView::RightToLeft
+ << QQuickListView::OverlayHeader
+ << 31 << 0
+ << -250 << -40;
+
+ // --------------------
+ // PullbackHeader TopToBottom
+ QTest::newRow("PullbackHeader TopToBottom -2") << QQuickItemView::VerticalTopToBottom
+ << QQuickListView::PullBackHeader
+ << -2 << 0
+ << -30 << -30;
+
+ QTest::newRow("PullbackHeader TopToBottom -10") << QQuickItemView::VerticalTopToBottom
+ << QQuickListView::PullBackHeader
+ << -10 << 0
+ << -30 << -30;
+
+ QTest::newRow("PullbackHeader TopToBottom -11") << QQuickItemView::VerticalTopToBottom
+ << QQuickListView::PullBackHeader
+ << -11 << 0
+ << -10 << -10;
+
+ QTest::newRow("PullbackHeader TopToBottom -14") << QQuickItemView::VerticalTopToBottom
+ << QQuickListView::PullBackHeader
+ << -14 << 0
+ << -10 << -10;
+
+ QTest::newRow("PullbackHeader TopToBottom -16") << QQuickItemView::VerticalTopToBottom
+ << QQuickListView::PullBackHeader
+ << -16 << 0
+ << 0 << -30;
+
+ QTest::newRow("PullbackHeader TopToBottom -20") << QQuickItemView::VerticalTopToBottom
+ << QQuickListView::PullBackHeader
+ << -20 << 0
+ << 0 << -30;
+
+ QTest::newRow("PullbackHeader TopToBottom -65+10") << QQuickItemView::VerticalTopToBottom
+ << QQuickListView::PullBackHeader
+ << -65 << 10
+ << 20 << -10;
+
+ QTest::newRow("PullbackHeader TopToBottom -65+20") << QQuickItemView::VerticalTopToBottom
+ << QQuickListView::PullBackHeader
+ << -65 << 20
+ << 10 << 10;
+
+ // Should move header even if contentY doesn't move (its aligned with top)
+ QTest::newRow("PullbackHeader TopToBottom -55+5") << QQuickItemView::VerticalTopToBottom
+ << QQuickListView::PullBackHeader
+ << -55 << 5
+ << 20 << -10;
+
+ // Should move header even if contentY doesn't move (it's aligned with header)
+ QTest::newRow("PullbackHeader TopToBottom -76+16") << QQuickItemView::VerticalTopToBottom
+ << QQuickListView::PullBackHeader
+ << -76 << 16
+ << 30 << 30;
+
+ // --------------------
+ // PullbackHeader BottomToTop
+ QTest::newRow("PullbackHeader BottomToTop +2") << QQuickItemView::VerticalBottomToTop
+ << QQuickListView::PullBackHeader
+ << +2 << 0
+ << -170 << 0;
+
+ QTest::newRow("PullbackHeader BottomToTop +9") << QQuickItemView::VerticalBottomToTop
+ << QQuickListView::PullBackHeader
+ << +9 << 0
+ << -170 << 0;
+
+ QTest::newRow("PullbackHeader BottomToTop +11") << QQuickItemView::VerticalBottomToTop
+ << QQuickListView::PullBackHeader
+ << +11 << 0
+ << -190 << -20;
+
+ QTest::newRow("PullbackHeader BottomToTop +14") << QQuickItemView::VerticalBottomToTop
+ << QQuickListView::PullBackHeader
+ << +14 << 0
+ << -190 << -20;
+
+ QTest::newRow("PullbackHeader BottomToTop +16") << QQuickItemView::VerticalBottomToTop
+ << QQuickListView::PullBackHeader
+ << +16 << 0
+ << -200 << 0;
+
+ QTest::newRow("PullbackHeader BottomToTop +20") << QQuickItemView::VerticalBottomToTop
+ << QQuickListView::PullBackHeader
+ << +20 << 0
+ << -200 << 0;
+
+ QTest::newRow("PullbackHeader BottomToTop +65-10") << QQuickItemView::VerticalBottomToTop
+ << QQuickListView::PullBackHeader
+ << +65 << -10
+ << -220 << -20;
+
+ QTest::newRow("PullbackHeader BottomToTop +65-20") << QQuickItemView::VerticalBottomToTop
+ << QQuickListView::PullBackHeader
+ << +65 << -20
+ << -210 << -40;
+
+ // Should move header even if contentY doesn't move (it's aligned with top)
+ QTest::newRow("PullbackHeader BottomToTop +55-5") << QQuickItemView::VerticalBottomToTop
+ << QQuickListView::PullBackHeader
+ << 55 << -5
+ << -220 << -20;
+
+ // Should move header even if contentY doesn't move (it's aligned with header)
+ QTest::newRow("PullbackHeader BottomToTop +76-16") << QQuickItemView::VerticalBottomToTop
+ << QQuickListView::PullBackHeader
+ << 76 << -16
+ << -230 << -60;
+
+ // --------------------
+ // PullbackHeader LeftToRight
+ QTest::newRow("PullbackHeader LeftToRight -2") << QQuickItemView::LeftToRight
+ << QQuickListView::PullBackHeader
+ << -2 << 0
+ << -30 << -30;
+
+ QTest::newRow("PullbackHeader LeftToRight -10") << QQuickItemView::LeftToRight
+ << QQuickListView::PullBackHeader
+ << -10 << 0
+ << -30 << -30;
+
+ QTest::newRow("PullbackHeader LeftToRight -11") << QQuickItemView::LeftToRight
+ << QQuickListView::PullBackHeader
+ << -11 << 0
+ << -10 << -10;
+
+ QTest::newRow("PullbackHeader LeftToRight -14") << QQuickItemView::LeftToRight
+ << QQuickListView::PullBackHeader
+ << -14 << 0
+ << -10 << -10;
+
+ QTest::newRow("PullbackHeader LeftToRight -16") << QQuickItemView::LeftToRight
+ << QQuickListView::PullBackHeader
+ << -16 << 0
+ << 0 << -30;
+
+ QTest::newRow("PullbackHeader LeftToRight -20") << QQuickItemView::LeftToRight
+ << QQuickListView::PullBackHeader
+ << -20 << 0
+ << 0 << -30;
+
+ QTest::newRow("PullbackHeader LeftToRight -65+10") << QQuickItemView::LeftToRight
+ << QQuickListView::PullBackHeader
+ << -65 << 10
+ << 20 << -10;
+
+ QTest::newRow("PullbackHeader LeftToRight -65+20") << QQuickItemView::LeftToRight
+ << QQuickListView::PullBackHeader
+ << -65 << 20
+ << 10 << 10;
+
+ // Should move header even if contentX doesn't move (its aligned with top)
+ QTest::newRow("PullbackHeader LeftToRight -55+5") << QQuickItemView::LeftToRight
+ << QQuickListView::PullBackHeader
+ << -55 << 5
+ << 20 << -10;
+
+ // Should move header even if contentX doesn't move (it's aligned with header)
+ QTest::newRow("PullbackHeader LeftToRight -76+16") << QQuickItemView::LeftToRight
+ << QQuickListView::PullBackHeader
+ << -76 << 16
+ << 30 << 30;
+
+ // --------------------
+ // PullbackHeader RightToLeft
+ QTest::newRow("PullbackHeader RightToLeft +2") << QQuickItemView::RightToLeft
+ << QQuickListView::PullBackHeader
+ << +2 << 0
+ << -210 << 0;
+
+ QTest::newRow("PullbackHeader RightToLeft +9") << QQuickItemView::RightToLeft
+ << QQuickListView::PullBackHeader
+ << +9 << 0
+ << -210 << 0;
+
+ QTest::newRow("PullbackHeader RightToLeft +11") << QQuickItemView::RightToLeft
+ << QQuickListView::PullBackHeader
+ << +11 << 0
+ << -230 << -20;
+
+ QTest::newRow("PullbackHeader RightToLeft +14") << QQuickItemView::RightToLeft
+ << QQuickListView::PullBackHeader
+ << +14 << 0
+ << -230 << -20;
+
+ QTest::newRow("PullbackHeader RightToLeft +16") << QQuickItemView::RightToLeft
+ << QQuickListView::PullBackHeader
+ << +16 << 0
+ << -240 << 0;
+
+ QTest::newRow("PullbackHeader RightToLeft +20") << QQuickItemView::RightToLeft
+ << QQuickListView::PullBackHeader
+ << +20 << 0
+ << -240 << 0;
+
+ QTest::newRow("PullbackHeader RightToLeft +65-10") << QQuickItemView::RightToLeft
+ << QQuickListView::PullBackHeader
+ << +65 << -10
+ << -260 << -20;
+
+ QTest::newRow("PullbackHeader RightToLeft +65-20") << QQuickItemView::RightToLeft
+ << QQuickListView::PullBackHeader
+ << +65 << -20
+ << -250 << -40;
+
+ // Should move header even if contentX doesn't move (it's aligned with top)
+ QTest::newRow("PullbackHeader RightToLeft +55-5") << QQuickItemView::RightToLeft
+ << QQuickListView::PullBackHeader
+ << 55 << -5
+ << -260 << -20;
+
+ // Should move header even if contentX doesn't move (it's aligned with header)
+ QTest::newRow("PullbackHeader RightToLeft +76-16") << QQuickItemView::RightToLeft
+ << QQuickListView::PullBackHeader
+ << 76 << -16
+ << -270 << -60;
+
+}
+
void tst_QQuickListView::snapOneItemResize_QTBUG_43555()
{
QScopedPointer<QQuickView> window(createView());
diff --git a/tests/auto/quick/qquickmousearea/BLACKLIST b/tests/auto/quick/qquickmousearea/BLACKLIST
new file mode 100644
index 0000000000..f2cb00225b
--- /dev/null
+++ b/tests/auto/quick/qquickmousearea/BLACKLIST
@@ -0,0 +1,4 @@
+# QTBUG-78153
+[nestedStopAtBounds]
+opensuse-leap
+
diff --git a/tools/qmlcachegen/qtquickcompiler.prf b/tools/qmlcachegen/qtquickcompiler.prf
index 8aac3b9e07..7353dfb17a 100644
--- a/tools/qmlcachegen/qtquickcompiler.prf
+++ b/tools/qmlcachegen/qtquickcompiler.prf
@@ -29,6 +29,7 @@ defineReplace(qmlCacheResourceFileOutputName) {
# Flatten RESOURCES that may contain individual files or objects
load(resources_functions)
qtFlattenResources()
+qtEnsurePluginResourcesCpp()
NEWRESOURCES =
QMLCACHE_RESOURCE_FILES =