Details
-
Bug
-
Resolution: Done
-
P2: Important
-
None
-
5.5.0 RC
-
None
-
Change-Id: I6b0d7ee8ee2d67ca0138eacdf0ad221338f788e4
Description
This happens when adding more attributes to pre-configured path:
import QtQuick 2.4 PathView { width: 200 height: 600 pathItemCount: 7 model: ListModel { ListElement { color: "salmon" } ListElement { color: "seagreen" } ListElement { color: "navy" } ListElement { color: "goldenrod" } } path: Path { startX: width / 2; startY: -100 PathAttribute { name: "BEGIN" } PathLine { relativeX: 0; y: height / 2 } PathAttribute { name: "BEGIN" } PathLine { relativeX: 0; y: height + 100 } PathAttribute { name: "BEGIN" } } delegate: Rectangle { width: 200 height: 200 color: model.color opacity: PathView.transparency } Component { id: attributeComponent PathAttribute {} } function addAttribute(name, values) { var valueIndex = 0 var elements = [] for (var i = 0; i < path.pathElements.length; ++i) { elements.push(path.pathElements[i]) if (path.pathElements[i].name === "BEGIN") { if (values[valueIndex] !== undefined) { var attribute = attributeComponent.createObject(this, { "name": name, "value": values[valueIndex] }) elements.push(attribute) } ++valueIndex } } console.log("??") path.pathElements = elements console.log("!!") } Component.onCompleted: addAttribute("transparency", [0, 1, 0]) }
The problem seems to be related not directly with updating pathElements list, rather than with delegate items creation. I re-set model in order to force re-creation of items (by the way, is there a better way to achieve the same goal?):
var m = model
model = undefined
path.pathElements = elements
model = m
In this case, the same assertion fails but at model = m assignment.
Attachments
For Gerrit Dashboard: QTBUG-46255 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
112775,8 | Clear stringCache explicitly instead of asserting its emptiness. | dev | qt/qtdeclarative | Status: MERGED | +2 | 0 |