Results 1 to 3 of 3

Thread: find nearest QwtPolarItem to a mouse click

  1. #1
    Join Date
    Apr 2016
    Posts
    17
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default find nearest QwtPolarItem to a mouse click

    I have extended QwtPolarItem to add some information to it, e.g., a timestamp. On a QwtPolarPlot, I want to be able to click on one of these items and display its timestamp. I'm using QwtPolarPicker to capture the mouse click. How do I use that to find the nearest QwtPolarItem? Would I be better off using something like the CanvasPicker that is in the event_filter example?

  2. #2
    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: find nearest QwtPolarItem to a mouse click

    Well, you have the position of the mouse click in widget ( canvas ) coordinates. To identify what might be next usually means, that you have to iterate over your items, translate their values into widget coordinates and implement an algo, that decides if the mouse pos matches it. Maybe QwtPicker/QwtPolarPicker are useful for your use case.

    Uwe

  3. #3
    Join Date
    Apr 2016
    Posts
    17
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: find nearest QwtPolarItem to a mouse click

    Thank you. I've started down the path of using the CanvasPicker from the event_filter example. It looks like that will work for me.

Similar Threads

  1. Simulate mouse click
    By Merylin in forum Qt Programming
    Replies: 8
    Last Post: 18th March 2014, 04:27
  2. Replies: 2
    Last Post: 16th July 2012, 13:40
  3. how to find nearest QGraphicsitem
    By dhalbert in forum Qt Programming
    Replies: 2
    Last Post: 30th September 2010, 21:33
  4. How to find the nearest point on a QPainterPath
    By Markus in forum Qt Programming
    Replies: 1
    Last Post: 9th June 2010, 00:18
  5. QTreeView: Find nearest item to mouse pointer
    By squidge in forum Qt Programming
    Replies: 3
    Last Post: 31st October 2009, 21:24

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.