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. QGuiApplication::postEvent while keeping the application in the background/with no focus
Forum Updated to NodeBB v4.3 + New Features

QGuiApplication::postEvent while keeping the application in the background/with no focus

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.7k 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.
  • P Offline
    P Offline
    paukis
    wrote on last edited by
    #1

    I am trying to understand if it is possible to post key events to QGuiApplication when it has no focus or when the application is in the background behind some other windows.

    Right now, we use QGuiApplication::postEvent to do this, but when the application has no focus the event is not passed and due to this reason we always have to bring the application to the top to pass the events

    Any pointers?

    Thank you

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      What kind of key event should that be ? Some sort of global shortcut ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • P Offline
        P Offline
        paukis
        wrote on last edited by
        #3

        Hi, we are running GUI Robot automated test scripts where we keep triggering mouse clicks or key presses to QGuiApplication to run a test case.

        In this process we are using QGuiApplication::postEvent for passing the events to the application and now we do that by activating the application and bringing to focus. The side effect is that this application window is brought to foreground and leaving my active window to background.

        The goal now is that, while the tests are run we want to pass the events to our application keeping it in the background and still could do other things.

        Thank you

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          If the test should run in the background, I would have rather used something like QtScript to automate the test processing, to avoid having to click/simulate the clicks on the screen.

          You might also be interested by "froglogic's squish":http://www.froglogic.com/squish/gui-testing/

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          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