View Full Version : Qlabel Image Panning

12th November 2011, 06:17
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..

12th November 2011, 08:43
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.