How to select all items in the scene
-
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
-
Have a look at QGraphicsScene::items()
-
i saw that one ..how to set them hide
-
iterate over the QList with the items and set the item hidden each time.
-
@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..
-
So don't use selectedItems() but items().
-
@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.
-
thank you my problem got solved
-
@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
-
@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]