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. Set global shortcuts

Set global shortcuts

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 3 Posters 755 Views 2 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.
  • H Offline
    H Offline
    hbatalha
    wrote on last edited by
    #1

    I need to set shortcut for my app that works even when it's hidden or minimized.
    With this library I can get what I want but it uses Qt5 which is a deal breaker for me since my app is already written in Qt6 and going back will break a lot stuff. I tried QShortcut but it only works when the app is shown and active.

    Is there a way to achieve this?

    jsulmJ 1 Reply Last reply
    0
    • H hbatalha

      I need to set shortcut for my app that works even when it's hidden or minimized.
      With this library I can get what I want but it uses Qt5 which is a deal breaker for me since my app is already written in Qt6 and going back will break a lot stuff. I tried QShortcut but it only works when the app is shown and active.

      Is there a way to achieve this?

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @hbatalha Did you try to build this lib with Qt6?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      H 1 Reply Last reply
      0
      • jsulmJ jsulm

        @hbatalha Did you try to build this lib with Qt6?

        H Offline
        H Offline
        hbatalha
        wrote on last edited by
        #3

        @jsulm Yes I am still trying but I am getting some errors that I haven't got past yet and it got me wondering if could be a better solution for my prob.

        mrjjM 1 Reply Last reply
        0
        • H hbatalha

          @jsulm Yes I am still trying but I am getting some errors that I haven't got past yet and it got me wondering if could be a better solution for my prob.

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @hbatalha

          Hi
          But do you need it to be cross platform or just for a single platform ?

          H 1 Reply Last reply
          0
          • mrjjM mrjj

            @hbatalha

            Hi
            But do you need it to be cross platform or just for a single platform ?

            H Offline
            H Offline
            hbatalha
            wrote on last edited by
            #5

            @mrjj single platform, linux only.

            mrjjM 1 Reply Last reply
            0
            • H hbatalha

              @mrjj single platform, linux only.

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @hbatalha

              ok so you could focus on gettting
              https://github.com/Skycoder42/QHotkey/blob/master/QHotkey/qhotkey_x11.cpp
              to compile and just use that file/part.

              (assuming you are using X11 and not wieland)

              You might need to do
              sudo apt install libx11-dev
              (or similar on your concrete linux)

              to get teh X11 .h files etc

              H 1 Reply Last reply
              0
              • mrjjM mrjj

                @hbatalha

                ok so you could focus on gettting
                https://github.com/Skycoder42/QHotkey/blob/master/QHotkey/qhotkey_x11.cpp
                to compile and just use that file/part.

                (assuming you are using X11 and not wieland)

                You might need to do
                sudo apt install libx11-dev
                (or similar on your concrete linux)

                to get teh X11 .h files etc

                H Offline
                H Offline
                hbatalha
                wrote on last edited by
                #7

                @mrjj said in Set global shortcuts:

                @hbatalha

                ok so you could focus on gettting
                https://github.com/Skycoder42/QHotkey/blob/master/QHotkey/qhotkey_x11.cpp
                to compile and just use that file/part.

                (assuming you are using X11 and not wieland)

                You might need to do
                sudo apt install libx11-dev
                (or similar on your concrete linux)

                to get teh X11 .h files etc

                That's what I did: I took only the needed files (namely qhotkey_x11.cpp, qhotkey_p.h, qhotkey.h and qhotkey.cpp) but I get an error in qhotkey_x11.cpp file line 51 stating :

                 error: field type '(anonymous namespace)::Q_QGS_hotkeyPrivate::Type' (aka 'QHotkeyPrivateX11') is an abstract class
                

                I can't fix this.

                The error refers to this line:

                NATIVE_INSTANCE(QHotkeyPrivateX11)
                

                Which is this macro in qhotkey_p.h in line 48.

                I don't really understand this error.

                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