did you tried returning app.exe() ?

edit:-> also use show() in maindialog instead of exec()