Dear all,
I'm experiencing a strange issue, never happened to me before.
In a class of my application I've created a simple SIGNAL-SLOT mechanism to manage the pressing of the "Exit" button by the user:
// Exit buttons
QObject::connect(mainWindow
->pushButton_Exit,
SIGNAL(released
()),
this,
SLOT(exitApplication
()));
QObject::connect(this,
SIGNAL(confirmClosing
()),
qApp,
SLOT(quit
()));
// Exit buttons
QObject::connect(mainWindow->pushButton_Exit, SIGNAL(released()), this, SLOT(exitApplication()));
QObject::connect(this, SIGNAL(confirmClosing()), qApp, SLOT(quit()));
To copy to clipboard, switch view to plain text mode
mainWindow is obviously the main window of my application, defined as a member of a class created through the designer (and then made child of QMainWindow).
The exitApplication() slot provides to prompt the user with a QMessageBox, asking him to confirm the exiting:
// Show a dialog box asking confirmation to the user
int reply;
reply
= QMessageBox::warning(this, tr
("Application exit"),
tr("An evolution is in progress.\nAre you really sure you want to exit now?"),
// Show a dialog box asking confirmation to the user
int reply;
reply = QMessageBox::warning(this, tr("Application exit"),
tr("An evolution is in progress.\nAre you really sure you want to exit now?"),
QMessageBox::No | QMessageBox::Default, QMessageBox::Yes |
QMessageBox::Escape);
To copy to clipboard, switch view to plain text mode
(the code continue with something like: if yes then ::exit(0))
The problem is that, when this QMessageBox appears, the application's main window disappears. Even if I press "No" on the dialog, the main window doesn't re-appears. The application still runs.
Any clue about the reason of this behaviour?
Many thanks,
Fabio
Bookmarks