Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 5

Qt-interest Archive, February 2007
How do I toggle caps lock on keyboard?


Message 1 in thread

Hi All.

Without resorting platform dependent API, is there a way to toggle the 
caps lock on the keyboard with QT? Would prefer if it works on Windows 
and Linux.

My code below does not work. Have I done something wrong?

QCoreApplication::postEvent( ptrToApp,
   new QKeyEvent( QEvent::KeyPress, Qt::Key_CapsLock, Qt::NoModifier ) );	

Thanks you.
Jason.

--
 [ signature omitted ] 

Message 2 in thread

Hi,

> My code below does not work. Have I done something wrong?
> 
> QCoreApplication::postEvent( ptrToApp,
>   new QKeyEvent( QEvent::KeyPress, Qt::Key_CapsLock, Qt::NoModifier ) );   

Events are posted in response to hardware key presses. You can also post 
"fake" events. However posting events will not change the state of teh 
hardware.

--
 [ signature omitted ]