Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [Solved] activateWindow only works after there has been a mouse click on the window.
Forum Updated to NodeBB v4.3 + New Features

[Solved] activateWindow only works after there has been a mouse click on the window.

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 2.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    bundickt
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • B Offline
      B Offline
      bundickt
      wrote on last edited by
      #2

      Turns out I needed to make another call:

      @
      _view->activateWindow();
      _view->setFocus();
      @

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved