PDA

View Full Version : how to zoom in/zoomout of a picture using mouse scroll



rishiraj
13th January 2009, 04:13
Hi,
I have a picture displayed on a label.There are zoomin/zoomout buttons (which are functioning properly).I want to implement this feature--scroll the mouse button up(anticlockwise) and you zoomin on the pic and zoomout when you scroll down(clockwise).
I was advised to try out QWheelEvent class but,haven't got much idea of how to implement this feature.
Please advice on how to proceed.
Thanks.

munna
13th January 2009, 04:25
Create a subclass of QWidget or QLabel and re-implement the wheelEvent function


void QWidget::wheelEvent ( QWheelEvent * event ) [virtual protected]

From this function you can call the same functions/slots that your buttons call to zoom in and zoom out.

rishiraj
13th January 2009, 04:32
Hi,thanks for the prompt reply.I will give it a shot .