Results 1 to 5 of 5

Thread: Zooming always snaps to curve start / end, how to avoid this?

  1. #1
    Join Date
    Jul 2009
    Posts
    12
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Zooming always snaps to curve start / end, how to avoid this?

    Hello,

    I'm using Qwt 6 SVN trunk and I'm seeing a behavior in Qwt I'd like to avoid.
    Here is what I mean:
    1. Open "bode" example.
    2. Switch to Zoom mode and pan the plot so that the 0.01 vertical line (where the curves start) is in the middle of the screen.
    3. Zoom in on the middle of the screen so that the start point of the yellow curve is in the middle of the zoom rectangle.

    The behavior I see is that the 0.01 vertical line, instead of remaining in the middle (since I zoomed around it) is actually at the left border of the canvas, and so are the curve start points.

    The same thing happens with the curve end points - each time I zoom in, they are always at the right border or past it.

    Is there a way to avoid this behavior, so that the zoom-rectangle middle point actually stays in the middle?

    Thanks in advance!

  2. #2
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,294
    Thanked 877 Times in 825 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Zooming always snaps to curve start / end, how to avoid this?

    This is an effect of QwtPlotZoomer::minZoomSize. AFAIR the idea behind it is to avoid, that you can zoom in too deep for the significance of the tick labels. But the implementation is obviously made for linear scales and doesn't work properly for logarithmic scales.

    To change it you need to overload and reimplement QwtPlotZoomer::minZoomSize(). If you want to disable the minZoomSize by returning an invalid QSizeF you need to do a "svn update".

    Uwe

  3. #3
    Join Date
    Jul 2009
    Posts
    12
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Zooming always snaps to curve start / end, how to avoid this?

    Thanks, but I'm not sure you understood what I meant (perhaps my explanation wasn't clear enough).
    It's not about minimum size, or logarithmic scales. The issue I see happens both with logarithmic and linear scales. And it's independent of the zoom level or rectangle size.

    What I mean is that when you zoom in on a curve start or end points, those points snap to the canvas border.
    I'm attaching a "before/after zooming" screenshot to show what I mean. In the screenshot, the point x=100,yleft=-80 should be roughly in the middle after zooming. Instead, it's in the bottom right corner.

    A related thing happens after zoom out - it doesn't zoom out to the previously panned position, but instead it resets the panning.
    Attached Images Attached Images

  4. #4
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,294
    Thanked 877 Times in 825 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Zooming always snaps to curve start / end, how to avoid this?

    Ah sorry - the zoom rectangle is always intersected with the zoom base, albeit the documentation says, that it is intersected with the current zoom rectangle. IMO opinion, the documented behaviour makes some sense, but I have no idea what the reason for the implemented one might have been.

    In combination with panning none of these intersection is useful and might only be left because the zooming code is a couple of years older. I will remove it.

    Changed in SVN,
    Uwe


    PS: One design problem of the navigator objects is, that the zoom stack is a local member of a zoomer. I guess you ( like many others before ) would like to have the rectangles that are resulting from panning in the zoom stack as well. Unfortunately implementing this is a major pain - hope I will offer something better in Qwt 6.1.

  5. The following user says thank you to Uwe for this useful post:

    torrentss (7th September 2010)

  6. #5
    Join Date
    Jul 2009
    Posts
    12
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Zooming always snaps to curve start / end, how to avoid this?

    Thanks a lot, the latest SVN fixed the problem.

    I hope some day the zoom stack will work with the panning results as well. Until then, this last change you made is already very nice.

    Thanks a lot!

Similar Threads

  1. Replies: 4
    Last Post: 29th April 2010, 06:11
  2. Replies: 1
    Last Post: 22nd January 2010, 14:34
  3. How to avoid to repeat a connection
    By Auryn in forum Qt Programming
    Replies: 1
    Last Post: 8th July 2009, 15:47
  4. How can I avoid a QDialog close?
    By ricardo in forum Qt Programming
    Replies: 7
    Last Post: 11th May 2009, 19:29
  5. Avoid moving widgets
    By desch in forum Qt Programming
    Replies: 5
    Last Post: 9th April 2009, 06:27

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.