PDA

View Full Version : replot in Qwt Zoomer



ruzik
16th September 2011, 18:16
Hellow!, i have this code:

QwtPlotZoomer* zoomer = new QwtPlotZoomer( canvas(),true);
zoomer->setRubberBandPen( QColor( Qt::black ) );
zoomer->setTrackerPen( QColor( Qt::black ) );
zoomer->setMousePattern( QwtEventPattern::MouseSelect2,
Qt::RightButton, Qt::ControlModifier );
zoomer->setMousePattern( QwtEventPattern::MouseSelect3,
Qt::RightButton );
this->setAutoReplot(true);
replot();

In first i have this, because i called replot():
6863
But if i pressed right mouse button or select some areas and back to start area by right mouse button, i get that:
6864
I try use it:
zoomer->setZoomBase(this->rect());

plot->setAutoReplot(true);

connect(zoomer, SIGNAL(zoomed(const QRectF&)), this, SLOT(replot()));

But nothing is working
In advance many thanks for your help!

Uwe
17th September 2011, 20:19
Try to understand, when your axes get initialized like we can see them in your first screenshot. Than take care, that your zoomer gets initialized with these ranges.


zoomer->setZoomBase(this->rect());

Calling setZoomBase without parameter initializes the zoomer with the current scale ranges ( this->rect() is wrong, because it is something else in widget coordinates ).

Uwe

ruzik
22nd September 2011, 18:42
Thank you for your help!