How to select all items in the scene
-
wrote on 24 Sept 2011, 09:41 last edited by
i have 1000's of rectitems i want to access all items in the scene to set hide property ...can some one please tell me how to do this
-
wrote on 24 Sept 2011, 11:03 last edited by
Have a look at QGraphicsScene::items()
-
wrote on 24 Sept 2011, 11:58 last edited by
i saw that one ..how to set them hide
-
wrote on 24 Sept 2011, 13:12 last edited by
iterate over the QList with the items and set the item hidden each time.
-
wrote on 24 Sept 2011, 13:57 last edited by
@QList<QGraphicsItem *> items = scene->selectedItems();
foreach( QGraphicsItem *item, items ) {
item->hide();
}@
i wrote like this but don't want selected items i want total items how to do that..
-
wrote on 24 Sept 2011, 15:32 last edited by
So don't use selectedItems() but items().
-
wrote on 25 Sept 2011, 15:14 last edited by
@Eddy: integrating the two ideas maybe faster. Before all items can be selected in a way that exclude a loop? I think it is difficult, because this is the usual way also adopted by graphic programs like Inkscape. BTW if it is possible only one shot to hide the selected items at all.
-
wrote on 26 Sept 2011, 07:29 last edited by
thank you my problem got solved
-
wrote on 26 Sept 2011, 07:40 last edited by
@phani448: Happy that your problem was solved. Now, if you liked that other developers spent their time to help you, I will be a good idea that you spend a bit of your time to tell us how your problem was solved and edit the first post of this thread putting "[Solved]" in front of the title.
Thank you
-
wrote on 26 Sept 2011, 07:53 last edited by
@QList<QGraphicsItem *> items = scene->items();
foreach( QGraphicsItem *item, items )
{
item->hide();
} @
i changed the code it's working for me
[Edit : added @ code tags, Eddy]
2/10