我想在任何栏都悬停时检索鼠标位置,但无法实现。这是我的qml代码。实际上,我想在鼠标指针旁边显示一个文字,表示悬停的条的百分比值。
ChartView {
property int hovered_bar_idx : -1
anchors {
left : parent.left
right : parent.right
rightMargin : 10
bottom : parent.bottom
}
id : chart
height : 450
title : "Staves Statuses"
legend.alignment: Qt.AlignBottom
antialiasing : true
backgroundColor : "black"
legend.visible : false
BarSeries {
id : mySeries
barWidth: 0.85
axisY : ValueAxis { max : 1.0; min : 0.0; }
axisX : BarCategoryAxis {
id : axis_x;
categories : sys_hardware_display.categories;
gridVisible : false
}
onHovered : {
console.log( "s : " + status + " idx : " + index )
// I want to retrieve position of mouse here.
}
BarSet {
id : stave_values
label : "Staves"
color : "#00FF00"
borderWidth : 0
}
}
}