aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/qml/compiler/qqmlpropertyvalidator.cpp8
-rw-r--r--src/qml/qml/qqmlvmemetaobject_p.h2
-rw-r--r--tests/auto/qml/qqmllanguage/data/groupPropertyInPropertyValueSource.qml11
-rw-r--r--tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp17
4 files changed, 37 insertions, 1 deletions
diff --git a/src/qml/compiler/qqmlpropertyvalidator.cpp b/src/qml/compiler/qqmlpropertyvalidator.cpp
index 9fde6848bb..599e79348d 100644
--- a/src/qml/compiler/qqmlpropertyvalidator.cpp
+++ b/src/qml/compiler/qqmlpropertyvalidator.cpp
@@ -196,7 +196,13 @@ QVector<QQmlCompileError> QQmlPropertyValidator::validateObject(int objectIndex,
}
if (binding->type >= QV4::CompiledData::Binding::Type_Object && (pd || binding->isAttachedProperty())) {
- const QVector<QQmlCompileError> subObjectValidatorErrors = validateObject(binding->value.objectIndex, binding, pd && QQmlValueTypeFactory::metaObjectForMetaType(pd->propType()));
+ const bool populatingValueTypeGroupProperty
+ = pd
+ && QQmlValueTypeFactory::metaObjectForMetaType(pd->propType())
+ && !(binding->flags & QV4::CompiledData::Binding::IsOnAssignment);
+ const QVector<QQmlCompileError> subObjectValidatorErrors
+ = validateObject(binding->value.objectIndex, binding,
+ populatingValueTypeGroupProperty);
if (!subObjectValidatorErrors.isEmpty())
return subObjectValidatorErrors;
}
diff --git a/src/qml/qml/qqmlvmemetaobject_p.h b/src/qml/qml/qqmlvmemetaobject_p.h
index 27e638ceb4..7881240452 100644
--- a/src/qml/qml/qqmlvmemetaobject_p.h
+++ b/src/qml/qml/qqmlvmemetaobject_p.h
@@ -117,6 +117,8 @@ public:
return false;
}
+ // use by tst_qqmllanguage
+ QQmlPropertyValueInterceptor *firstInterceptor() const { return interceptors; }
protected:
int metaCall(QObject *o, QMetaObject::Call c, int id, void **a) override;
bool intercept(QMetaObject::Call c, int id, void **a);
diff --git a/tests/auto/qml/qqmllanguage/data/groupPropertyInPropertyValueSource.qml b/tests/auto/qml/qqmllanguage/data/groupPropertyInPropertyValueSource.qml
new file mode 100644
index 0000000000..579086fa1c
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/groupPropertyInPropertyValueSource.qml
@@ -0,0 +1,11 @@
+import QtQuick 2.0
+
+Rectangle {
+ ColorAnimation on color {
+ id: animation
+ from: "red"
+ to: "darkgray"
+ duration: 250
+ easing.type: Easing.InOutQuad
+ }
+}
diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
index 195a9687a8..6a3418f1ab 100644
--- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
+++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
@@ -38,6 +38,7 @@
#include <QFont>
#include <QQmlFileSelector>
#include <QFileSelector>
+#include <QEasingCurve>
#include <private/qqmlproperty_p.h>
#include <private/qqmlmetatype_p.h>
@@ -283,6 +284,8 @@ private slots:
void thisInQmlScope();
+ void valueTypeGroupPropertiesInBehavior();
+
private:
QQmlEngine engine;
QStringList defaultImportPathList;
@@ -4926,6 +4929,20 @@ void tst_qqmllanguage::thisInQmlScope()
QCOMPARE(o->property("y"), QVariant(42));
}
+void tst_qqmllanguage::valueTypeGroupPropertiesInBehavior()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("groupPropertyInPropertyValueSource.qml"));
+ VERIFY_ERRORS(0);
+ QScopedPointer<QObject> o(component.create());
+ QVERIFY(!o.isNull());
+
+ QObject *animation = qmlContext(o.data())->contextProperty("animation").value<QObject*>();
+ QVERIFY(animation);
+
+ QCOMPARE(animation->property("easing").value<QEasingCurve>().type(), QEasingCurve::InOutQuad);
+}
+
QTEST_MAIN(tst_qqmllanguage)
#include "tst_qqmllanguage.moc"