PDA

View Full Version : Need Help Regarding Image panning in QT



sekhar18k
28th September 2010, 06:02
Hi,

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

tbscope
28th September 2010, 06: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.

sekhar18k
28th September 2010, 06: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.

tbscope
28th September 2010, 07: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.

sekhar18k
28th September 2010, 07: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.