mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 12:37:51 +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;
|
break;
|
||||||
}
|
}
|
||||||
case QEvent::InputMethod: {
|
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::InputMethodQuery: {
|
case QEvent::InputMethodQuery: {
|
||||||
auto window = getWindow();
|
auto window = getWindow();
|
||||||
if (window && window->activeFocusItem()) {
|
if (window && window->activeFocusItem()) {
|
||||||
event->ignore();
|
event->ignore();
|
||||||
if (QCoreApplication::sendEvent(window->activeFocusItem(), event)) {
|
if (QCoreApplication::sendEvent(window->activeFocusItem(), event)) {
|
||||||
bool eventAccepted = event->isAccepted();
|
bool eventAccepted = event->isAccepted();
|
||||||
QInputMethodQueryEvent* imqEvent = static_cast<QInputMethodQueryEvent*>(event);
|
if (event->type() == QEvent::InputMethodQuery) {
|
||||||
// this block disables the selection cursor in android which appears in
|
QInputMethodQueryEvent *imqEvent = static_cast<QInputMethodQueryEvent *>(event);
|
||||||
// the top-left corner of the screen
|
// this block disables the selection cursor in android which appears in
|
||||||
if (imqEvent->queries() & Qt::ImEnabled) {
|
// the top-left corner of the screen
|
||||||
imqEvent->setValue(Qt::ImEnabled, QVariant(false));
|
if (imqEvent->queries() & Qt::ImEnabled) {
|
||||||
|
imqEvent->setValue(Qt::ImEnabled, QVariant(false));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return eventAccepted;
|
return eventAccepted;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue