Qt-interest Archive, March 2002
Quit application immediately
Message 1 in thread
Hello,
I have a modal dialog which call a function which may receive an exception:
QString DatabaseClient::queryOneValue( const QString& statement)
{
QString r;
try {
query( statement);
Row row = fetchRow();
if (row != 0) {
r = row [0];
}
} catch (const Exception& e) {
if (QMessageBox::critical( 0, "Database Error", e.what(), "Exit",
"Continue") == 0) {
QApplication::exit( 1);
}
}
return r;
}
The problem is that the application exits only after I closed the modal
dialog. Does anyone know how I can quit the application immediately?
Thanks
Message 2 in thread
Fust do exit(1) (The function call, not the QApplication method.
/Mauritz
Underscore AB
Sebastian Huber wrote:
>Hello,
>I have a modal dialog which call a function which may receive an exception:
>
>QString DatabaseClient::queryOneValue( const QString& statement)
>{
> QString r;
> try {
> query( statement);
> Row row = fetchRow();
> if (row != 0) {
> r = row [0];
> }
> } catch (const Exception& e) {
> if (QMessageBox::critical( 0, "Database Error", e.what(), "Exit",
>"Continue") == 0) {
> QApplication::exit( 1);
> }
> }
> return r;
>}
>
>The problem is that the application exits only after I closed the modal
>dialog. Does anyone know how I can quit the application immediately?
>
>Thanks
>
>--
>List archive and information: http://qt-interest.trolltech.com
>
Message 3 in thread
Sebastian Huber wrote:
I think the modal dialog has an own eventloop that you first have to exit. By brute
force, use exit(3).
/G
> Hello,
> I have a modal dialog which call a function which may receive an exception:
>
> QString DatabaseClient::queryOneValue( const QString& statement)
> {
> QString r;
> try {
> query( statement);
> Row row = fetchRow();
> if (row != 0) {
> r = row [0];
> }
> } catch (const Exception& e) {
> if (QMessageBox::critical( 0, "Database Error", e.what(), "Exit",
> "Continue") == 0) {
> QApplication::exit( 1);
> }
> }
> return r;
> }
>
> The problem is that the application exits only after I closed the modal
> dialog. Does anyone know how I can quit the application immediately?
>
> Thanks
>
> --
> List archive and information: http://qt-interest.trolltech.com
--
[ signature omitted ]