Qt-interest Archive, February 2007
Detecting caps lock, system settings, etc.?
Message 1 in thread
Hi.
1) Does anyone know whether it is possible to detect caps lock is
activated on the system using QT library? I am using Windows but would
prefer a solution that does it in windows and linux using one code base.
I am guessing not but could someone please confirm?
2) How do I activate/deactivate caps lock with QT library if it is possible?
Thanks in advanced.
Jason.
--
[ signature omitted ]
Message 2 in thread
Jason M. a écrit :
> Hi.
>
> 1) Does anyone know whether it is possible to detect caps lock is
> activated on the system using QT library? I am using Windows but would
> prefer a solution that does it in windows and linux using one code
> base. I am guessing not but could someone please confirm?
wait for Qt::Key_CapsLock type in a qkeyevent handler or event filter
when event is QEvent::KeyPress?
>
> 2) How do I activate/deactivate caps lock with QT library if it is
> possible?
don't know :-(
>
> Thanks in advanced.
> Jason.
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
>
--
[ signature omitted ]
Message 3 in thread
veronique.lefrere@xxxxxx wrote:
> Jason M. a écrit :
>
>> Hi.
>>
>> 1) Does anyone know whether it is possible to detect caps lock is
>> activated on the system using QT library? I am using Windows but would
>> prefer a solution that does it in windows and linux using one code
>> base. I am guessing not but could someone please confirm?
>
> wait for Qt::Key_CapsLock type in a qkeyevent handler or event filter
> when event is QEvent::KeyPress?
Thanks Veronique for the fast reply. I am new to QT so my apologies if I
am a little lost. I think the suggestion is one way to detect caps lock
but it is a polling method i.e. application waiting for the caps lock
key to be pressed or not.
I am looking for a method that will allow me to get a keyboard state
e.g. GetKeyboardState( VK_CAPSLOCK ) or something because this method is
closer to what I am looking for.
I could use the first method if you could teach me a little more.
Thank you again.
Jason.
--
[ signature omitted ]
Message 4 in thread
Qt does not have a way to get key states that I have been able to find. I
had to write separate handlers for each platform to detect the current key
states without processing events. This is easy on Windows, more difficult on
Unix (X-Windows), and nearly impossible on Mac (I have not gotten the Mac
version to work yet).
I need to detect whether an "interrupt" key (Control-Period) is currently
held down. I cannot process the event queue to do this because there may be
pending events that need to be interrupted and because the processing would
foul up the script that is running.
Keith
On 02-19-2007 10:47 AM, "Jason M." wrote:
> veronique.lefrere@xxxxxx wrote:
>> Jason M. a écrit :
>>
>>> Hi.
>>>
>>> 1) Does anyone know whether it is possible to detect caps lock is
>>> activated on the system using QT library? I am using Windows but would
>>> prefer a solution that does it in windows and linux using one code
>>> base. I am guessing not but could someone please confirm?
>>
>> wait for Qt::Key_CapsLock type in a qkeyevent handler or event filter
>> when event is QEvent::KeyPress?
>
> Thanks Veronique for the fast reply. I am new to QT so my apologies if I
> am a little lost. I think the suggestion is one way to detect caps lock
> but it is a polling method i.e. application waiting for the caps lock
> key to be pressed or not.
>
> I am looking for a method that will allow me to get a keyboard state
> e.g. GetKeyboardState( VK_CAPSLOCK ) or something because this method is
> closer to what I am looking for.
>
> I could use the first method if you could teach me a little more.
>
> Thank you again.
> Jason.
--
[ signature omitted ]