Results 1 to 4 of 4

Thread: QwtPlotMarker confusion

  1. #1
    Join Date
    Aug 2007
    Posts
    275
    Thanks
    28
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default QwtPlotMarker confusion

    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

  2. #2
    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: QwtPlotMarker confusion

    In PointSelection mode the picker emits a selected(const QwtDoublePoint &) signal (not a rect).

    Uwe

  3. #3
    Join Date
    Aug 2007
    Posts
    275
    Thanks
    28
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QwtPlotMarker confusion

    Uwe thanks for the reply but I have modified my instantiation like below but still nothing happen

    Qt Code:
    1. d_picker = new QwtPlotPicker(QwtPlot::xBottom, QwtPlot::yLeft,
    2. QwtPicker::RectSelection | QwtPicker::CornerToCorner|QwtPicker::DragSelection ,
    3. QwtPlotPicker::VLineRubberBand, QwtPicker::ActiveOnly,
    4. this->canvas());
    To copy to clipboard, switch view to plain text mode 

    any more thoughts,

    baray98

  4. #4
    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: QwtPlotMarker confusion

    You also forgot to replot ( or enable auto replotting).

    Uwe

  5. The following user says thank you to Uwe for this useful post:

    baray98 (21st July 2008)

Similar Threads

  1. Replies: 22
    Last Post: 7th December 2007, 10:01
  2. Qtopia Vs Qt/X11 confusion...
    By b1 in forum Qt for Embedded and Mobile
    Replies: 4
    Last Post: 28th November 2007, 17:19
  3. pointer reference confusion
    By sincnarf in forum General Programming
    Replies: 1
    Last Post: 14th October 2007, 14:42
  4. Function confusion
    By KShots in forum General Programming
    Replies: 3
    Last Post: 26th June 2007, 22:56
  5. Qt3 to Qt4 printer setup confusion
    By impeteperry in forum Qt Programming
    Replies: 6
    Last Post: 5th May 2006, 13:40

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.