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 to detect key stroke/pressing combinations and disable them
Forum Updated to NodeBB v4.3 + New Features

How to detect key stroke/pressing combinations and disable them

Scheduled Pinned Locked Moved General and Desktop
17 Posts 5 Posters 7.6k 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.
  • U Offline
    U Offline
    umen242
    wrote on last edited by
    #1

    Hello im building full screen application , and i need to control the key stroke/pressing
    combination like : windows + d , ctrl+alt+dll , alt+tab and so on..
    what is the best way to do such handler ?

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dangelog
      wrote on last edited by
      #2

      Platform specific code. Those keys are not even passed to an application.

      Software Engineer
      KDAB (UK) Ltd., a KDAB Group company

      1 Reply Last reply
      0
      • U Offline
        U Offline
        umen242
        wrote on last edited by
        #3

        sorry i didn't understand

        1 Reply Last reply
        0
        • L Offline
          L Offline
          lgeyer
          wrote on last edited by
          #4

          I do not know for the others but there are certain key stroke combinations you cannot disable. CTRL+ALT+DEL is one of them.

          1 Reply Last reply
          0
          • U Offline
            U Offline
            umen242
            wrote on last edited by
            #5

            ok but what about the others?

            1 Reply Last reply
            0
            • G Offline
              G Offline
              goetz
              wrote on last edited by
              #6

              Alt-Tab is handled by the OS too and used to switch applications.

              Unless you want to outrage your users you should not even think about fiddling around with that key sequences!

              http://www.catb.org/~esr/faqs/smart-questions.html

              1 Reply Last reply
              0
              • U Offline
                U Offline
                umen242
                wrote on last edited by
                #7

                i need it with users agreed , its terminal application

                1 Reply Last reply
                0
                • G Offline
                  G Offline
                  goetz
                  wrote on last edited by
                  #8

                  As peppe already mentioned, you will have to resort to platform specific code then. Qt provides no means to intercept this (wich is a good thing™ - IMHO).

                  http://www.catb.org/~esr/faqs/smart-questions.html

                  1 Reply Last reply
                  0
                  • U Offline
                    U Offline
                    umen242
                    wrote on last edited by
                    #9

                    ho no problem , i i know that Qt dosnt have any " automatic"
                    handler for this , i juts wanted to know which best "pattern"
                    or way to handle this

                    1 Reply Last reply
                    0
                    • L Offline
                      L Offline
                      lgeyer
                      wrote on last edited by
                      #10

                      I would go for "RegisterHotKey":http://goo.gl/KAD5K, which should work for any combinations besides CTRL+ALT+DEL.

                      As far as I remember there was a possibility to disable the task manager by setting HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\DisableTaskMgr to DWORD:1 - perhaps this disables CTRL+ALT+DEL too.

                      1 Reply Last reply
                      0
                      • U Offline
                        U Offline
                        umen242
                        wrote on last edited by
                        #11

                        im looking for Qt solution , not win32

                        1 Reply Last reply
                        0
                        • L Offline
                          L Offline
                          lgeyer
                          wrote on last edited by
                          #12

                          Well, i thought we agreed that there is no Qt solution and that you will have to use platform specific code.
                          [quote author="peppe" date="1317060189"]Platform specific code. Those keys are not even passed to an application.[/quote]
                          [quote author="Volker" date="1317067782"]As peppe already mentioned, you will have to resort to platform specific code then. Qt provides no means to intercept this (wich is a good thing™ - IMHO).[/quote]
                          [quote author="umen242" date="1317095537"]ho no problem , i i know that Qt dosnt have any " automatic" handler for this , i juts wanted to know which best "pattern"
                          or way to handle this [/quote]

                          1 Reply Last reply
                          0
                          • U Offline
                            U Offline
                            umen242
                            wrote on last edited by
                            #13

                            why there is no ? i dont understand , there is keyevents in Qt , i just need good algorithm to use it right . basically i didn't what to write something if there is already implementation

                            1 Reply Last reply
                            0
                            • L Offline
                              L Offline
                              lgeyer
                              wrote on last edited by
                              #14

                              Probably an third-party library like "Qxt":http://libqxt.bitbucket.org/doc/tip/qxtglobalshortcut.html might provide what you are looking for.

                              1 Reply Last reply
                              0
                              • G Offline
                                G Offline
                                goetz
                                wrote on last edited by
                                #15

                                [quote author="umen242" date="1317109307"]why there is no ? i dont understand , there is keyevents in Qt [/quote]

                                Start reading and understanding before crying about things you cannot change. The answers have been given already.

                                [quote author="peppe" date="1317060189"]Platform specific code. Those keys are not even passed to an application.[/quote]

                                [quote author="Volker" date="1317065718"]Alt-Tab is handled by the OS too and used to switch applications.

                                Unless you want to outrage your users you should not even think about fiddling around with that key sequences![/quote]

                                And regarding the rest:

                                [quote author="umen242" date="1317109307"]i just need good algorithm to use it right . basically i didn't what to write something if there is already implementation [/quote]

                                You have been told multiple times that there is no platform independent means in Qt. Crying out loudly will not change this situation in any bit involved. So I suggest you save your time and start coding.

                                http://www.catb.org/~esr/faqs/smart-questions.html

                                1 Reply Last reply
                                0
                                • U Offline
                                  U Offline
                                  umen242
                                  wrote on last edited by
                                  #16

                                  ok ...

                                  1 Reply Last reply
                                  0
                                  • G Offline
                                    G Offline
                                    giesbert
                                    wrote on last edited by
                                    #17

                                    Qt is meant to write applications that run in a platform independent way, for the most parts. There might be some that will not be handled by Qt, e.g. if you want to do some stuff that is rearly used, like hooking system events and handle them instead leaving them to the system.

                                    Those things must be done in an OS dependent way. QT is no 100% OS abstraction, otherwise it would have to emulate all features that windows has and Linux not on Linux and perhaps on MAC, and vice versa.

                                    Nokia Certified Qt Specialist.
                                    Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

                                    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