saimel
19th September 2011, 15:59
Hello people, I have a little problem with an application here, I need to load some data from a file and it works out, but I call the slot init() int the constructor method, so, if the file does not exists I throw an exception and show a QMessageBox, after that I try to close the app but it does not work. Here is the code:
cpp file
ClassName::ClassName( args) {
...
// some code here
...
this->init();
}
void ClaseName::init() {
try{
this->loadFileContent();
}
catch(Error *e) {
QmessageBox:: ... // here show the message
this->close();
}
}
It show the QMessageBox before the main window, but does not close the app.
In another slot that I use to write into the file I make the same and if the file does not exists or there is another problem it show the QMessageBox and close the app, but here it does not work.
Somebody have any suggestion ??
cpp file
ClassName::ClassName( args) {
...
// some code here
...
this->init();
}
void ClaseName::init() {
try{
this->loadFileContent();
}
catch(Error *e) {
QmessageBox:: ... // here show the message
this->close();
}
}
It show the QMessageBox before the main window, but does not close the app.
In another slot that I use to write into the file I make the same and if the file does not exists or there is another problem it show the QMessageBox and close the app, but here it does not work.
Somebody have any suggestion ??