Results 1 to 2 of 2

Thread: Qlabel Image Panning

  1. #1
    Join Date
    Jun 2009
    Location
    India
    Posts
    143
    Thanks
    16
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Qlabel Image Panning

    Dear All,

    In a QLabel a picture is placed using setPixmap.

    I can able to Zoom in /Out the pixmap.

    On Zoomin i need to Pan the image(left/Right/up/down) , by using only the mouse drag event ( I don't want to use the Scroll bar )

    How can i achieve this..

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Qlabel Image Panning

    The easiest way is to put the label in a QScrollArea. Otherwise you have to subclass QLabel and add a custom paintEvent where you draw the (scaled) image, and reimp the QWidget::keyPressEvent() to react on the key arrows.

Similar Threads

  1. Need Help Regarding Image panning in QT
    By sekhar18k in forum Qt Programming
    Replies: 4
    Last Post: 28th September 2010, 07:18
  2. 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
  3. Replies: 6
    Last Post: 21st September 2009, 10:55
  4. QLabel as an image.
    By RSX in forum Newbie
    Replies: 2
    Last Post: 4th April 2009, 19:22
  5. Show Image on a QLabel
    By ^NyAw^ in forum Newbie
    Replies: 11
    Last Post: 15th April 2008, 15:45

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.