Delete QGraphicsItems from scene
Hi
I have items in many levels (different zValue). I'm trying to delete items which aren't visible (smaller items above covers bigger item below). IsObscured method is not working because it checks if any of the items above are obscuring and they aren't because they are smaller: http://qt.nokia.com/doc/qt-maemo-4.6/qgraphicsitem.html
So in short, I want to check if smaller items cover bigger item.
Re: Delete QGraphicsItems from scene
Re: Delete QGraphicsItems from scene
I tried to combine bounding rects from smaller items and compare it to bounding rect of bigger item. But if I combine 4 100x100 items with QRectF.united() the resulting rect is 100x100, not 200x200.
I got it working, changed rect1.united(rect2) to rect1 = rect1.united(rect2). :D
Re: Delete QGraphicsItems from scene
Do you have better solutions? I did it this way (it seems to work but the algorithm looks ugly :D):
Code:
Combine smaller rects
If 4 rects was combined and combined items rect contains bigger items rect
delete bigger item