harmodrew
5th August 2010, 19:21
hello! I'm writing the following application:
main.cpp:
#include <QtGui/QApplication>
#include "mainwindow.h"
#include <QInputDialog>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
QInputDialog id;
bool ans1, ans2;
int i1 = id.getInt(&w, w.tr("Title"), w.tr("Text"),0,0,20,1,&ans1));
int i2 = id.getInt(&w, w.tr("Title"), w.tr("Text"),0,0,20,1,&ans2));
if (ans1 && ans2)
{
w.showMaximized();
}
else
{
w.close();
}
return a.exec();
}
If I chose "OK" for both the first input dialog and the second one then the program continues rightly and clicking the classic "X" it exits correctly.
While if I chose "Cancel" in one of the input dialogs the window doesn't show (and I want it) but the application doesn't quit at all. It remains running in RAM.
I found this behaviour by debugging the program putting a breakpoint at the row "return a.exec();". This instruction never stop (so the program loops in the exec() function). what can it be?
thanks
main.cpp:
#include <QtGui/QApplication>
#include "mainwindow.h"
#include <QInputDialog>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
QInputDialog id;
bool ans1, ans2;
int i1 = id.getInt(&w, w.tr("Title"), w.tr("Text"),0,0,20,1,&ans1));
int i2 = id.getInt(&w, w.tr("Title"), w.tr("Text"),0,0,20,1,&ans2));
if (ans1 && ans2)
{
w.showMaximized();
}
else
{
w.close();
}
return a.exec();
}
If I chose "OK" for both the first input dialog and the second one then the program continues rightly and clicking the classic "X" it exits correctly.
While if I chose "Cancel" in one of the input dialogs the window doesn't show (and I want it) but the application doesn't quit at all. It remains running in RAM.
I found this behaviour by debugging the program putting a breakpoint at the row "return a.exec();". This instruction never stop (so the program loops in the exec() function). what can it be?
thanks