Important: Please read the Qt Code of Conduct -

Focus button is no longer in focus when you click outside of a modal dialog

  • I have a modal dialog that pops up and on that dialog window are two buttons. One is in focus by using (setFocus()). The functionality works great, but for some reason, when you click another window (can be outside of application or the main window the dialog window originated from), the modal dialog window is no longer in focus (to be expected) yet the default button that was supposed to be in focus on that window is no's the next's as if you pressed tab in the dialog window and the next button has gained focus. If I click back on that modal dialog to regain focus for that window, the correct button is refocused so all is good there but I'd like to understand why when you press outside of the modal dialog window, the focus button changes.


  • Lifetime Qt Champion

    Sounds odd. Tried to make a mini sample but nothing happened.
    No button move.

    Do you have a small sample that does this?

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    To add to @mrjj What version of Qt and OS are you running ?