How can I totally remove the QApplication instance, so it can be possible to recreate it again in a sheared library. If I have such a following code:
int main(int argc, char ** argv) {
QApplication *app = new QApplication(argc, argv);
MyWindow dialog;
dialog.show();
app->exec();
return 0
}
I want to be able to delete the instance after quiting the app (closing the application after app.exec()) I have tried to do the following:
app->setQuitOnLastWindowClosed(false);
app->quit();
delete app;
But non of them could be worked. I want to remove the QApplication instance like I did not create before. The QApplication in my shared library always works if I did not define the QApplication in the main.
- The library (lib) and the main application (app) are using different copy of Qt.
- I am developing the app, the lib is imported to my app.
- After closing the first dialog, I am using an event to trigger the thread in the library which it is waiting for this event.