Results 1 to 10 of 10

Thread: How to disable keyboard

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Aug 2008
    Posts
    12
    Thanks
    1
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default How to disable keyboard

    Is there any possibility to disable the keyboard key globally. I am trying to make a lock screen program. And I am trying to disable the Alt, Ctrl, Esc, Tab and Backspace key. ? Thank's before...

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to disable keyboard

    You can try grabbing the keyboard and handling key events yourself.

  3. #3
    Join Date
    Aug 2008
    Posts
    12
    Thanks
    1
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: How to disable keyboard

    Thank you for your quick reply. I have heard it but I don't know how to use it. Maybe I have to read the QT Assistant. At which section should I read anyway.

  4. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: How to disable keyboard

    Just write "grab" to the index-tab and choose appropriate topic.
    J-P Nurmi

  5. #5
    Join Date
    Aug 2008
    Posts
    12
    Thanks
    1
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: How to disable keyboard

    Hm... I have try to type "grabkeyboard" and it show one method. But this method is seem like to get focus. That's why, I don't think that's the key. Or am I wrong in reading the help? Coz the grabKeyboard() method doesn't return value, nor get parameter. So how could I handle some of the key.

    Or maybe I must use QKeyEvent ??

  6. #6
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: How to disable keyboard

    Did you actually read what the function documentation says? After reading it, it doesn't make sense what you're saying.
    J-P Nurmi

  7. #7
    Join Date
    Aug 2008
    Posts
    12
    Thanks
    1
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: How to disable keyboard

    Ow Really...?
    Well, I am very newbie in QT. Maybe there are some misunderstandings in reading the help.

    Btw, I have try by doing this:

    Qt Code:
    1. void keyPressEvent(QKeyEvent *e){
    2. if(e->key()==16777251){
    3. grabKeyboard();
    4. }
    5. }
    To copy to clipboard, switch view to plain text mode 
    But the effect of this code, the program become hang. Cannot be resize or anything except the close button on the top right, to close the program.

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to disable keyboard

    Did you read until that part?

    This widget receives all keyboard events until releaseKeyboard() is called; other widgets get no keyboard events at all.
    You don't call it when you receive a key event - you call it to prevent other widgets from receiving key events. And it also says you have to eventually release the keyboard...

  9. #9
    Join Date
    Aug 2008
    Posts
    12
    Thanks
    1
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: How to disable keyboard

    Oow... Hm.. OK.. I understand what do you mean now..

  10. #10
    Join Date
    Oct 2007
    Posts
    201
    Thanks
    19
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Smile Re: How to disable keyboard

    Quote Originally Posted by garry_3peace View Post
    Is there any possibility to disable the keyboard key globally. I am trying to make a lock screen program. And I am trying to disable the Alt, Ctrl, Esc, Tab and Backspace key. ? Thank's before...
    Hi
    just one question, did u able to disable the keyboard? R u doing this in linux? I'm trying to find help for same (disable keyboard and mouse press event in linux using QT) , but could not find much more. Your kind reply may help me a lot.

    Thanks.
    Cheers,
    Phillip



    --- Please post the solution you got to solve your problem. It may help others.

Similar Threads

  1. On Screen Keyboard Problem
    By cutie.monkey in forum Qt Programming
    Replies: 1
    Last Post: 16th July 2008, 13:28
  2. How to disable NextButton in QWizard ?
    By litroncn in forum Qt Programming
    Replies: 3
    Last Post: 27th May 2008, 07:05
  3. Virtual Keyboard on Qtopia 4.2.1
    By shapirlex in forum Qt for Embedded and Mobile
    Replies: 2
    Last Post: 11th April 2007, 15:51
  4. Replies: 2
    Last Post: 24th July 2006, 18:36

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.