Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
6.7
-
None
Description
Consider the following QML code:
import QtQuick import QtQuick.Layouts Item { property list<Item> knownItems: [] property int foo: knownItems[0].Layout.preferredWidth }
qmllint warns
Warning: test.qml:6:23: Layout must be attached to Item elements [Quick.attached-property-type] property int foo: knownItems[0].Layout.preferredWidth ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
However since knownItems is a list of Items knownItems[0] is an Item, so I expect Layout to be available, which it is at runtime. When changing the type from list<Item> to var the warning disappears.
qtdeclarative commit 41a97f06981144ef80a3faf8925753f15c0ff3c6