Results 1 to 3 of 3

Thread: Center based image zooming

  1. #1
    Join Date
    Apr 2010
    Posts
    2
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Center based image zooming

    I have a small application that reads in an image and allows zooming in and zooming out.
    What I don't know how to implement is once the image exceeds the size of the scrollable area and the scroll bars appear, I would like the center of the image to remain constant as I continue to zoom in, and have both scroll bar "handles" remain centered in the scroll bar. As I zoom out, I would like the same behavior. I'm using Qt 4.5

    Thanks

  2. #2
    Join Date
    Feb 2007
    Location
    Karlsruhe, Germany
    Posts
    469
    Thanks
    17
    Thanked 90 Times in 88 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Center based image zooming

    Hi Plagoon,

    Have you tried http://doc.trolltech.com/4.3/qscroll...alignment-prop ?

    Johannes

  3. #3
    Join Date
    Apr 2010
    Posts
    2
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Center based image zooming

    I found a solution, once I've zoomed in, I simply set myScrollBar->setValue( (scrollBar->maximum() - scrollBar->minimum())/2 ).
    Thanks.

Similar Threads

  1. Image Zooming
    By navi1084 in forum Qt Programming
    Replies: 2
    Last Post: 16th September 2008, 12:48
  2. Clever image zooming. What to write in PaintEvent?
    By ModeZt in forum Qt Programming
    Replies: 8
    Last Post: 16th December 2007, 13:39
  3. Set the image at the center in QLabel?
    By vishal.chauhan in forum Qt Programming
    Replies: 5
    Last Post: 20th August 2007, 14:07
  4. Image-based widgets showing is too slow in Qt 4.2.1
    By mkrentovskiy in forum Qt Programming
    Replies: 11
    Last Post: 8th August 2007, 22:20
  5. Replies: 3
    Last Post: 11th March 2007, 13:04

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.