qwt zoomer: a complete user case scenario?
how should i modify the "bode" example in order to implement the following user case scenario?
- press the zoom button (on)
- zoom in, several times
- press the zoom button off( being satisfied with the zooming so far)
- later I realize that i want to zoom out a bit and press again the zoom button (on)
- zoom out and press the zoom button (off)
- open a new data file and plot a new plot (with axis rescaled)
- repeat steps 1-6 for the new plot
- end
Re: qwt zoomer: a complete user case scenario?
i'm not familiar with the bode example. is that the example with srollbars?
you have to call "SetZoomBase()" after (6). If that does not work, you have to reinstall the zoomer. The first 5 points should work without problems...
1 Attachment(s)
Re: qwt zoomer: a complete user case scenario?
the "bode" example is the very first one that implements the zoomer(see attached screenshot). The main problems are so far:
STEP 3: when you unclick the zoom button, the plot resets to the initial status(totally unzoomed), so I am losing the initial work of zooming into a specific area. This means that I have to find the zooming area in my first go.
I solved this by inserting setZoomBase() to the function that is called with the zoom button:
Code:
void my2dPlot::enableZoomMode(bool on)
{
myPlot->replot();//i am not sure if this is actually needed
m_zoomer->setZoomBase();
m_zoomer->setEnabled(on);
m_zoomer->zoom(0);
d_picker->setEnabled(!on);
}
The good thing now
when I unclick the zoom button the plot stays as it is (zoomed).
The bad thing now
when I unclick the zoom button and then click again to correct my zooming area, I cannot go back (unzoom), I can only zoom further in (or pan)
STEP 6: solved it using UWE recommendations and adding
Code:
myPlot
->setAxisAutoScale
(QwtPlot::xBottom);
myPlot
->setAxisAutoScale
(QwtPlot::yLeft);
at the constructor of the myPlot
Re: qwt zoomer: a complete user case scenario?
Quote:
Originally Posted by
fatecasino
Code:
m_zoomer->setEnabled(on);
m_zoomer->zoom(0);
From the documentation of QwtPlotZoomer::zoom:
Quote:
"A value of 0 zooms out to the zoom base."
You might complain about the documentation, but this is no excuse for not reading what is there.
Uwe
Re: qwt zoomer: a complete user case scenario?
Hi,
I had included these 2 lines
Code:
m_zoomer->setEnabled(on);
m_zoomer->zoom(0);
in my enableZoomMode(bool on) function
Code:
void my2dPlot::enableZoomMode(bool on)
{
myPlot->replot();//i am not sure if this is actually needed
m_zoomer->setZoomBase();
m_zoomer->setEnabled(on);
m_zoomer->zoom(0);
d_picker->setEnabled(!on);
}
And I managed to load plots,and then load other plots without having any problem with the axis. The problem as I mention above is that if I zoom in and press the zoom button off then I cannot zoom out again- i can only zoom further in.
If I remove this line:
Code:
m_zoomer->setZoomBase();
then whenever I push the button the plot will reset and this is not the actual purpose. The user must focus to select the exact area that s/he finds interesting. Perhaps the user wants to zoom in/out several times to get to the desired lever/area of zoom.
Is there a way to make the zoomer remember all the zoom steps so it can zoom/unzoom as much as the user wants at any part of the application?
PS:well, the documentation is good, but a few tutorials would make things grow and develop really faster!thanks anyway,after reading some tens of fora I find that you support qwt in an admirable manner.
Re: qwt zoomer: a complete user case scenario?
This is the code you are looking for:
Code:
void my2dPlot::enableZoomMode(bool on)
{
m_zoomer->setEnabled(on);
d_picker->setEnabled(!on);
}
In your previous code you had the following line:
If you don't want it - don't do it.
Uwe