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

Mihail Naydenov mlists at ymail.com
Wed Jan 26 09:24:12 CET 2011


There is sceneRect() and, of course a view rect. You can play with these. You 
can make scene rect resize to match view's rect to simplify viewing, and also 
test  items against scene rect to prevent them form disappearing.

MihailNaydenov


>
>From: "Cole, Derek" <dcole at integrity-apps.com>
>To: qt-interest at qt.nokia.com
>Sent: Tue, January 25, 2011 9:45:29 PM
>Subject: [Qt-interest] finding "lost" images in graphicsView
>
> finding "lost" images in graphicsView 
>
>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/20110126/8611e78f/attachment.html 


More information about the Qt-interest-old mailing list