mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-07 10:42:35 +02:00
Refactor fix for keyboard crash
This commit is contained in:
parent
e744edc6a0
commit
d0f1aa9020
1 changed files with 8 additions and 16 deletions
|
@ -181,28 +181,20 @@ bool OffscreenSurface::eventFilter(QObject* originalDestination, QEvent* event)
|
|||
}
|
||||
break;
|
||||
}
|
||||
case QEvent::InputMethod: {
|
||||
auto window = getWindow();
|
||||
if (window && window->activeFocusItem()) {
|
||||
event->ignore();
|
||||
if (QCoreApplication::sendEvent(window->activeFocusItem(), event)) {
|
||||
return event->isAccepted();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case QEvent::InputMethod:
|
||||
case QEvent::InputMethodQuery: {
|
||||
auto window = getWindow();
|
||||
if (window && window->activeFocusItem()) {
|
||||
event->ignore();
|
||||
if (QCoreApplication::sendEvent(window->activeFocusItem(), event)) {
|
||||
bool eventAccepted = event->isAccepted();
|
||||
QInputMethodQueryEvent* imqEvent = static_cast<QInputMethodQueryEvent*>(event);
|
||||
// this block disables the selection cursor in android which appears in
|
||||
// the top-left corner of the screen
|
||||
if (imqEvent->queries() & Qt::ImEnabled) {
|
||||
imqEvent->setValue(Qt::ImEnabled, QVariant(false));
|
||||
if (event->type() == QEvent::InputMethodQuery) {
|
||||
QInputMethodQueryEvent *imqEvent = static_cast<QInputMethodQueryEvent *>(event);
|
||||
// this block disables the selection cursor in android which appears in
|
||||
// the top-left corner of the screen
|
||||
if (imqEvent->queries() & Qt::ImEnabled) {
|
||||
imqEvent->setValue(Qt::ImEnabled, QVariant(false));
|
||||
}
|
||||
}
|
||||
return eventAccepted;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue