Something like this ?

Qt Code:
  1. class DistancePicker : public QwtPlotPicker
  2. {
  3. public:
  4. DistancePicker( QwtPlotCanvas*);
  5.  
  6. protected:
  7. virtual void drawRubberBand(QPainter*) const;
  8. virtual QwtText trackerText(const QwtDoublePoint& pos) const;
  9. };
  10.  
  11. DistancePicker::DistancePicker(QwtPlotCanvas* canvas):
  12. QwtPlotPicker(canvas),
  13. {
  14. /*
  15.   We don't have a picker for a line, but the rectangle
  16.   selection is also selection of 2 points, so all we
  17.   have to do is to change the rubberband.
  18.   */
  19. setSelectionFlags(QwtPicker::RectSelection);
  20. setRubberBand(PolygonRubberBand);
  21. setTrackerMode(QwtPicker::ActiveOnly);
  22. }
  23.  
  24. void DistancePicker::drawRubberBand(QPainter *painter) const
  25. {
  26. painter->drawPolygon(selection());
  27. }
  28.  
  29. QwtText DistancePicker::trackerText(const QwtDoublePoint &pos) const
  30. {
  31. QwtText text( " selection() as distance string " );
  32.  
  33. QColor bg(Qt::white);
  34. bg.setAlpha(180);
  35. text.setBackgroundBrush(QBrush(bg));
  36. return text;
  37. }
To copy to clipboard, switch view to plain text mode