Note also, in addition to the above, that a QLayout itself acts much like a vector: it has count(), addItem(), removeItem() and itemAt() functions that might serve just as well as using an external vector to keep track of the items managed by the layout. It isn't really possible to say whether this approach would work without knowing more about your application, but sometimes it allows you to use a single object - the layout - rather than two - the layout plus an external container.