View Full Version : Need Help Regarding Image panning in QT

28th September 2010, 07:02

I need some example to implement image panning in QT.
Please help me with some example on how to implement image panning in QT.

Many Thanks,
K.Chandra Sekhar

28th September 2010, 07:06
Can you be more specific?
Do you need help with the mathematics? With showing the image?

By the way: it's considered rude by me to ask a question on multiple forums.

28th September 2010, 07:58
Thanks for your reply.

I am new to QT programming and I would like to know how to implement panning of images in QT. I need help both in mathematical way and showing the images.

28th September 2010, 08:03
I guess the best "ready made" solution is a QGraphicsView with a scene and a QGraphicsPixmapItem.
Use a timer. For every time out, update a value (x, y or both). Then I guess you can use the setOffset function of the pixmap item.

Or, you could just subclass a widget, draw the image in the paint event. Again, use a timer to update values. Then draw the image panned (current x + some value or current y + some value)

Edit: instead of a timer, you can also use a timeline.
Or: react on mouse position for example.

28th September 2010, 08:18
Thank you very much for the reply.

Could you please give any references where we can get some sample code on panning so that we can start building on that.

Many Thanks,
K.Chandra Sekhar.