PDA

View Full Version : How to disable keyboard



garry_3peace
22nd August 2008, 10:38
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...:)

wysota
22nd August 2008, 10:56
You can try grabbing the keyboard and handling key events yourself.

garry_3peace
22nd August 2008, 11:32
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.

jpn
22nd August 2008, 11:50
Just write "grab" to the index-tab and choose appropriate topic.

garry_3peace
23rd August 2008, 06:09
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 ??

jpn
23rd August 2008, 10:29
Did you actually read what the function documentation says? After reading it, it doesn't make sense what you're saying. :)

garry_3peace
24th August 2008, 10:28
Ow Really...? :o:o
Well, I am very newbie in QT. Maybe there are some misunderstandings in reading the help. :p:p

Btw, I have try by doing this:


void keyPressEvent(QKeyEvent *e){
if(e->key()==16777251){
grabKeyboard();
}
}

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.

wysota
24th August 2008, 19:07
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...

garry_3peace
27th August 2008, 15:20
Oow... Hm.. OK.. I understand what do you mean now.. :)

phillip_Qt
27th October 2009, 05:17
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.