Results 1 to 3 of 3

Thread: Smooth zooming with mouse pointer as center

  1. #1
    Join Date
    Nov 2012
    Posts
    11
    Thanks
    5

    Default Smooth zooming with mouse pointer as center

    Hi,

    No matter what I do, the zoom in my GraphicsView is always happening in the same manner, which doesn't take my mouse pointer into consideration.

    Basically I want the zoom to happen like google maps. And I did try with the approach provided here.

    As a standalone GraphicsView it works perfectly. But in my project, I have a graphWidget (a custom class inheriting QGraphicsView) and a tabWidget separated by a splitter. (designed in UI forms). And in the code, I initialize the graphicsView.

    I added the same wheelEvent implementation to my graphicsView class, but it doesnt show any difference. It always zooms in the same way, without caring about mouse position.

    Any help ?

    Let me know if more details are needed.

  2. #2
    Join Date
    Jun 2013
    Location
    Germany
    Posts
    5
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Smooth zooming with mouse pointer as center

    Hi,

    have you tried to set the QGraphicsView::transformationAnchor to QGraphicsView::AnchorUnderMouse?

  3. #3
    Join Date
    Nov 2012
    Posts
    11
    Thanks
    5

    Default Re: Smooth zooming with mouse pointer as center

    yes of course. As I said, it works if I test with the example in the link I posted. But in my project, the same code doesnt work. Don't understand why.

Similar Threads

  1. Replies: 3
    Last Post: 22nd February 2013, 19:56
  2. zooming when mouse hovers axis-label
    By Andreas in forum Qwt
    Replies: 3
    Last Post: 12th December 2011, 09:04
  3. Zooming an image to the center
    By A9am in forum Newbie
    Replies: 1
    Last Post: 2nd November 2011, 07:54
  4. smooth panning and zooming an image, to use OpenGL or not?
    By scarleton in forum Qt Programming
    Replies: 0
    Last Post: 27th August 2010, 22:25
  5. Center based image zooming
    By plagoon in forum Qt Programming
    Replies: 2
    Last Post: 25th April 2010, 16:09

Tags for this Thread

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.