Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.15.0
-
None
-
Tested on Qt 5.15.0, on windows when compiling with MSVC2019 64bits
Description
When generating a PieSeries from a model using the functions clear and append] of PieSeries a warning is generated at the execution.
With this code for example :
import QtQuick 2.15 import QtQuick.Window 2.15 import QtCharts 2.15 import QtQuick.Controls 2.15 Window { visible: true width: 640 height: 480 title: qsTr("Hello World") ListModel { id: exampleModel ListElement { label: "A" value: 2.45 } ListElement { label: "B" value: 3.25 } ListElement { label: "C" value: 1.95 } } ChartView { anchors.fill: parent legend.alignment: Qt.AlignBottom antialiasing: true PieSeries { id: examplePieSeries } QtObject { property var model: exampleModel function refreshPieSeries() { examplePieSeries.clear() let modelLenght = model.count for (var i = 0; i < modelLenght; ++i) { console.log("Before append " + i) console.log("Label : " + model.get(i).label) console.log("Value : " + model.get(i).value) var pieslice = examplePieSeries.append(model.get(i).label, model.get(i).value) console.log("After append " + i) } } Component.onCompleted: { refreshPieSeries() } onModelChanged: { refreshPieSeries() } } } }
The output is :
qml: Before append 0
qml: Label : A
qml: Value : 2.45
qml: After append 0
qml: Before append 1
qml: Label : B
qml: Value : 3.25
qml: After append 1
qml: Before append 2
qml: Label : C
qml: Value : 1.95
qml: After append 2
qml: Before append 0
qml: Label : A
qml: Value : 2.45
QList::insert(): Index out of range.
qml: After append 0
qml: Before append 1
qml: Label : B
qml: Value : 3.25
qml: After append 1
qml: Before append 2
qml: Label : C
qml: Value : 1.95
qml: After append 2