Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Trigger keyboard shortcut keys using button widget.
Forum Updated to NodeBB v4.3 + New Features

Trigger keyboard shortcut keys using button widget.

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
5 Posts 3 Posters 352 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.
  • B Offline
    B Offline
    Bonty
    wrote on 23 May 2024, 10:44 last edited by
    #1

    Hi,

    How can I trigger keyboard shortcut key(eg. ctrl+o) by clicking button widget?

    Please help!!

    1 Reply Last reply
    0
    • A Offline
      A Offline
      Axel Spoerl
      Moderators
      wrote on 23 May 2024, 12:00 last edited by
      #2

      A keyboard shortcut is supposed to be triggered by entering the specified key sequence. An external trigger is not implemented. If it appears to be needed, there is something wrong in the application design.

      Whatever is connected to QShortCut::activated, can be connected in parallel to QPushButton::clicked. That gives you the expected result.

      Software Engineer
      The Qt Company, Oslo

      1 Reply Last reply
      3
      • B Offline
        B Offline
        Bonty
        wrote on 24 May 2024, 04:39 last edited by
        #3

        Hi @Axel-Spoerl ,

        Thanks for replying!

        I have to develop application to record wayland/weston screen. Keyboard(super+r) is working fine but I didn't find command line tool to record screen. So I decided to map keyboard shortcuts.

        Please help!!

        1 Reply Last reply
        0
        • J Offline
          J Offline
          JonB
          wrote on 24 May 2024, 07:38 last edited by
          #4

          @Axel-Spoerl, and I, thought you meant a keyboard shortcut within a Qt application you are writing, e.g. to trigger its menus. For that you should call the slot directly instead. But are you talking about some global keyboard shortcut recognised and dealt with by the desktop window/keyboard manager, nothing to do with a Qt application? You just happen to want to invoke that from a Qt application you are writing, but the key shortcut is aimed at the desktop manager?

          1 Reply Last reply
          0
          • A Offline
            A Offline
            Axel Spoerl
            Moderators
            wrote on 24 May 2024, 08:59 last edited by Axel Spoerl
            #5

            The question in this thread is how to trigger a keyboard shortcut, e.g. with a "button widget".
            That's quite different from a screen recorder. Keeping us in the dark is stealing volunteers' time.

            If you want to record key events (and probably mouse events, too), you need to install an event filter on the recording level (if you want to record everything, QApplication level - respectively qApp->installEventFilter(filterObject)). There you can intercept and record all events needed.

            Keep in mind, that for security reasons the window manager "keep" certain shortcuts for itself. For instance, the application will not even see CTRL+ALT+DEL (or what ever is the screen-lock shortcut on your system).

            Software Engineer
            The Qt Company, Oslo

            1 Reply Last reply
            0

            1/5

            23 May 2024, 10:44

            • Login

            • Login or register to search.
            1 out of 5
            • First post
              1/5
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved