PDA

View Full Version : Zoom the paintevent data using qrubberband



prabhatjha
6th August 2014, 09:46
hey i made a gui in which i draw manything using paintevent .now i want to put zoom functionality in this .so, i want that selcted area should be zoom for this i am using qrubberband but i do not know how to zoom selected area .please give me some suggession or some demo code. thanks in advance.

d_stranz
6th August 2014, 16:34
You know the top left coordinate (in pixels) of the zoom rect, and you can compute the width and height scale factors compared to the full view (x-scale = fullwidth / zoomwidth, y-scale = fullheight / zoomheight). Use QPainter::translate() to move the zoom rect, followed by QPainter::scale() to magnify the contents to fit the whole view.