I come from a fairly strong C background and have a pretty solid foundation in C ++. Most recently, I worked with C # and other higher-level languages. The project I'm working on can really benefit from using QT4, but I have some memory management issues that I don't seem to understand. I read the QT4 documentation and it didn't help me. That is why I am here.
1) So, for starters, I understand that the easiest way to use QT4 objects is to declare them locally:
void MyFunc()
{
QString foo;
}
It's simple enough, I can take this object and pass it on and know that when it goes out of scope, it will be destroyed. But here is my question.
1) If I create a QList and add objects to it, and then the QList goes out of scope, will it try to free the child objects?
2) If the QT4 procedure returns a pointer to an object, then am I responsible for de-highlighting this object?
3) If I create a subclass of QWidget and add it to QWindow, how can I guarantee that when the QWindow is destroyed, it will take my widget?
Thanks for the help.
source
share