QML: Reset the binding name when synthesizing components
The binding that creates the element inside of a Component has no name. Pick-to: 6.2 6.3 Fixes: QTBUG-101655 Change-Id: Ib2ff272cff4f21efb588553d55d1e348e2ee5f87 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
This commit is contained in:
parent
cfefda0e00
commit
45dcac12e5
|
@ -861,6 +861,10 @@ void QQmlComponentAndAliasResolver::findAndRegisterImplicitComponents(
|
|||
|
||||
QmlIR::Binding *syntheticBinding = pool->New<QmlIR::Binding>();
|
||||
*syntheticBinding = *binding;
|
||||
|
||||
// The synthetic binding inside Component has no name. It's just "Component { Foo {} }".
|
||||
syntheticBinding->propertyNameIndex = 0;
|
||||
|
||||
syntheticBinding->type = QV4::CompiledData::Binding::Type_Object;
|
||||
QString error = syntheticComponent->appendBinding(syntheticBinding, /*isListBinding*/false);
|
||||
Q_ASSERT(error.isEmpty());
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
import QtQml
|
||||
|
||||
QtObject {
|
||||
component View: QtObject {
|
||||
default property Component delegate
|
||||
}
|
||||
|
||||
component Things : QtObject {
|
||||
property QtObject view: View { delegate: QtObject {} }
|
||||
}
|
||||
|
||||
property Things things: Things {}
|
||||
}
|
|
@ -393,6 +393,7 @@ private slots:
|
|||
void objectAsBroken();
|
||||
void customValueTypes();
|
||||
void valueTypeList();
|
||||
void componentMix();
|
||||
|
||||
private:
|
||||
QQmlEngine engine;
|
||||
|
@ -6892,6 +6893,22 @@ void tst_qqmllanguage::valueTypeList()
|
|||
}
|
||||
}
|
||||
|
||||
void tst_qqmllanguage::componentMix()
|
||||
{
|
||||
QQmlEngine engine;
|
||||
QQmlComponent c(&engine, testFileUrl("componentMix.qml"));
|
||||
QVERIFY2(c.isReady(), qPrintable(c.errorString()));
|
||||
QScopedPointer<QObject> o(c.create());
|
||||
QVERIFY(!o.isNull());
|
||||
QObject *things = qvariant_cast<QObject *>(o->property("things"));
|
||||
QVERIFY(things);
|
||||
QObject *view = qvariant_cast<QObject *>(things->property("view"));
|
||||
QVERIFY(view);
|
||||
QObject *delegate = qvariant_cast<QObject *>(view->property("delegate"));
|
||||
QVERIFY(delegate);
|
||||
QCOMPARE(delegate->metaObject(), &QQmlComponent::staticMetaObject);
|
||||
}
|
||||
|
||||
QTEST_MAIN(tst_qqmllanguage)
|
||||
|
||||
#include "tst_qqmllanguage.moc"
|
||||
|
|
Loading…
Reference in New Issue