[Solved] Using Standard KeyCodes
-
Hi
On my embedded device I am getting keycodes by RS232 which I then send to the active widget.@QWidget *ActWidget = QApplication::focusWidget();
if(ActWidget)
{ datastring.append(inData->mid(uNextPara.l += 1, uLenNextPara.c[0]));
QKeyEvent keyPress(QEvent::KeyPress, datastring.toULong(), Qt::NoModifier);
QApplication::sendEvent(ActWidget, &keyPress);
QKeyEvent keyRelease(QEvent::KeyRelease, datastring.toULong(), Qt::NoModifier);
QApplication::sendEvent(ActWidget, &keyRelease); }
@
This works as supposed.
I now want to use standard keycodes (http://www.asquare.net/javascript/tests/KeyCode.html) instead of the rather unusual Qt value like 0x1000001 for a Tab.
Is there any standard function available in Qt that translates from standard Keycodes to the Qt value? -
Hi,
What version of Qt are you currently using ?
-
I am bound to 4.6.3 on the embedded Linux Device.
-
Then have a look at the QKeyMapper class, however beware it's a private API
-
I did take a look. As far as I could see that does not bring a quick and easy solution for me.
I think I'm going to write a simple lookup function/pointer and add a table.Thanks anyway.
-
That's a quick and clean solution :)
Happy coding !