Problem with creation order with QtGraphs using model via ItemModelBarDataProxy
-
Hi all,
Basically, I get the "Series needs to be created to access data members" and a crash when I execute this code below.
I get that the ListModel is created later than the proxy model`. I just don't get what is the "proper" way to handle this situation?
What am I doing wrong?import QtQuick import QtQuick.Controls import QtGraphs ApplicationWindow { width: 640 height: 480 visible: true title: qsTr("Hello World") ListModel { id: barModel ListElement { name: "Earth"; diameter: 12742 } ListElement { name: "Mars"; diameter: 6779 } ListElement { name: "Jupiter"; diameter: 139820 } ListElement { name: "Venus"; diameter: 12104 } } GraphsView { anchors.fill: parent anchors.margins: 16 axisX: BarCategoryAxis { gridVisible: false subGridVisible: false } axisY: ValueAxis { min: 6000 max: 150000 } BarSeries { ItemModelBarDataProxy { id: secondaryProxy itemModel: barModel rowRole: "name" columnRole: "name" valueRole: "diameter" } // BarSet { // values: [12000, 7000, 140000, 12000] // borderWidth: 2 // color: "#373F26" // borderColor: "#DBEB00" // } } } }
-
Hi,
After a quick look, ItemModelBarDataProxy is for Bars3D that you are not using.
-
What exactly are you trying to achieve ?