Results 1 to 2 of 2

Thread: Crosshairs that are always on (Qwt 6.1.2) [SOLVED]

  1. #1
    Join Date
    Nov 2010
    Posts
    47
    Thanks
    7
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Crosshairs that are always on (Qwt 6.1.2) [SOLVED]

    This issue was solved in 2009: http://www.qtcentre.org/threads/1701...2169#post92169, however seems not working in 6.1.2 because of changed API. Any way to activate the rubber band without having to click the mouse in Qwt 6.1.2?

    Tried following code with no luck for now - see no crosshairs:
    Qt Code:
    1. ConstPicker::ConstPicker(QwtPlotCanvas *canvas)
    2. : QwtPlotPicker(QwtPlot::xBottom, QwtPlot::yLeft, canvas)
    3. {
    4. setRubberBand(QwtPlotPicker::CrossRubberBand);
    5. // Light gray, 1 point width, dash line
    6. setRubberBandPen(QPen(QBrush(QColor(Qt::lightGray)), 1, Qt::DashLine));
    7. setRubberBand(QwtPicker::CrossRubberBand);
    8.  
    9. canvas->setMouseTracking(true);
    10. }
    11.  
    12. QwtPickerMachine *ConstPicker::stateMachine(int) const
    13. {
    14. return new QwtPickerTrackerMachine();
    15. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by AlekseyK; 9th March 2016 at 22:59.

  2. #2
    Join Date
    Nov 2010
    Posts
    47
    Thanks
    7
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Crosshairs that are always on (Qwt 6.1.2)

    Found the answer here: http://www.qtcentre.org/threads/3971...409#post182409

    So correct code will be:
    Qt Code:
    1. ConstPicker::ConstPicker(QwtPlotCanvas *canvas)
    2. : QwtPlotPicker(QwtPlot::xBottom, QwtPlot::yLeft,
    3. QwtPlotPicker::CrossRubberBand, QwtPicker::AlwaysOn,
    4. canvas)
    5. {
    6. // Light gray, 1 point width, dash line
    7. setRubberBandPen(QPen(QBrush(QColor(Qt::lightGray)), 1, Qt::DashLine));
    8. setRubberBand(QwtPicker::CrossRubberBand);
    9. setStateMachine(new QwtPickerTrackerMachine());
    10. }
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Replies: 2
    Last Post: 15th June 2021, 16:00
  2. Crosshairs that are always on
    By xburgerhout in forum Qwt
    Replies: 4
    Last Post: 10th February 2009, 12:45

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.