Hey.

I've a plot with a curve and a bunch of markers on it.
When zooming in sometimes I get some random markers apearing.
ufos.jpg

Points with text are added by me, all other points appear from somewhere.

I have no idea why it's happening. Maybe I'm missing some zoomer setting?

Anyway, I've created simple example app to demonstrate the issue:
Qt Code:
  1. //mainwindow.h
  2. #ifndef MAINWINDOW_H
  3. #define MAINWINDOW_H
  4.  
  5. #include <QtGui/QMainWindow>
  6.  
  7. class QwtPlot;
  8.  
  9. class MainWindow : public QMainWindow
  10. {
  11. Q_OBJECT
  12.  
  13. public:
  14. MainWindow(QWidget *parent = 0);
  15. ~MainWindow();
  16.  
  17. private:
  18. void addCurve( void );
  19. void addMarkers( void );
  20.  
  21. QwtPlot* plot;
  22. QwtPlotZoomer* zoomer;
  23.  
  24. QVector<double> x;
  25. QVector<double> y;
  26. };
  27.  
  28. #endif // MAINWINDOW_H
To copy to clipboard, switch view to plain text mode 
Qt Code:
  1. // mainwindow.cpp
  2. #include "mainwindow.h"
  3.  
  4. #include <qwt_plot.h>
  5. #include <qwt_plot_curve.h>
  6. #include <qwt_plot_marker.h>
  7. #include <qwt_symbol.h>
  8. #include <qwt_plot_zoomer.h>
  9.  
  10. MainWindow::MainWindow(QWidget *parent)
  11. : QMainWindow(parent)
  12. {
  13. this->plot = new QwtPlot(this);
  14. this->zoomer = new QwtPlotZoomer(this->plot->canvas());
  15.  
  16. this->addCurve();
  17. this->addMarkers();
  18.  
  19. this->zoomer->setZoomBase();;
  20. this->setCentralWidget(this->plot);
  21. }
  22.  
  23. MainWindow::~MainWindow()
  24. {
  25.  
  26. }
  27.  
  28. void MainWindow::addCurve( void )
  29. {
  30. int count = 20000;
  31.  
  32. for(int i = 0; i < count; ++i)
  33. {
  34. this->x.append(i);
  35. this->y.append(i);
  36. }
  37.  
  38. QwtPlotCurve* curve = new QwtPlotCurve();
  39. curve->setRawData(this->x.constBegin(), this->y.constBegin(), this->x.size());
  40. curve->attach(this->plot);
  41. }
  42.  
  43. void MainWindow::addMarkers( void )
  44. {
  45. int count = 5000;
  46. int step = this->x.size()/count;
  47.  
  48. for(int i = 0; i < count; ++i)
  49. {
  50. int x = i*step;
  51. int y = this->y[x];
  52.  
  53. m->setSymbol(QwtSymbol(QwtSymbol::Ellipse, QBrush(Qt::red), QPen(Qt::red), QSize(5,5)));
  54. m->setValue(x, y);
  55. m->setLabel(QString("%1x%2").arg(x).arg(y));
  56.  
  57. m->attach(this->plot);
  58. }
  59. }
To copy to clipboard, switch view to plain text mode 

Any suggestions how to get rid of that UFOs are welcome.

PS: I'm running w7 64 bit with qt 4.6.3 and qwt 5.2.0.