Please nominate your Qt Champions for 2021! https://forum.qt.io/topic/132134/looking-for-the-2021-qt-champions
Qt::Key and QKeyEvent issues (on-screen keyboard)
coderr last edited by
i'm working on an on-screen keyboard which is fully customizable using an an xml-configuration, which i just have to use.
all i get is a) position, size, ... b) key code (Esc, A, ...) for the keys, which i can map to Qt::Key.
then i have to send the according QKeyEvent upon a button click.
now when an Qt::Key_A-button and Qt::Key_Shift is pressed, i can guess it's a capital A. but depending on the system's keyboard layout, many keys change in combination with a modifier.
is there a way to convert a Qt::Key+Qt::KeyboardModifier to the resulting Qt::Key, depending on the OS's keyboard layout (comma+shift=semicolon with a german layout, but not with us layout for example), in case the modifier modifies a specific key code at all?
is there a way to know if a given Qt::Key is generating a printable character (maybe even which one it is exactly, convert it to QChar or QString)?
thanks alot in advance! i searched around, tried many approaches, but didn't really solve these issues yet ...
p.s.: "is there a way ..." in this case means "is there a Qt-way which is platform independant, as is Qt" ;-)
and sorry if my english doesn't sound that well, i tried my best.
giesbert last edited by
1.), if you ask google, there are some virtual keyboards already implemented in Qt:
"here":http://qt-apps.org/content/show.php/VirtualKeyboard?content=107388 , "here":http://qt-apps.org/content/show.php/Widget Virtual Keyboard?content=111054 and "here":http://ktouch.sourceforge.net/ for example. You can have a look at them, how they did it.
2.) If you want a customizable keyboard, you have to specify the layout in your xml file. And this layout must be language (layout :-) ) dependent. I already did that once for my company, I know now other way.
In the OS you specify, how the keyboard should be interpreted, so define the layout. That's what you also must do. Specify the keys, the behavior of shift / Ctrl / Alt / ...
We had an xml file with in general the following content:
<key size=""> <!-- n times in a key line -->
<normalState display="" keycode=""/>
<shiftState display="" keycode=""/>
<altState display="" keycode=""/>
<altGrState display="" keycode=""/>
<specialKey size="" keycode=""/> <!-- n times in a key line -->--
And we specified each keyboard layout and how to interpret it. But I know no way around...
SherifOmran last edited by
I am interested in the answer to this question, the above applications are not doing it ASFAIK.
How to determine the Qt:key of the current layout. Very simple, I need to paid a Virtual Keyboard similar to this site when I select a keyboard layout, I need the application to do it