Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
6.7
-
None
Description
`QQmlComponent` seems unable to create a component that has a required alias.
Given:
Item {
id: self
property int foo
property alias aliasToFoo: self.foo
required aliasToFoo
}
`aliasToFoo` will appear as a required property and will thus produce an error unless it is initialized.
Nonetheless, trying to set an initial value for it will not actually mark the alias as being set, in turn failing to create the object due to the an uninitialized required property.
For example, creating the component as follows:
component.createWithInitialProperties({{"aliasToFoo", 10}})
Will still produce an error:
Required property aliasToFoo was not initialized
Setting a binding from the QML side will actually work, for example:
aliasToFoo: 42
Will ensure that no error is present, suggesting that the issue might be related to the way `QQmlComponent::createWithInitialProperties` treats initializing aliases.