Here is one of such solutions:
1. QDialog has accept() and reject() methods
2. On your LoginDialog you input your credentials and press a button (let it be submitButton) and it emits a SIGNAL called clicked().
3. Create a slot: submitButtonClicked(). Connect a signal clicked() to a slot submitButtonClicked()
4. Inside your slot do your validations for received credentials and if everthing is ok call accept() method, otherwise - reject().
And using it will look like this
YourLoginDialog loginDialog;
if ( QDialog::Accepted == logindDialog.
exec() ) { // access granted, do you work
} else {
// sorry access denied
}
YourLoginDialog loginDialog;
if ( QDialog::Accepted == logindDialog.exec() ) {
// access granted, do you work
} else {
// sorry access denied
}
To copy to clipboard, switch view to plain text mode
Bookmarks