Results 1 to 7 of 7

Thread: Zooming an Image to the point where the mouse points

  1. #1
    Join Date
    Oct 2011
    Posts
    48
    Thanks
    6
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Zooming an Image to the point where the mouse points

    Hai All,


    I am using a QLabel in my application.I have a pixmap image in that label.
    I want to zoom the image to the point where the mouse points.Can anyone please help me doing that?


    Thanks

  2. #2
    Join Date
    Dec 2009
    Posts
    128
    Thanks
    7
    Thanked 14 Times in 14 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Zooming an Image to the point where the mouse points

    QLabel does not really fit the need to 'navigate' in a pixmap. You should consider using GraphicsView API instead (and use QGraphicsView::setTransformationAnchor(QGraphicsVi ew::AnchorUnderMouse) to zoom under mouse cursor)

  3. #3
    Join Date
    Oct 2011
    Posts
    48
    Thanks
    6
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Zooming an Image to the point where the mouse points

    Thanks totem for your suggestion. But I dont want to use Graphicsview due to some memory usage issue.Can you please suggest me any other method?

  4. #4
    Join Date
    Dec 2009
    Posts
    128
    Thanks
    7
    Thanked 14 Times in 14 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Zooming an Image to the point where the mouse points

    Yes :
    Overload QLabel class, reimplement mouseWheel event handler and do some image-processing-code based on your initial picture, the area of the picture currently displayed, the QLabel size and QCursor::pos(), and you got it.

  5. #5
    Join Date
    Oct 2011
    Posts
    48
    Thanks
    6
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Zooming an Image to the point where the mouse points

    I want to drag an image using mouse in QLabel.Can anyone please tell me which class to use for that?

  6. #6
    Join Date
    Sep 2011
    Location
    Manchester
    Posts
    538
    Thanks
    3
    Thanked 106 Times in 103 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Zooming an Image to the point where the mouse points

    I don't think you'll be able to do something like that with QLabel alone and if you do - it will require a lot of unnecesary complexity.

    Take a look at those link, I guess that's what you're looking for:
    http://doc.qt.nokia.com/stable/widgets-imageviewer.html
    http://qt4.digitalfanatics.org/articles/zoomer.html
    http://doc.trolltech.com/4.3/widgets...iewer-cpp.html

  7. #7
    Join Date
    Oct 2011
    Posts
    48
    Thanks
    6
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Zooming an Image to the point where the mouse points

    Can anyone please tell me how to zoom image to the mouse point in QLabel by getting the Qpoint of mouse??

Similar Threads

  1. Zooming image
    By MTK358 in forum Qt Programming
    Replies: 18
    Last Post: 27th September 2010, 18:25
  2. Replies: 3
    Last Post: 12th May 2010, 13:11
  3. Replies: 6
    Last Post: 21st September 2009, 10:55
  4. getting mouse points in opengl
    By sdastagirmca in forum Qt Programming
    Replies: 1
    Last Post: 21st June 2009, 13:59
  5. Image Zooming
    By navi1084 in forum Qt Programming
    Replies: 2
    Last Post: 16th September 2008, 12:48

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.