[SOLVED] Preventing QDialog from losing focus



  • Hi,

    I have a QMainWindow that opens a QDialog window, is it possible to stop the QDialog from losing focus when you click on anything but the dialog? What I'm trying to achieve is kind of like windows when a dialog is open and you click outside of the dialog it flashes and rejects input but remains in focus.

    Thanks



  • That is the behaviour of a modal dialog. You get that by calling QDialog::exec() rather than show()



  • Thanks, I think I figured it out, you have to call setWindowModality(Qt::ApplicationModel); on the created dialog.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.