Results 1 to 3 of 3

Thread: QGraphicsScene: evolution of sceneRect

  1. #1
    Join Date
    Jan 2006
    Location
    Genk, Belgium
    Posts
    36
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default QGraphicsScene: evolution of sceneRect

    For the QGraphicsScene::sceneRect, there are two possible evolutions:
    - either you do not set the sceneRect explicitly, and it will grow as needed, in order to contain all items, but it never shrinks
    - or you set the sceneRect explicitly, and it does no longer evolve as items are added/moved

    What I need is that it grows automatically, but also shrinks automatically.
    Or as a workaround, I would like to set it explicitly to the current boundingrectangle, without stopping future automatic grows...

    Can I realize this?

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QGraphicsScene: evolution of sceneRect

    You could make use of QGraphicsScene::itemsBoundingRect() and set the scene rect manually on certain occasions. Just make sure you don't call it too intensively, it might turn out to be slow on large scenes..
    J-P Nurmi

  3. #3
    Join Date
    Jan 2006
    Location
    Genk, Belgium
    Posts
    36
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QGraphicsScene: evolution of sceneRect

    Yes, but from then on, automatic growing does no longer occur. (Why is that? Why is no option offered have (explicit or automatic) it shrink while keeping automatic growing?)

    Your solution can help me, but then I need to do a lot of administration throughout my application (in order to avoid the application to become slow).

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.