[Solved] activateWindow only works after there has been a mouse click on the window.
-
I want to programmatically active a windows focus. I have a pointer to the QDeclarativeView. What I do now is
@_view->activateWindow();@
This seems simple and it works 99% of the time. The problem I am getting into is If the window has not been focused by a mouse click, activateWindow() does nothing. Once I click the window activateWindow() works perfectly.
In my system there is no mouse, only a keyboard with arrow keys and an enter button (D-Pad). So when I want to show a popup window with accept/cancel buttons on it I need to be able to force the focus onto the popup window so the user can navigate to the desired buttons and press enter. Is there a way to focus a window without the first mouse click?
-
Turns out I needed to make another call:
@
_view->activateWindow();
_view->setFocus();
@