Results 1 to 3 of 3

Thread: How to keep the selection box using QwtPlotPicker, even after rezooming

  1. #1
    Join Date
    Apr 2014
    Posts
    5
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default How to keep the selection box using QwtPlotPicker, even after rezooming

    I have made a custom drawRubberBand method in my custom picker class.

    Qt Code:
    1. class HorizontalPicker : public QwtPlotPicker
    2. {
    3.  
    4. public:
    5. HorizontalPicker(QWidget *canvas): QwtPlotPicker(QwtPlot::xBottom, QwtPlot::yLeft, QwtPlotPicker::VLineRubberBand,
    6. QwtPicker::ActiveOnly, canvas) {}
    7. void drawRubberBand(QPainter *p) const;
    8. };
    To copy to clipboard, switch view to plain text mode 

    The selection box is customized so that it paints a vertically expanded solid box

    Qt Code:
    1. void GraphWindow::HorizontalPicker::drawRubberBand(QPainter *p) const
    2. {
    3. const QRect pRect = pickArea().boundingRect().toRect();
    4. QPolygon poly = selection();
    5. QRect r = QRect(poly.point(0).x(), 2, poly.point(1).x() - poly.point(0).x(), pRect.height() - 2);
    6.  
    7. p->fillRect(r, QBrush(QColor(20, 200, 0, 128)));
    8. }
    To copy to clipboard, switch view to plain text mode 

    This works great, however I would like that the box remained in the plot until a new selection is made or the selection is manually removed. Also the selection should be able to scroll and zoom with the plot showing what of the plot that is selected. How can I add this functionality.

  2. #2
    Join Date
    Dec 2013
    Location
    Toronto, Canada
    Posts
    62
    Thanked 16 Times in 15 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: How to keep the selection box using QwtPlotPicker, even after rezooming

    QwtPlotMarker ...

  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: How to keep the selection box using QwtPlotPicker, even after rezooming

    Insert a QwtPlotShapeItem when the selection is done.

    Uwe

Similar Threads

  1. QwtPlotPicker on stockchart
    By wooosh in forum Qwt
    Replies: 2
    Last Post: 17th February 2014, 10:04
  2. QwtPlotPicker with QwtPlotDirectPainter
    By friendbaby in forum Qwt
    Replies: 1
    Last Post: 12th December 2012, 15:43
  3. QwtPlotPicker
    By carhun in forum Qwt
    Replies: 1
    Last Post: 20th August 2012, 14:12
  4. QwtPlotMarker QwtPlotPicker
    By bss in forum Qwt
    Replies: 1
    Last Post: 15th June 2011, 13:55
  5. Replies: 4
    Last Post: 27th November 2009, 09:59

Tags for this Thread

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.