[Qt-interest] Stumped by a simple dialog....
Mike Inman
mangocats at gmail.com
Wed May 13 18:53:40 CEST 2009
Hi,
I have written a simple accessory program that loads a .ui form as a
QDialog, has a bunch of buttons, does some simple stuff, then writes a file.
The basic execution order is:
QApplication app(argc, argv);
QDialog *diaog = loader.load( .ui file reference );
QMetaObject::connectSlotsByName(dialog);
dialog->show();
app.exec();
The dialog has several buttons that trigger QInputDialog::getText
functions, and these behave as expected, the text is input and the form
continues to execute. It also has a button that generates the file and
I use QMessageBox::information() to tells the user about a successful
write, of if there's a reason the write wasn't done.
My problem is: when the QMessageBox::information() is exited, it causes
the parent dialog (which is functioning as the only user interface for
the app) to also exit - if I bypass the QMessageBox::information()
calls, the app doesn't exit, but I also don't get my success/fail messages.
The exact call is:
QMessageBox::information(this, tr("Simple App Window Title"),
tr("success or fail message"),
QMessageBox::Ok,
QMessageBox::Ok);
Whether I parent the message box to the dialog (this) or the app (0),
pressing the Ok causes the dialog (and thus the whole app) to exit.
Am I missing something obvious?
Mike Inman
More information about the Qt-interest-old
mailing list