How to set input focus to a shown dialog in Qt?

Posted by Jake Petroules on Stack Overflow See other posts from Stack Overflow or by Jake Petroules
Published on 2010-05-25T08:41:41Z Indexed on 2010/05/25 9:11 UTC
Read the original article Hit count: 240

Filed under:
|
|

In a button click slot, I create and exec() a dialog with a NULL parent. Inside the dialog's constructor, I have:

this->activateWindow();
this->raise();
this->setFocus();

The dialog is application modal and has strong focus. However, it does NOT respond to keyboard events until I click on it. How do I make the dialog get focus without having to click it?

© Stack Overflow or respective owner

Related posts about c++

Related posts about Windows