You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi!
I'm just curious how would it be possible to make Qt-application react on clicks on the chart items?
I.e. when I have a bar chart then I would like to intercept a click on bar's segment in my host Qt application, in order to obtain clicked bar's data (i.e. index and segment where the click has occurred).
There is submitEvent() function in Chart.qml, but how to use it from Qt code?
Thanks!
The text was updated successfully, but these errors were encountered:
Well. Found a solution, maybe not the best one, but it works.
In order to fire itemClickedSignal, I've added to Chart.qml:
Canvas {
id: root
....
// signal is sent when clicked on charts's item (i.e. barchart)
// itemIndex: index of the clicked bar in the dataset
// datasetIndex: index of the clicked bar's segment if any
signal itemClickedSignal(int itemIndex, int datasetIndex)
MouseArea {
...
onClicked: {
submitEvent(mouse, "click");
var element = jsChart.getElementAtEvent(event.mouseEvent)[0];
root.itemClickedSignal(element._index, element._datasetIndex);
}
...
Hi!
I'm just curious how would it be possible to make Qt-application react on clicks on the chart items?
I.e. when I have a bar chart then I would like to intercept a click on bar's segment in my host Qt application, in order to obtain clicked bar's data (i.e. index and segment where the click has occurred).
There is submitEvent() function in Chart.qml, but how to use it from Qt code?
Thanks!
The text was updated successfully, but these errors were encountered: