Results 1 to 5 of 5

Thread: Zooming problem with QwtSymbol::Ellipse

  1. #1
    Join Date
    Dec 2010
    Posts
    10
    Thanks
    2
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Zooming problem with QwtSymbol::Ellipse

    Hi!

    I can't find a solution to solve one problem.

    I draw a plot with a simple curve. What I need is:
    1) to mark every point with a circle (QwtSymbol::Ellipse) and
    2) to provide zooming

    I faced with a problem that after a several zooms I get extra strange points that are not lie on the curve and have unreasonable data.
    Here is a code example:
    Qt Code:
    1. class Plot: public QwtPlot{
    2.  
    3. public:
    4.  
    5. Plot(QWidget * parent = NULL);
    6.  
    7. void drawPlot();
    8.  
    9. private:
    10.  
    11. QwtPlotCurve _curve;
    12.  
    13. QwtPlotZoomer * _zoomer;
    14. };
    15.  
    16. =====================================
    17. Plot::Plot(QWidget *parent) : QwtPlot (parent)
    18. {
    19. _curve.setStyle(QwtPlotCurve::Lines);
    20.  
    21. _curve.setPen(QPen(Qt::black));
    22.  
    23. QwtSymbol sym;
    24.  
    25. sym.setStyle(QwtSymbol::Ellipse);
    26. sym.setPen(QPen(Qt::black));
    27. QBrush brush(Qt::yellow);
    28. sym.setBrush(brush);
    29. sym.setSize(5);
    30.  
    31. _curve.setSymbol(sym);
    32.  
    33. _curve.attach(this);
    34.  
    35. _zoomer = new QwtPlotZoomer (canvas());
    36.  
    37. _zoomer->setSelectionFlags( QwtPicker::DragSelection | QwtPicker::CornerToCorner );
    38.  
    39. QwtDoubleRect rect(0, 0, 3000, 3000);
    40.  
    41. _zoomer->setZoomBase(rect);
    42.  
    43. drawPlot();
    44.  
    45. }
    46.  
    47. void Plot::drawPlot(){
    48.  
    49. QVector<double> x(3000);
    50. QVector<double> y(3000);
    51.  
    52. for (int i = 0; i < 3000; i++)
    53. {
    54. x[i] = i;
    55. y[i] = i;
    56. }
    57.  
    58. _curve.setData(x, y);
    59.  
    60. replot();
    61. }
    To copy to clipboard, switch view to plain text mode 

    I get this only with a QwtSymbol::Ellipse but never with Rect, Diamond or Cross.

    Thanks for any help!

  2. #2
    Join Date
    Dec 2010
    Posts
    10
    Thanks
    2
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Zooming problem with QwtSymbol::Ellipse

    Installation of new qwt software version (qwt-6.0.0-rc5) fixed the problem.

  3. #3
    Join Date
    Nov 2010
    Posts
    142
    Thanks
    24
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Zooming problem with QwtSymbol::Ellipse

    Hi,

    I have qwt-6.0.0-rc5. The symbols are plotted perfectly fine,
    but when I want to zoom I get a segmentation fault.

    Qt Code:
    1.  
    2. sym.setStyle(QwtSymbol::Ellipse);
    3. sym.setPen(QPen(Qt::black));
    4. QBrush brush(Qt::yellow);
    5. sym.setBrush(brush);
    6. sym.setSize(1);
    7.  
    8. continuumCurve->setSymbol(&sym);
    To copy to clipboard, switch view to plain text mode 

  4. #4
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,311
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Zooming problem with QwtSymbol::Ellipse

    In Qwt 6.x the symbol needs to be allocated by new. This is something you can expect from all parameters, that are passed as pointer ( in opposite to references ).

    Uwe

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

    fatecasino (29th March 2011)

  6. #5
    Join Date
    Nov 2010
    Posts
    142
    Thanks
    24
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Zooming problem with QwtSymbol::Ellipse

    thanks, it worked!

    Qt Code:
    1. QwtSymbol *sym = new QwtSymbol;
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. QwtSymbol highlighting?
    By shud in forum Qwt
    Replies: 1
    Last Post: 2nd October 2009, 21:42
  2. Qwt Zooming Problem....urgent
    By Raghaw in forum Qwt
    Replies: 0
    Last Post: 2nd September 2009, 15:12
  3. QT3 to Qt4 port - problem seeing Ellipse etc
    By tanimbar in forum Qt Programming
    Replies: 3
    Last Post: 10th March 2008, 13:44
  4. problem with opengl, zooming, drawpixels, and origin
    By ntp in forum General Programming
    Replies: 0
    Last Post: 22nd February 2008, 21:48
  5. Zooming QCanvas: QCanvasLine problem
    By Pieter from Belgium in forum Qt Programming
    Replies: 1
    Last Post: 4th October 2006, 16:58

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.