Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
5.2.1, 5.3.2
-
None
-
Windows 7 32-bit, Qt installers from Digia, MinGW 4.8
-
fb2710a7f182ffb910f6b121e8bc125a4f61dcdf
Description
Consider the following code. We have a rectangle 16 points width. childAt() counts 17 points.
import QtQuick 2.0 import QtQuick.Window 2.0 Window { visible: true color: "steelblue" Item { id: rect anchors.fill: parent Rectangle { color: "red" x: 0 y: 0 width: 16 height: 10 } } Component.onCompleted: { var found = 0; for(var i = 0;i < 18;i++) { var block = rect.childAt(i, 0); console.log("" + i + ": " + block); if(block !== null) found++; } console.log("Found " + found); } }
Output:
qml: 0: QQuickRectangle(0x2abb2b8) qml: 1: QQuickRectangle(0x2abb2b8) qml: 2: QQuickRectangle(0x2abb2b8) qml: 3: QQuickRectangle(0x2abb2b8) qml: 4: QQuickRectangle(0x2abb2b8) qml: 5: QQuickRectangle(0x2abb2b8) qml: 6: QQuickRectangle(0x2abb2b8) qml: 7: QQuickRectangle(0x2abb2b8) qml: 8: QQuickRectangle(0x2abb2b8) qml: 9: QQuickRectangle(0x2abb2b8) qml: 10: QQuickRectangle(0x2abb2b8) qml: 11: QQuickRectangle(0x2abb2b8) qml: 12: QQuickRectangle(0x2abb2b8) qml: 13: QQuickRectangle(0x2abb2b8) qml: 14: QQuickRectangle(0x2abb2b8) qml: 15: QQuickRectangle(0x2abb2b8) qml: 16: QQuickRectangle(0x2abb2b8) qml: 17: null qml: Found 17
Attachments
For Gerrit Dashboard: QTBUG-41833 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
109505,9 | Determine QQuickItem::childAt() correctly | 5.5 | qt/qtdeclarative | Status: ABANDONED | -1 | 0 |
149790,3 | Determine QQuickItem::childAt() correctly | 5.7 | qt/qtdeclarative | Status: MERGED | +2 | 0 |