Hi,

I was trying to use qwt's plot marker like the code below and I am expecting it to show up everytime i am done selecting with my picker.

Qt Code:
  1. #include <qwt_plot.h>
  2. #include <qwt_plot_picker.h>
  3. #include <qwt_plot_marker.h>
  4.  
  5. //definition
  6. class MyPlot : public QwtPlot
  7. {
  8. Q_OBJECT
  9. public:
  10. MyPlot(QWidget* parent);
  11. virtual ~MyPlot();
  12. protected:
  13. private:
  14. QwtPlotPicker* d_picker;
  15. QwtPlotMarker* d_marker;
  16. private slots:
  17. void showMark(const QwtDoubleRect&);
  18. };
To copy to clipboard, switch view to plain text mode 
Qt Code:
  1. // implementation
  2.  
  3. #include "myplot.h"
  4.  
  5.  
  6. MyPlot::MyPlot(QWidget* parent)
  7. :QwtPlot(parent)
  8. {
  9. //ctor
  10. d_picker = new QwtPlotPicker(QwtPlot::xBottom, QwtPlot::yLeft,
  11. QwtPicker::PointSelection | QwtPicker::DragSelection,
  12. QwtPlotPicker::NoRubberBand, QwtPicker::ActiveOnly,
  13. this->canvas());
  14. d_picker->setRubberBandPen(QColor(Qt::green));
  15. d_picker->setRubberBand(QwtPicker::RectRubberBand);
  16. d_picker->setTrackerPen(QColor(Qt::black));
  17. d_picker->setSelectionFlags(QwtPicker::RectSelection);
  18.  
  19. connect (d_picker,SIGNAL(selected(const QwtDoubleRect&)),
  20. this,SLOT(showMark(const QwtDoubleRect&)));
  21.  
  22.  
  23. d_marker = new QwtPlotMarker();
  24. d_marker->setLineStyle(QwtPlotMarker::NoLine);
  25. d_marker->attach(this);
  26. }
  27.  
  28. MyPlot::~MyPlot()
  29. {
  30. //dtor
  31. }
  32. void MyPlot::showMark(const QwtDoubleRect& rect)
  33. {
  34. d_marker->setValue(rect.topLeft() ) ;
  35. d_marker->setLabel(QwtText("I am here"));
  36. d_marker->show();
  37. }
To copy to clipboard, switch view to plain text mode 

please fix /straigtened me out

baray98