Howdy Qt goers,
I'm having a little trouble.
I've got a QGraphicsScene that contains a bunch of QGraphicsItemGroups.
You can zoom in and out, and I have content that shows up when you zoom in far enough.
When optimizing the drawing speed, I found that using addToGroup when zoomed in far enough and removeFromGroup when you zoom out far enough is the most efficient way of showing/hiding content (a LOT of content).

So, I've gotten it to addToGroup appropriately when zoomed in, but when I zoom out, it blinks as though it called removeFromGroup, but then it's still there. I have a feeling it's because of my implementation of levelOfDetailFromTransform().

This is my paint() function for each QGraphicsItemGroup

Qt Code:
  1. const qreal lod = item->levelOfDetailFromTransform(painter->worldTransform());
  2. if(lod > .05)
  3. {
  4. if(childItems().size()==0)
  5. for(int index=0;index<siteItems.size();index++)
  6. addToGroup(siteItems[index]);
  7. }
  8. else
  9. {
  10. if(childItems().size()!=0)
  11. for(int index=0; index < siteItems.size();index++)
  12. removeFromGroup(siteItems[index]);
  13. }
To copy to clipboard, switch view to plain text mode 

I know the level of detail is calibrated about right, but for some reason, this implementation just doesn't want to remove the items.
Again, for instance, I'll zoom in, and the items that are zoomed in show up like they should because of addToGroup(), but I'll zoom out and those items specifically will persist.

Thanks!