[Qt-interest] finding "lost" images in graphicsView

Cole, Derek dcole at integrity-apps.com
Tue Jan 25 20:45:29 CET 2011


Hello,

I have implemented some zooming/panning of imagery in a QGraphicsView. Is there a way to make it so that the size of the scene is only the size of the graphicsView? In other words, once I load in my large image, and then scale it down, I now have this huge canvas in which I can move the image anywhere. This is very cumbersome, as my image can get very small, and very "lost" in that I can't see it anywhere on my screen, and I have to scroll all over the place to try to find it.

I tried to create a button to "reset" the view, with this:

    ui->graphicsView->centerOn(item);
    ui->graphicsView->ensureVisible(item);

where item is my QGraphicsItem, but it doesnt seem to work every time.

Further, it seems like it is possible for me to pan my image right out of the entire scene, and I have to close my program and re-open with the image to get it back.

What kind of constraints do I need to set to keep this from happening?

Thanks

Derek
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110125/095576e6/attachment.html 


More information about the Qt-interest-old mailing list