1

I'm having a scene where items will be added continuously and out of specific sceneRect. items can be added infinite.

ex: if I set the scene rect as (0, 0, 5000, 5000) there is a chance that an item can be added say pos (5010, 5010) so I cant able to define the scene rect.

I can't use scene->setSceneRect(scene->itemsBoundingRect()); because initially there won't be any item and I have to drop the item to scene rect.

So I need to specify initially some sceneRect like viewport->rect() of graphicsview. Then I have to increase it when ever any items added.

So how I can increase the sceneRect when the items keep on adding and the view increases its scroll area.

LogicStuff
  • 19,397
  • 6
  • 54
  • 74
Wagmare
  • 1,354
  • 1
  • 24
  • 58
  • The sceneRect can be much larger than 5000. Do you need to constrain it to begin with? I have had a sceneRect of 32000 x 32000 – TheDarkKnight Mar 10 '15 at 08:50
  • actually im implementing panning on graphicsview . so i need the scene rect to restrict within the items added . the item can be increased and the scene rect has to increase proposition to it. if i set 32000x32000 even if no items has been added. it wil lshow lots of empty spaces . – Wagmare Mar 10 '15 at 08:54
  • Without knowing your full requirements, I'd set it to 32000 x 32000 and start at the centre of the scene. Then restrict and allow panning as required, increasing it when a threshold is reached. – TheDarkKnight Mar 10 '15 at 09:38
  • thanks Bruce wayne .its a very good suggestion .but i will restrict the panning in what level (geometry) . items boundingRect()..? – Wagmare Mar 10 '15 at 09:42
  • 1
    If you're panning, that's moving the view around the scene, so you'd restrict it in the GraphicsView. If that's not what you mean by panning, then please explain. If GraphicsItems are being moved, you would restrict this to the view, which restricts the panning. – TheDarkKnight Mar 10 '15 at 09:58

0 Answers0