PDA

View Full Version : How can we set view boundary



learning_qt
20th November 2008, 10:46
My problem is like this:

I load an image with QGraphicsView and QGraphicsScene. The dimension of the image is 2000x3000. I can move this image with finger from the touch screen. But when I approach the edge of the image, the white background will show. So how can I anchor the image when I approach the edge?

wysota
20th November 2008, 19:37
If you are just after showing the image, using a QLabel inside a QScrollArea might be easier.

learning_qt
21st November 2008, 06:28
Thank you for the reply!

But I also hope to zoom, rotate, add text and lines to the image. So, what should I do?

wysota
21st November 2008, 07:16
Set the scene size to the size of the image and set the zoom level so that the image occupies the whole view (using fitInView) and never let it fall below that level. The latter is controversial - what if your image is smaller than the device display?