I am guessing that the leaks are the two QLayoutItem instances returned by the takeAt() calls. You can simply add a local variable to store the return value then call delete() on it.
Qt's semantics for most takeAt() type calls is that ownership of whatever is being taken is transferred to the caller, so it is the caller's responsibility to clean up.
Bookmarks