The problem is this: if the application is closed while it is not actively doing something, it terminates correctly. However, if he is actively working on something (for example, waiting for a while loop), the main window closes, but the program will continue to work in the background, which is confirmed by opening the task manager.
I spent most of the day looking for a problem and implementing possible fixes, but to no avail. It seems that the quit () function just does nothing. Here are some things I've tried:
- Using
app.connect( &app, SIGNAL(lastWindowClosed()), &app, SLOT(quit())); . I know that the signal is triggered because I tried to change &app, SLOT(quit()) to qApp, SLOT(aboutQt()) , and the aboutQt window briefly appeared. - Includes
qApp->quit(); at the beginning of the function that is launched from the button of the main window. The application works with this line, but has no effect. - Using
processEvents() to make sure the GUI is updated. - Including expressions such as
mainWindow.setAttribute(Qt::WA_QuitOnClose); in main.cpp.
I just want the application to exit completely when the main window is closed.
I use the qextserialport library if that matters.
source share