Commit e47c76c0 authored by Christoffer Ackelman's avatar Christoffer Ackelman

QT: Lowercase letters can now be entered in Glow widgets, apparently QT uses...

QT: Lowercase letters can now be entered in Glow widgets, apparently QT uses the same keycode for both upper and lowercase letters.
parent b69954f9
...@@ -281,19 +281,16 @@ void GlowDrawQt::event_handler(QEvent* event, QWidget* target) ...@@ -281,19 +281,16 @@ void GlowDrawQt::event_handler(QEvent* event, QWidget* target)
switch (event->type()) { switch (event->type()) {
case QEvent::KeyPress: { case QEvent::KeyPress: {
QKeyEvent* keyEvent = ((QKeyEvent*)event); QKeyEvent* keyEvent = ((QKeyEvent*)event);
int keysym; if (keyEvent->key() >= Qt::Key_Space && keyEvent->key() <= Qt::Key_AsciiTilde) {
const char *buff = qPrintable(keyEvent->text());
keysym = keyEvent->key();
if (keysym >= Qt::Key_Space && keysym <= Qt::Key_AsciiTilde) {
char buff = QChar(keysym).toAscii();
if (keyEvent->modifiers() & Qt::ControlModifier) { if (keyEvent->modifiers() & Qt::ControlModifier) {
sts = ctx->event_handler(glow_eEvent_Key_CtrlAscii, 0, 0, buff, 0); sts = ctx->event_handler(glow_eEvent_Key_CtrlAscii, 0, 0, buff[0], 0);
} else { } else {
sts = ctx->event_handler(glow_eEvent_Key_Ascii, 0, 0, buff, 0); sts = ctx->event_handler(glow_eEvent_Key_Ascii, 0, 0, buff[0], 0);
} }
} else { } else {
switch (keysym) { switch (keyEvent->key()) {
case Qt::Key_Return: case Qt::Key_Return:
case Qt::Key_Enter: case Qt::Key_Enter:
sts = ctx->event_handler(glow_eEvent_Key_Return, 0, 0, 0, 0); sts = ctx->event_handler(glow_eEvent_Key_Return, 0, 0, 0, 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment