Results 1 to 3 of 3

Thread: how to zoom in/zoomout of a picture using mouse scroll

  1. #1
    Join Date
    Dec 2008
    Location
    My spaceship needs repairs..so, I am stuck on beautiful earth
    Posts
    98
    Thanks
    25
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Question how to zoom in/zoomout of a picture using mouse scroll

    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.

  2. #2
    Join Date
    Jan 2006
    Posts
    667
    Thanks
    10
    Thanked 80 Times in 74 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: how to zoom in/zoomout of a picture using mouse scroll

    Create a subclass of QWidget or QLabel and re-implement the wheelEvent function

    Qt Code:
    1. void QWidget::wheelEvent ( QWheelEvent * event ) [virtual protected]
    To copy to clipboard, switch view to plain text mode 

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

  3. The following user says thank you to munna for this useful post:

    rishiraj (13th January 2009)

  4. #3
    Join Date
    Dec 2008
    Location
    My spaceship needs repairs..so, I am stuck on beautiful earth
    Posts
    98
    Thanks
    25
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: how to zoom in/zoomout of a picture using mouse scroll

    Hi,thanks for the prompt reply.I will give it a shot .

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.