Results 1 to 5 of 5

Thread: RubberBand zoom implementation for images

  1. #1
    Join Date
    Jul 2007
    Posts
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default RubberBand zoom implementation for images

    Hi everyone
    I'd like to implement a RubberBand zoom for an image viewer. I'd be grateful to anyone who lead me to the design information or an implementation of such a zoom function.

    Sincerely
    Cem

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: RubberBand zoom implementation for images

    Take image viewer example as a playground. See QRubberBand example usage in its docs. All what is left is to calculate a suitable scale factor and scroll bar values in mouseReleaseEvent().
    J-P Nurmi

  3. #3
    Join Date
    Jan 2006
    Location
    Norway
    Posts
    124
    Thanked 38 Times in 30 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: RubberBand zoom implementation for images

    Or use QGraphicsView - it's got a nifty function called QGraphicsView::fitInView() that many people use to implement rubberband zooming.
    Bitto / Andreas Aardal Hanssen - andreas dot aardal dot hanssen at nokia
    Nokia Software Manager, Qt Development

  4. #4
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: RubberBand zoom implementation for images

    Ya Bitto is right... but dont forget to convert the view cordinates to scene cordinates as fitInView() takes scene cordinates.

  5. #5
    Join Date
    Apr 2007
    Posts
    46
    Thanks
    4
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: RubberBand zoom implementation for images

    This subject is also running in another thread:
    http://www.qtcentre.org/forum/f-qt-p...line-3596.html

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.