Results 1 to 3 of 3

Thread: How to get the x an y corrdinates from mouse postion

  1. #1
    Join Date
    May 2008
    Posts
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default How to get the x an y corrdinates from mouse postion

    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.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to get the x an y corrdinates from mouse postion

    Mouse tracking has to be enabled for the viewport, I assume QwtPlot has one...

  3. #3
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,312
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How to get the x an y corrdinates from mouse postion

    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:

    Qt Code:
    1. YourPicker::widgetMouseMoveEvent(QMouseEvent *me)
    2. {
    3. QwtPlotPicker::widgetMouseMoveEvent(me);
    4. emit moved(invTransform(me->pos));
    5. }
    To copy to clipboard, switch view to plain text mode 

    HTH,
    Uwe

Similar Threads

  1. mouse moving don't produce mouse events
    By coralbird in forum Qt Programming
    Replies: 1
    Last Post: 13th September 2006, 06:13
  2. Replies: 2
    Last Post: 24th July 2006, 18:36
  3. QStackerWidget and mouse events
    By high_flyer in forum Qt Programming
    Replies: 3
    Last Post: 25th April 2006, 19:25

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.