PDA

View Full Version : how to move the image in QLabel



augusbas
13th October 2010, 08:01
Hi Guys,

I have placed a Image in a QLabel.

Now when i zoom in and out i need to view the up, down, Right and Left portions of the Image in Qlabel.

How can i achieve this using both mouse click and drag and also using Buttons provided to move in all positions to view the image.

aamer4yu
13th October 2010, 08:33
You can use graphics view framework... zooming operations are easy in that.

If you want to do with a QLabel, would suggest to put QLabel in a QScrollArea. Then on zoom in - resize QLabel,, and on move events, move the scroll area.

Lastly if you want to do everything in the QLabel itself, you will need to catch the key press events and do operations accordingly..
eg - zoom in : scale image, show part of it in QLabel.. move : copy part of scaled image onto the label.

Hope you get the idea :)