QT: Keep dialog alive after error in onAccepted()
Well, here I am again and not finding how I can get what I want:
I have (for example) a login dialog; it runs fine and does what it is supposed to do, except: If a user logs on with wrong credentials, how can I keep this window alive? When the onAccepted() is triggered, the window is closed, no matter what. Would/should I have to execute the window again, as in this->exec()? It seems a bit recursive to me... So, I was hoping I could find a property that would abort the deletion of the window; so I can clear the LineEdit for password and set focus on it... just what a user would expect to happen. On success the window should close of course, as well as on the cancel button. |
hmm... it seems simpler than expected:
PHP Code:
|
tested it out on both Linux and Windows, and indeed it is as simple as this. However, MainWindow is shown and then this loginwindow is shown again with the focus where stated.
For niceness' sake, you might also want to set the cursor at the start in the PasswordInput. Marking the thread as solved though :-) |
All times are GMT -5. The time now is 12:18 AM. |