Results 1 to 2 of 2

Thread: Crosshair on Canvas

  1. #1
    Join Date
    Mar 2011
    Posts
    1
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Symbian S60

    Default Crosshair on Canvas

    Hello community,

    the simple things i need are a vertical- and horizontal line which cross on mouse position. While using QwtPlotPicker i saw that this class has the functionality to do that by using the rubberband. But it´s just visible while the left mousebutton is clicked and not the whole time my mouse is over the canvas.

    hope you can give me a hint if there is a qwt class that provides this functionality

    After searching some hours by google i found a good solution for it ! It works fine!

    thx a lot
    Jens
    Last edited by JSchn88; 16th March 2011 at 13:39.

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

    Default Re: Crosshair on Canvas

    Use Qwt 6:

    Qt Code:
    1. picker = new QwtPlotPicker( QwtPlot::xBottom, QwtPlot::yLeft,
    2. QwtPlotPicker::CrossRubberBand, QwtPicker::AlwaysOn,
    3. plot->canvas() );
    4. picker->setStateMachine(new QwtPickerTrackerMachine());
    5. picker->setRubberBandPen(...);
    6. picker->setRubberBand(QwtPicker::CrossRubberBand);
    To copy to clipboard, switch view to plain text mode 
    Uwe

  3. The following 2 users say thank you to Uwe for this useful post:

    AlekseyK (9th March 2016), JSchn88 (17th March 2011)

Similar Threads

  1. Canvas in QT
    By chandan in forum Newbie
    Replies: 5
    Last Post: 11th April 2011, 04:46
  2. How to manually pan canvas
    By novackb in forum Qwt
    Replies: 4
    Last Post: 18th February 2011, 17:46
  3. Qwt canvas using QGLWidget?
    By alex_sh in forum Qwt
    Replies: 4
    Last Post: 28th January 2011, 10:36
  4. how to save canvas
    By doss in forum Newbie
    Replies: 1
    Last Post: 18th April 2009, 22:15
  5. A crosshair which tracks a displayed curve
    By MrGarbage in forum Qwt
    Replies: 6
    Last Post: 22nd January 2008, 07:32

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.