-
Bug
-
Resolution: Fixed
-
P2: Important
-
6.11.0 FF
-
None
-
ce266fbcd (dev), 1b33b8754 (6.10), 2561c5221 (6.9), 4960b1ae7 (tqtc/lts-6.8)
Assume that I have a QML value type myPoint and another type myContainer that holds the points.
The myContainer class has a property points of type QVariantList, and for certain reasons I cannot change it to QList<Point>.
From the QML side, assigning a list<myPoint> to the property works. However, if I create a Q_INVOKABLE method that takes QVariantList and returns myContainer, passing the same list<myPoint> into it fails:
property list<myPoint> points: [ {x: 1, y: 2}, {x: 2, y: 1} ] property myContainer c1: ({ points: root.points }) // works property myContainer c2: Singleton.createContainer(points) // does not work :(
I attached the full project which exposes two value types and a singleton to QML and shows the inconsistent behavior. The debug output shows that in the second case the objects are wrapped in an extra QVariant
For Gerrit Dashboard: QTBUG-139764 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
673076,4 | QtQml: Avoid double-wrapping when converting to QVariantList | dev | qt/qtdeclarative | Status: MERGED | +2 | +1 |
675159,2 | QtQml: Avoid double-wrapping when converting to QVariantList | 6.10 | qt/qtdeclarative | Status: MERGED | +2 | 0 |
675225,2 | QtQml: Avoid double-wrapping when converting to QVariantList | 6.9 | qt/qtdeclarative | Status: MERGED | +2 | 0 |
675367,2 | QtQml: Avoid double-wrapping when converting to QVariantList | tqtc/lts-6.8 | qt/tqtc-qtdeclarative | Status: MERGED | +2 | 0 |