Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
6.7.2
-
None
Description
Accessing a ListView attached property from inside a ListView's delegate while a ListView attached property is used within the ListView but outside of the delegate, and the linter's configuration (.qmllint.ini) has AttachedPropertyReuse=warning, results in an attached-property-reuse warning from QML linter.
The following code triggers the warning:
ListView { anchors.fill: parent model: 1 orientation: ListView.Horizontal delegate: Rectangle { width: 200 height: ListView.delayRemove ? 20 : 40 color: ListView.isCurrentItem ? "red" : "blue" } }
The following code doesn't trigger the warning:
ListView { anchors.fill: parent model: 1 orientation: Qt.Horizontal delegate: Rectangle { width: 200 height: ListView.delayRemove ? 20 : 40 color: ListView.isCurrentItem ? "red" : "blue" } }
By setting orientation to use a Qt enumerator, the attached-property-reuse warning isn't triggered. The warning appears to come from the attached property being accessed from different scopes (in and outside the delegate).
I suspect this might be intended behavior, but if this were the case then I would recommend updating ListView's documentation to suggest using Qt namespace enumerators where applicable instead of ListView's to prevent the warning.
Attachments
Gerrit Reviews
For Gerrit Dashboard: QTBUG-126527 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
570369,1 | WIP: Improved attached property reuse logic | dev | qt/qtdeclarative | Status: NEW | -2 | 0 |