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. How do I send CTRL +V events to Linux
QtWS25 Last Chance

How do I send CTRL +V events to Linux

Scheduled Pinned Locked Moved Solved General and Desktop
10 Posts 3 Posters 825 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.
  • - Offline
    - Offline
    -pickupy
    wrote on 24 Jun 2022, 10:46 last edited by -pickupy
    #1

    Due to business needs, in the cross-platform qt is used to implement the cursor paste string, can be used in the c # System. Windows. Forms. The SendKeys. SendWait (" ^ v "); , but QT did not find a suitable solution. Please give me a hand

    J 1 Reply Last reply 24 Jun 2022, 11:11
    0
    • J Offline
      J Offline
      JoeCFD
      wrote on 24 Jun 2022, 13:32 last edited by JoeCFD
      #3

      https://unix.stackexchange.com/questions/192462/how-to-remotely-send-a-keypress-to-an-x11-application
      Use QProcess to send out a command from your qt app?
      xdotool key ctrl+V

      - 2 Replies Last reply 26 Jun 2022, 03:34
      1
      • - -pickupy
        24 Jun 2022, 10:46

        Due to business needs, in the cross-platform qt is used to implement the cursor paste string, can be used in the c # System. Windows. Forms. The SendKeys. SendWait (" ^ v "); , but QT did not find a suitable solution. Please give me a hand

        J Offline
        J Offline
        JonB
        wrote on 24 Jun 2022, 11:11 last edited by
        #2

        @pickupy
        Hello and welcome.

        We understand that English may not be your first language, but this question is difficult to comprehend. Send a key press? Where? To a window within your Qt application, to another window in a different process with a UI?

        - 1 Reply Last reply 26 Jun 2022, 03:18
        0
        • J Offline
          J Offline
          JoeCFD
          wrote on 24 Jun 2022, 13:32 last edited by JoeCFD
          #3

          https://unix.stackexchange.com/questions/192462/how-to-remotely-send-a-keypress-to-an-x11-application
          Use QProcess to send out a command from your qt app?
          xdotool key ctrl+V

          - 2 Replies Last reply 26 Jun 2022, 03:34
          1
          • J JonB
            24 Jun 2022, 11:11

            @pickupy
            Hello and welcome.

            We understand that English may not be your first language, but this question is difficult to comprehend. Send a key press? Where? To a window within your Qt application, to another window in a different process with a UI?

            - Offline
            - Offline
            -pickupy
            wrote on 26 Jun 2022, 03:18 last edited by -pickupy
            #4

            @JonB Thank you very much. As you said, English is not my mother tongue. I want to make it like voice input, output speech recognition content at the cursor of any interface, the QT application has set the content to the clipboard, now I just need to paste the clipboard content to the cursor, but I can't find the paste function here.

            1 Reply Last reply
            0
            • J JoeCFD
              24 Jun 2022, 13:32

              https://unix.stackexchange.com/questions/192462/how-to-remotely-send-a-keypress-to-an-x11-application
              Use QProcess to send out a command from your qt app?
              xdotool key ctrl+V

              - Offline
              - Offline
              -pickupy
              wrote on 26 Jun 2022, 03:34 last edited by
              #5
              This post is deleted!
              1 Reply Last reply
              0
              • J JoeCFD
                24 Jun 2022, 13:32

                https://unix.stackexchange.com/questions/192462/how-to-remotely-send-a-keypress-to-an-x11-application
                Use QProcess to send out a command from your qt app?
                xdotool key ctrl+V

                - Offline
                - Offline
                -pickupy
                wrote on 26 Jun 2022, 05:22 last edited by
                #6

                @JoeCFD Thank you very much. That will solve my problem.

                 QString cmd = "xdotool key ctrl+v";
                 std::string str = cmd.toStdString();
                 const char *cmd_cs= str.c_str();
                 system(cmd_cs);
                
                1 Reply Last reply
                0
                • J Offline
                  J Offline
                  JoeCFD
                  wrote on 27 Jun 2022, 13:27 last edited by JoeCFD
                  #7

                  It will be better to use QProcess than low level system call. And also QProcess is cross-platform and system is not.

                  - 1 Reply Last reply 1 Jul 2022, 03:28
                  2
                  • J JoeCFD
                    27 Jun 2022, 13:27

                    It will be better to use QProcess than low level system call. And also QProcess is cross-platform and system is not.

                    - Offline
                    - Offline
                    -pickupy
                    wrote on 1 Jul 2022, 03:28 last edited by
                    #8

                    @JoeCFD Ok, thank you very much.

                    J 1 Reply Last reply 1 Jul 2022, 10:09
                    0
                    • - -pickupy
                      1 Jul 2022, 03:28

                      @JoeCFD Ok, thank you very much.

                      J Offline
                      J Offline
                      JonB
                      wrote on 1 Jul 2022, 10:09 last edited by
                      #9

                      @pickupy
                      QProcess is cross-platform, but the way you do it with an OS command and xdotool is not. So it really doesn't matter how you invoke it....

                      - 1 Reply Last reply 11 Jul 2022, 08:28
                      0
                      • J JonB
                        1 Jul 2022, 10:09

                        @pickupy
                        QProcess is cross-platform, but the way you do it with an OS command and xdotool is not. So it really doesn't matter how you invoke it....

                        - Offline
                        - Offline
                        -pickupy
                        wrote on 11 Jul 2022, 08:28 last edited by
                        #10

                        @JonB OK

                        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