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?
Code:
#include <QtGui/QApplication>
#include <QVector>
#include <qwt_plot.h>
#include <qwt_plot_curve.h>
#include <qwt_plot_panner.h>
#include <qwt_plot_grid.h>
#include <qwt_plot_canvas.h>
#define NUM_OF_POINTS 1000
int main(int argc, char *argv[])
{
double x[NUM_OF_POINTS], y[NUM_OF_POINTS];
for(int i = 0; i < NUM_OF_POINTS; i++)
{
x[i] = i;
y[i] = i*i;
}
megaCurve->setData(x,y,NUM_OF_POINTS);
megaCurve->attach(megaPlot);
megaGrid->enableXMin(true);
megaGrid->enableYMin(true);
megaGrid->attach(megaPlot);
megaPlot->resize(640,480);
megaPanner->setMouseButton(Qt::RightButton);
megaPlot->show();
return a.exec();
}
Re: Noobish problems with QwtPlotPanner
Quote:
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().
Quote:
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