Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.2.1, 5.3.2, 5.4.2, 5.5.1, 5.6.3, 5.7.1, 5.8.0, 5.9.3, 5.10.1, 5.11.3, 5.12.4, 5.13.0
-
-
1876bd4215ccf5bbaa6f571177db889ba4bc8eff (qt/qtdeclarative/dev)
Description
If I create a class with a QQmlListProperty and then initialise it with an array in some QML file, then subclass the QML type in a second QML file and try to override the array there, when creating an instance of the child class, the list contains the arrays concatenated instead of the overriding array.
In the attached example, I would expect the list to contain 2 elements instead of 5.
We should make the list replace behavior configurable on a class-by-class base. A Q_CLASSINFO("QML.ListReplaceBehavior", ...) could be added for that. The options would be "AlwaysAppend", "AppendIfDefaultProperty", "Replace". See comments on https://codereview.qt-project.org/c/qt/qtdeclarative/+/280328 . In Qt6 we can actually break binary compatibility. So, adding a property to the list itself is feasible, if it makes sense.
Attachments
Issue Links
- is required for
-
QTBUG-73675 Streamline QML for better toolability and performance
- Open
- relates to
-
QTBUG-77532 Establish a language versioning mechanism for QML
- Closed
-
QTBUG-82443 Value types and Containers in QML
- Closed
For Gerrit Dashboard: QTBUG-77529 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
280328,4 | Add override behaviors to QQmlListProperty | 5.15 | qt/qtdeclarative | Status: ABANDONED | -1 | 0 |
280942,3 | Add QQmlListProperty override behavior example | 5.15 | qt/qtdeclarative | Status: ABANDONED | 0 | 0 |
297881,10 | Add override behaviors to QQmlListProperty | dev | qt/qtdeclarative | Status: MERGED | +2 | 0 |
297882,7 | Add QQmlListProperty override behavior example | dev | qt/qtdeclarative | Status: ABANDONED | 0 | 0 |