Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How to send key press to other application?
Forum Updated to NodeBB v4.3 + New Features

How to send key press to other application?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
4 Posts 3 Posters 1.0k 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    I'm trying to make autotyper in qt. I need to simulate key press to other application(eg-firefox) according to text. Is there a way I can do this through QApplication::sendEvent() since it needs ref to receiver or any other way?

    Thanks for help.

    JonBJ 1 Reply Last reply
    0
    • ? A Former User

      I'm trying to make autotyper in qt. I need to simulate key press to other application(eg-firefox) according to text. Is there a way I can do this through QApplication::sendEvent() since it needs ref to receiver or any other way?

      Thanks for help.

      JonBJ Online
      JonBJ Online
      JonB
      wrote on last edited by
      #2

      @krillxox
      QApplication::sendEvent() is for sending within the application, not externally.
      Firefox is not a Qt application, so you can't use Qt Remote Objects, as I understand it.
      So far as I know, the only way to "send key press to other application" is under Windows where there is a Win (not Qt) call for sending keys to other processes.

      1 Reply Last reply
      0
      • ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #3

        Is there a way I can do this in linux and mac?

        1 Reply Last reply
        0
        • fcarneyF Offline
          fcarneyF Offline
          fcarney
          wrote on last edited by
          #4

          Lookup pywinauto. This is a windows python automation library. You can dig into the code to see what it has to do to send events to apps. Then look for something similar in linux and mac. Each platform will be different and require a different api. For instance on Linux you will have to support X11 and Wayland potentially. So that could double the work. Python is often used to automate things so you have a better bet of finding something that already works and and can show you how the api on that platform works.

          C++ is a perfectly valid school of magic.

          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