Results 1 to 2 of 2

Thread: Noobish problems with QwtPlotPanner

  1. #1
    Join Date
    Nov 2008
    Posts
    27
    Qt products
    Qt4
    Platforms
    Windows

    Default Noobish problems with QwtPlotPanner

    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 

  2. #2
    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: Noobish problems with QwtPlotPanner

    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?
    QwtPlot::setAxisScale().
    2) when the plot is being dragged and not dropped,only the part, the previously visible part is drawn. How can it be fixed?
    For simple scenarios replotting might be fast enough for mouse movements, but for many others its way to expensive. That's why the panner grabs the content into a pixmap at the beginning of the pan operation and only replots once at the end.

    If your replots are fast you can implement your own type of panning ( translating mouse movements into axis changes ), but you can't tell QwtPlotPanner to do it for you.

    Uwe

Tags for this Thread

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.