Hi. The troubles are:
1) when i move the plot by mouse, it could be moved far away from any needed area. How can i tell Qwt the EXACT plotting zone?
2) when the plot is being dragged and not dropped,only the part, the previously visible part is drawn. How can it be fixed?

Qt Code:
  1. #include <QtGui/QApplication>
  2. #include <QVector>
  3.  
  4. #include <qwt_plot.h>
  5. #include <qwt_plot_curve.h>
  6. #include <qwt_plot_panner.h>
  7.  
  8. #include <qwt_plot_grid.h>
  9. #include <qwt_plot_canvas.h>
  10.  
  11. #define NUM_OF_POINTS 1000
  12. int main(int argc, char *argv[])
  13. {
  14. QApplication a(argc, argv);
  15.  
  16. QwtPlot* megaPlot = new QwtPlot(QwtText("MegaPlot"));
  17. QwtPlotCurve* megaCurve = new QwtPlotCurve("MEGALINE");
  18. double x[NUM_OF_POINTS], y[NUM_OF_POINTS];
  19. for(int i = 0; i < NUM_OF_POINTS; i++)
  20. {
  21. x[i] = i;
  22. y[i] = i*i;
  23. }
  24. megaCurve->setData(x,y,NUM_OF_POINTS);
  25. megaCurve->attach(megaPlot);
  26.  
  27. QwtPlotGrid* megaGrid = new QwtPlotGrid;
  28. megaGrid->enableXMin(true);
  29. megaGrid->enableYMin(true);
  30. megaGrid->attach(megaPlot);
  31.  
  32. megaPlot->resize(640,480);
  33.  
  34. QwtPlotPanner* megaPanner = new QwtPlotPanner(megaPlot->canvas());
  35. megaPanner->setMouseButton(Qt::RightButton);
  36.  
  37. megaPlot->show();
  38. return a.exec();
  39. }
To copy to clipboard, switch view to plain text mode