How can I do mouse click event on graph using QChartView?
-
wrote on 18 Oct 2020, 15:33 last edited by sys1
I created a QChartView on top of a grid layout to draw the graph.(
I referenced the Creator's sample code.)When I click this graph, I want to display the mouse click position on the text label in the main window.
I inherited QChartView and created a ChartView class and defined the mousePressEvent() function, but the mouse click did not work.
Not sure what i am missing
It would be appreciated if you uploaded the example code that can be operated.I'm using C++/Window/Visual Studio 2019/Qt 5.15.1
Thank you
-
I created a QChartView on top of a grid layout to draw the graph.(
I referenced the Creator's sample code.)When I click this graph, I want to display the mouse click position on the text label in the main window.
I inherited QChartView and created a ChartView class and defined the mousePressEvent() function, but the mouse click did not work.
Not sure what i am missing
It would be appreciated if you uploaded the example code that can be operated.I'm using C++/Window/Visual Studio 2019/Qt 5.15.1
Thank you
wrote on 18 Oct 2020, 16:07 last edited byI want to display the mouse click position
Don't know about your
mousePressEvent()
. But when you get it working you might be interested in https://stackoverflow.com/questions/44067831/get-mouse-coordinates-in-qchartviews-axis-system. -
wrote on 19 Oct 2020, 06:05 last edited by
Thank you
But, The mouse press event itself doesn't seem to work.
So I want an example code with a mouse press event action.
-
Thank you
But, The mouse press event itself doesn't seem to work.
So I want an example code with a mouse press event action.
wrote on 19 Oct 2020, 13:29 last edited byWhy not? What is happening? How did you implement it?
1/4