Details
-
Bug
-
Resolution: Done
-
P2: Important
-
4.7.2
-
85554f7f262ff5aae15562b11c6d08bcc03c961f
Description
Run this code and click on the screen:
import QtQuick 1.0 Item { id: root width: 640 height: 480 property list<Rectangle> rects: [ Rectangle { width: 100; height: 100 }, Rectangle { width: 200; height: 100 }, Rectangle { width: 300; height: 100 }, Rectangle { width: 400; height: 100 } ] Item { id: item property list<Rectangle> theRects onTheRectsChanged: { print("New list length: " + theRects.length); if(theRects.length > 0) print("Last item's width: " + theRects[theRects.length-1].width); } } MouseArea { anchors.fill: parent onClicked: item.theRects = root.rects } }
The expected output to the debug console is this:
New list length: 4 Last item's width: 400
But instead the output is:
New list length: 0
New list length: 1
file:///home/mathias/dev/gitorious/mathiasm-qt-components/tools/StretchBench.qml:23: TypeError: Result of expression 'theRects[theRects.length-1]' [null] is not an object.
Attachments
Issue Links
- replaces
-
QTBUG-15176 Property signal handlers of list type
- Closed
For Gerrit Dashboard: QTBUG-16316 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
4388,3 | Fix QDeclarativeListProperty assignment | master | qt/qtdeclarative | Status: MERGED | +2 | 0 |