Results 1 to 7 of 7

Thread: zoomer->zoomRect() is upside-down?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2011
    Posts
    60
    Thanks
    12
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default zoomer->zoomRect() is upside-down?

    I have a waveform that goes from +1 to -1 on the y-axis.

    mRect = zoomer->zoomRect();

    Results in:

    mRect.top() = -1;
    mRect.bottom() = 1;

    This is upside-down.

    Is this expected behavior?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: zoomer->zoomRect() is upside-down?

    Does it change if you start the zooming action from the bottom and drag the zommer rect up?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,325
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: zoomer->zoomRect() is upside-down?

    Quote Originally Posted by alketi View Post
    This is upside-down. Is this expected behavior?
    It is: rect.top() is the same as rect.y() and rect.bottom() is the same as rect.y() + rect.height() - that's how QRect(F) is designed.

    QRect(F) was made having screen coordinates in mind ( here 0,0 is top/left ), but for almost any other coordinate system the terminology bottom/top is counter intuitive. But IMO this is not reason enough for not using QRect(F) for Qwt.

    Uwe

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

    alketi (19th May 2013)

  5. #4
    Join Date
    Dec 2011
    Posts
    60
    Thanks
    12
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: zoomer->zoomRect() is upside-down?

    Thank you Uwe.

    If you're inclined, I would suggest putting a note about this in the QwtPlotZoomer zoomRect() documentation, to prevent others from being similarly confused

  6. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: zoomer->zoomRect() is upside-down?

    Quote Originally Posted by alketi View Post
    Thank you Uwe.

    If you're inclined, I would suggest putting a note about this in the QwtPlotZoomer zoomRect() documentation, to prevent others from being similarly confused
    This is a feature of QRect and not QwtPlotZoomer.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. #6
    Join Date
    Dec 2011
    Posts
    60
    Thanks
    12
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: zoomer->zoomRect() is upside-down?

    Hi Wysota,

    I understand this is normal behavior for QRect, which perhaps makes sense when orienting to (0,0). However, it's use in QwtPlotZoomer is counter-intuitive, which is why I recommended documenting it as a note to users.

    If it were documented in Qwt, I would have saved myself an hour or two of debug, and not needed to ask the community for help, which has also taken time from you and Uwe.

    Cheers

  8. #7
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,325
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: zoomer->zoomRect() is upside-down?

    Quote Originally Posted by alketi View Post
    However, it's use in QwtPlotZoomer is counter-intuitive,...
    Don't see anything specific in QwtPlotZoomer - beside it was the place where you struggled.

    QRect is used in Qt and Qwt almost always and everywhere - alone in the API of Qwt you find ~258 occurrences. If it would be one or two APIs I would add a comment, but in this particular case it is something a developer simply has to know when working with Qt.

    Uwe

Similar Threads

  1. Problem with zoomer
    By alainstgt in forum Qwt
    Replies: 3
    Last Post: 18th April 2012, 09:46
  2. Sort Indicator upside down on Linux SDK1.1 ???
    By liversedge in forum Qt Programming
    Replies: 1
    Last Post: 1st June 2011, 23:23
  3. Displaying upside down
    By feraudyh in forum Newbie
    Replies: 0
    Last Post: 30th July 2010, 19:52
  4. openCV upside down problem
    By altf4 in forum Newbie
    Replies: 1
    Last Post: 13th July 2010, 21:06
  5. Problem with Zoomer
    By rambo83 in forum Qwt
    Replies: 1
    Last Post: 10th March 2010, 12:35

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
  •  
Qt is a trademark of The Qt Company.