I'm currently drawing dozens of objects onto a QCP, and then am manually tracking the pointers to the QCPItem s that I use (eg lots of rectangles). When I wante to remove them, I call qcp->removeItem(QCPAbstractItem*)

I originally had the idea to put all these objects onto their own layer, so that I can wipe and rebuild the layer readily, but reading the documentation, it seems that there is no way to destroy all the items on a layer directly.

My current solution of keeping track of all the added pointers works, but seems messy - is there a simple way to wipe a layer entirely, so that objects don't move to a different layer, but are fully deleted?