How to send signal class member to exit(quit) qApp->quit()

  • PS. I' m new in QT!
    I have one class C1, and second class C2(is member pointer in class C1); When application exit, object class's C1 - quit very well (memory is free), but(!) object class's C2(is member pointer in class C1) not quit well. - he leave in memory. What I can do. that pointer C2 exit correct? I can't send signal. - i'ts not work( "error ,,,,,,,,,,(null) slot quit() )" Thank's!

  • Moderators

    You need to delete C2 object in the destructor of C1 class. If you don't know what a "destructor" is, search the web, it's pretty basic concept in C++ language.

    Alternatively, in Qt, you can also make both classes inherit from QObject, and assign C1 as a parent of C2: then Qt will automatically delete C2 for you when C1 is deleted.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.