Guys, please let's not abuse the terms "heap" and "stack". Let's call that "dynamic" and "static" allocation. If you have an object that is allocated on the heap and it has member variables (but not pointers), they will also be allocated on the heap. Also let's remember most Qt objects use the p-impl idiom, so even if you allocate such object "on the stack", most of it will actually still end up on the heap. There is no magic happening with the words "stack" and "heap" apart from that on some architectures stack memory is very limited so most objects should be allocated in the dynamic memory space (heap or global).
Bookmarks