PDA

View Full Version : How to get the x an y corrdinates from mouse postion



bemineni
17th May 2008, 00:21
Hi,

I am trying the realtime_plot example how can I set the
mouseTracking to true so that I can get he mouse postion which can be passed to the Qwtplotpicker to get the trackText and can be outputed to a status bar

But even If I have set the mouse tracking(setMouseTracking(true)) to true in the IncrementalPlot I am not able to get the mouse move event in the virtual event()(Qwtplot) which I have rewritten in incremental plot.

I only able to get this event only when I click the left mouse button and move it.

Please let me know how to get the mouse event even when it is not clicked.

wysota
17th May 2008, 11:11
Mouse tracking has to be enabled for the viewport, I assume QwtPlot has one...

Uwe
17th May 2008, 17:02
With picker->setDisplayMode(QwtPicker::AlwaysOn) the positions is always displayed.

If you want to see that the QwtPlotPicker::moved() signal is emitted - even when the mouse is not pressed - there are many different ways to do it. Probably the most easiest one is to overload QwtPlotPicker::widgetMouseMoveEvent this way:


YourPicker::widgetMouseMoveEvent(QMouseEvent *me)
{
QwtPlotPicker::widgetMouseMoveEvent(me);
emit moved(invTransform(me->pos));
}

HTH,
Uwe