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.