View Full Version : RubberBand zoom implementation for images
cdemirkir
10th July 2007, 08:13
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
Take image viewer example (http://doc.trolltech.com/4.3/widgets-imageviewer.html) 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(). :)
Bitto
15th July 2007, 11:11
Or use QGraphicsView - it's got a nifty function called QGraphicsView::fitInView() that many people use to implement rubberband zooming.
aamer4yu
15th July 2007, 22:38
Ya Bitto is right... but dont forget to convert the view cordinates to scene cordinates as fitInView() takes scene cordinates.
ber_44
16th July 2007, 22:55
This subject is also running in another thread:
http://www.qtcentre.org/forum/f-qt-programming-2/t-draw-rubberband-line-3596.html
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.