Wrong widget: canvas != plot.
You have to install an event filter for the canvas - or with Qwt 6.1 you can overload the mouse event handler of it. If you want to keep your code you have to translate the coordinates of the mouse click into coordinates that are relative to the canvas - f.e. with mapToGlobal() and mapFromGlobal() - or simply by subtracting the position of the canvas.
Uwe
lazy_learner (25th May 2013)
yes ,you're right. In the first version of my program. I solved this problem by subtract a certain value , but I don't know why and how it happen.Er.. But how can I know the position of the canvas ?
Use QWidget::pos() or QWidget::geometry() - the canvas is a child of the plot widget.
Uwe
Last edited by Uwe; 26th May 2013 at 20:22.
lazy_learner (26th May 2013)
thank you~you're very helpful~
Bookmarks