[Solved]How to close the application from child dialog box
-
Hello all,
Please help me in this:
I have a main window and a child window dialog with it (not modal less).
I just opened the dialog from main constructor
@dialogCheckLicense.setModal(true); dialogCheckLicense.exec();
@
I have a button on this dialog and want to close the application on this button click(from child window).
Please suggest how can I do it.I found this with similar title but could not relate with my application:
http://qt-project.org/forums/viewthread/10189Any suggestion appreciated (Would be better if code is included :) )
Thanks
Zain -
I think a more clean approach would be to just call done(x) with a special value in your Dialog.
Then, in your main Window you check the return code:
@#define SHUTDOWN 666dialogCheckLicense.setModal(true);
int retVal = dialogCheckLicense.exec();
if(retVal == SHUTDOWN) close(); //might do other clean-up work here...@Other than that, you could still use QCoreApplication::exit(42) directly, I think.
-
Hello All,
MuldeR: Thanks for the reply.
Your solution worked :) ,
But it is showing a strange behavior, when I try to click on button close(I wrote this code on a button click in my checkLicenseDialog), It reappears again and need to click the close one more time.So its working in two button clicks.
Can you please make me understand this behavior.
Well thanks again for the reply.