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. On linux platform, could I set a shortcut key through QT

On linux platform, could I set a shortcut key through QT

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 2 Posters 490 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.
  • C Offline
    C Offline
    chris_rookie
    wrote on last edited by
    #1

    On linux platform, could I set a shortcut key through QT. Or Could I monitor combination key input.
    Such as others input Ctrl and A at the same time.

    JonBJ 1 Reply Last reply
    0
    • C chris_rookie

      On linux platform, could I set a shortcut key through QT. Or Could I monitor combination key input.
      Such as others input Ctrl and A at the same time.

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

      @chris_rookie
      If you mean can a Qt program recognise keypresses like Ctrl plus A at the same time, and act on it, then yes.
      If you mean can you write a Qt program which will recognise/change keypresses in another program, then no (so far as i am aware).

      C 2 Replies Last reply
      0
      • JonBJ JonB

        @chris_rookie
        If you mean can a Qt program recognise keypresses like Ctrl plus A at the same time, and act on it, then yes.
        If you mean can you write a Qt program which will recognise/change keypresses in another program, then no (so far as i am aware).

        C Offline
        C Offline
        chris_rookie
        wrote on last edited by
        #3

        @JonB
        ok, How can I recognise keypresses like Ctrl plus A at the same time.
        could you give a demo or just a link.

        1 Reply Last reply
        0
        • JonBJ JonB

          @chris_rookie
          If you mean can a Qt program recognise keypresses like Ctrl plus A at the same time, and act on it, then yes.
          If you mean can you write a Qt program which will recognise/change keypresses in another program, then no (so far as i am aware).

          C Offline
          C Offline
          chris_rookie
          wrote on last edited by
          #4

          @JonB
          I mean that Could I set a shortcut key to open another program through QT.

          JonBJ 1 Reply Last reply
          0
          • C chris_rookie

            @JonB
            I mean that Could I set a shortcut key to open another program through QT.

            JonBJ Offline
            JonBJ Offline
            JonB
            wrote on last edited by
            #5

            @chris_rookie
            https://doc.qt.io/qt-5/qkeyevent.html gives all the calls for recognising keypresses, including "modifiers" like Ctrl.
            https://doc.qt.io/qt-5/qshortcut.html, higher level, is probably even better for you:

            The QShortcut class provides a way of connecting keyboard shortcuts to Qt's signals and slots mechanism, so that objects can be informed when a shortcut is executed. The shortcut can be set up to contain all the key presses necessary to describe a keyboard shortcut, including the states of modifier keys such as Shift, Ctrl, and Alt.

            Then if you wanted to run another program you do that via https://doc.qt.io/qt-5/qprocess.html.

            C 1 Reply Last reply
            2
            • JonBJ JonB

              @chris_rookie
              https://doc.qt.io/qt-5/qkeyevent.html gives all the calls for recognising keypresses, including "modifiers" like Ctrl.
              https://doc.qt.io/qt-5/qshortcut.html, higher level, is probably even better for you:

              The QShortcut class provides a way of connecting keyboard shortcuts to Qt's signals and slots mechanism, so that objects can be informed when a shortcut is executed. The shortcut can be set up to contain all the key presses necessary to describe a keyboard shortcut, including the states of modifier keys such as Shift, Ctrl, and Alt.

              Then if you wanted to run another program you do that via https://doc.qt.io/qt-5/qprocess.html.

              C Offline
              C Offline
              chris_rookie
              wrote on last edited by
              #6

              @JonB
              Thank you so 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