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. Control a QMainWindow remotely

Control a QMainWindow remotely

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 351 Views
  • 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.
  • Q Offline
    Q Offline
    qtacc32
    wrote on last edited by
    #1

    Hello,

    I want to send mouse/keyboard input to a QMainWindow from another application (combination of WinAPI PostMessage() and QApplication::postEvent).
    So far it's possible to click buttons, but a QLineEdit for example will gain focus only if the QMainWindow is the "active" window.
    So I have to do something likeif(event->type() == QEvent::WindowDeactivate) activateWindow();.
    Surprisingly, this seems to work. Even if a fullscreen application (which should control the QMainWindow) is above the QMainWindow, it's not disturbed.
    But this approach fails as soon as the QMainWindow opens a dialog. Then, QMainWindow and the dialog "fight" for their active window status. But anyway I'd prefer a more "clean" way.
    Also, the widgets don't react as soon as the QMainWindow is minimized.

    So I'm looking for a way to overcome those limitations.
    Is there a way to tell Qt to process everything as usual if the QMainWindow is not active or even minimized?
    Do I have to modify the source for that? Does anyone know more?

    What I know is that the QMainWindow application receives the events at least (checked with event filter on QApplication level) but I guess the widgets discard them due to window not active or minimized.

    Thank you very much!

    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