Results 1 to 2 of 2

Thread: how to get notified when the displayed region in a scene changes

  1. #1
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    258
    Thanks
    22
    Thanked 19 Times in 16 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default how to get notified when the displayed region in a scene changes

    Hi,
    I want to get notified once the area displayed in a QGraphicsView changes. That is to say, once the area is zoomed in, zoomed out, scrolled, or whateva else that may make items that were not visible before visible in the view. The reason for this is that I want the items only to do some operations when they are visible in the view. And once they are not visible anymore (for example if we scroll to another region of the scene) they should free some resources etc. so that memory usage is minimized. What is the best way to do that?

    Thanks in advance

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    258
    Thanks
    22
    Thanked 19 Times in 16 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: how to get notified when the displayed region in a scene changes

    Really no Idea what I could do in that situation? Maybe I didn't appropriately describe the problem. I am trying to find a way to detect when an item on a QGraphicsScene becomes or stops being "visualized" by a QGraphicsView. That is because the items each contain a QImage that may have a large size and I want to free the resuorces once the item is not visualized by any view any longer and initialize it again whenever it becomes visualized by a view. I thought if I was notfied by a signal or an event once the area visualized by a view changes I could translate the view's rect to scene coordinates and find the items who'se boundingRect intersects with that view. The only problem is I don't know how to get notfied about the change I described above. Can you think of any workaround or do you have any other suggestions that may help me here?

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.