Is there any qwt example close to this user case scenario?
Is there any qwt example close to this user case scenario?
hello all,
I am new to Qwt . I am trying to Zoom my plot using QwtPlotZoomer.
It does Zooms in but when I rightclick it resets the plot.
What should I do to get a stepwise Zoom OUT ?
@mohini have a look at:
http://www.qtcentre.org/threads/3719...318#post171318
The default setting is to unzoom stepwise with the middle mouse button and to unzoom completely with the right mouse button. You can change this using: QwtEventPattern::setMousePattern.
F.e. the spectrogram example implements unzooming stepwise with the right mouse button and unzooming completely with CTRL + right mouse button the following code:
Qt Code:
Qt::RightButton, Qt::ControlModifier); Qt::RightButton);To copy to clipboard, switch view to plain text mode
The concept behind the mouse/key patterns makes it possible to implement very individual navigation models - but it is not so easy to understand.
Uwe
getting back to the main subject of the post, I am still working on how to get the data points of a zoomed plot.
I ended up to the following scenarios:
- find an existing qwt function that returns the data points of a plot
- get the axis values, for instance x from 100 to 1000, y from -100 to 100, and go back to the initial data set and search the data points (x,y) that are included in these limits (x:100 to 1000,y:-100 to 100)
- get the coordinates of the rect of the qwt zoomer:
QwtDoubleRect QwtPlotZoomer::zoomRect() const?
which of these is the most feasible?!
I think the point you might be missing is that the QwtPlot is simply a way to display and interact with your program's data. The data itself should be kept somewhere else so you can use it to implement the kind of user interface features you are describing. The QwtPlot (and QwtPlotCurve) classes are designed from this point of view - the curve does not own the data, your application does. That is why there is a QwtData class.
So, you need to make a connection to the QwtPlotZoomer::zoomed() signal so your application can keep track of the current zoom rect. When your user decides that "this is interesting", then it is up to your application to find out which (x,y) pairs in your data array are in the zoom rect. That's not really a Qwt problem.
thanks!!!I will check it out the soonest possible,
until then...
HAPPY NEW YEAR TO EVERYONE!!!!!!!!!!!!!!!!!!!!!!!!!!l:
I think you are right, so I tried to receive the Rect of the zoom area and then get back to the original data set:I think the point you might be missing is that the QwtPlot is simply a way to display and interact with your program's data. The data itself should be kept somewhere else so you can use it to implement the kind of user interface features you are describing.
(leftRange,rightRange are double private members)Qt Code:
void my2dPlot::enableZoomMode(bool on) { m_zoomer->setZoomBase(); m_zoomer->setEnabled(on); m_zoomer->zoom(0); d_picker->setEnabled(!on); QwtDoubleRect rect; rect = m_zoomer->zoomBase(); leftRange = rect.x(); rightRange = rect.right(); }To copy to clipboard, switch view to plain text mode
This part of code works correctly only when I click/unclick the enableZoomMode button (just like the bode example).
Is there a way to insert these lines
Qt Code:
QwtDoubleRect rect; rect = m_zoomer->zoomBase(); leftRange = rect.x(); rightRange = rect.right();To copy to clipboard, switch view to plain text mode
in a different part of the code and get a realtime reaction?i.e. whenever I choose a zooming rect I get straight away the values of the rect stored?
Yes. Implement slots connecting to the appended() and moved() signals (these are members of the QwtPlotPicker class, from which QwtPlotZoomer is derived). You will start out getting two appended() signals when the user first clicks the mouse down. These two points will be the same, and will be the mouse position in axis coordinates. Use that as the topRight() coordinate of the zoomRect. Then, as the user drags the zoom rect, you will get a moved() signal with the updated mouse position. This is the bottomRight() coordinate of the zoom rect. You will probably need to normalize this rect, since the user can start the zoom rect anywhere and go in any direction.
thanks!
after having finished studying at 7am I am off for 4 days for a trip.
I'll be back and check this solution out!
This is exactly what I need, get actual data from a zoomed curve. I'll see now how can I achieve it.
Bookmarks