Results 1 to 3 of 3

Thread: Qwt display coordinates label

  1. #1
    Join Date
    Feb 2012
    Posts
    8
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Qwt display coordinates label

    Hi,

    I've read this thread (from almost three years ago): http://www.qtcentre.org/threads/2659...-QLabel-widget.

    Now, since then, I was wondering if to display the coordinates of the cursor in some sort of label, if I would need to subclass qwtplotpicker, and reimplement the protected trackerText function, or if since then, Qwt 6.0.1 has a better way of doing this.

    If this question has already been answered (I've looked, but you never know), please point me to the question.

    Thanks again for your time.

  2. #2
    Join Date
    Sep 2011
    Location
    Manchester
    Posts
    538
    Thanks
    3
    Thanked 106 Times in 103 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Qwt display coordinates label

    If QwtPicker::trackerText() isn't enough you could install event filter on the canvas and handle the QEvent::MouseMove event.
    In there you'll get screen coordinates which you can translate to world coordinates using QwtPlot::invTransform().
    Now you can display any of those values wherever you want.
    If you need, for example point closest to the cursor along it's y axis, then you need to do some extra calculations but that would be your starting point.

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

    Default Re: Qwt display coordinates label

    Or use the QwtPlotPicker::selected() signals. Guess you want to use point selection in combination with with a QwtPickerTrackerMachine.

    Uwe

  4. The following user says thank you to Uwe for this useful post:

    Jean-Luc (14th February 2012)

Similar Threads

  1. Replies: 5
    Last Post: 3rd March 2016, 16:42
  2. display image and get coordinates
    By ready in forum Newbie
    Replies: 9
    Last Post: 21st March 2011, 13:46
  3. HOW TO DISPLAY A RECTANGLE ON AN IMAGE on a label
    By qt_user in forum Qt Programming
    Replies: 4
    Last Post: 6th August 2010, 16:19
  4. display number on label
    By aj2903 in forum Qt Programming
    Replies: 4
    Last Post: 12th March 2009, 08:24
  5. Display a Label on top of a QGlWidget
    By Lele in forum Qt Programming
    Replies: 3
    Last Post: 4th February 2008, 17:11

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.