qmlscene crashed when hover in at a ScatterSeries point
Unsolved
QML and Qt Quick
-
Dear All,
What I want to do is change a point to red when move mouse into an ScatterSeries point, and recovery the point's when move mouse out of the point. To get it, I define an ScatterSeries with id:selectedPointer to show the red point. When mouse hover into an point, append the point to selectedPointer ; while clear selectedPointer when hover out the point.
Here's a strange problem that qmlscene crashes when hover into a ScatterSeries point. I guess that when the selectedPointer is shown, the points lost focuse and call onHovered with state == false. It will crashes when call selectedPointer.clear() in this state. Is there any ideal of resolve this problem?import QtQuick 2.12 import QtQuick.Window 2.12 import QtCharts 2.3 Window { visible: true width: 640 height: 480 title: qsTr("Hello World") property var points_X:[1.51,1.57,2.0,2.55] property var points_Y: [2.51,3.57,4.0,4.55] ChartView{ id: myChart anchors.fill: parent legend{ visible: false } // line curve LineSeries{ id: line } ScatterSeries{ id: points onHovered:{ if (state === true){ console.log("hovered in : x:" + point.x + " y:" + point.y) selectedPointer.clear() selectedPointer.append(point.x,point.y) }else{ console.log("hovered out : x:" + point.x + " y:" + point.y) selectedPointer.clear() } } onPressed: { selectedPointer.clear() selectedPointer.append(point.x,point.y) } } ScatterSeries{ id: selectedPointer color: "red" } Component.onCompleted: { var index console.log("points_X:"+ points_X.length) for(index = 0;index < points_X.length;index++){ line.append(points_X[index],points_Y[index]) points.append(points_X[index],points_Y[index]) console.log("append : "+ points_X[index],points_Y[index]) } selectedPointer.append(points_X[1],points_Y[1]) myChart.axisX().max = 3 myChart.axisY().max = 5 } } }