mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 12:08:54 +02:00
Merge pull request #7958 from jherico/keystick_fix
fix keys getting stuck
This commit is contained in:
commit
72dc24178f
1 changed files with 4 additions and 2 deletions
|
@ -590,6 +590,7 @@ bool OffscreenUi::eventFilter(QObject* originalDestination, QEvent* event) {
|
||||||
// let the parent class do it's work
|
// let the parent class do it's work
|
||||||
bool result = OffscreenQmlSurface::eventFilter(originalDestination, event);
|
bool result = OffscreenQmlSurface::eventFilter(originalDestination, event);
|
||||||
|
|
||||||
|
|
||||||
// Check if this is a key press/release event that might need special attention
|
// Check if this is a key press/release event that might need special attention
|
||||||
auto type = event->type();
|
auto type = event->type();
|
||||||
if (type != QEvent::KeyPress && type != QEvent::KeyRelease) {
|
if (type != QEvent::KeyPress && type != QEvent::KeyRelease) {
|
||||||
|
@ -597,7 +598,8 @@ bool OffscreenUi::eventFilter(QObject* originalDestination, QEvent* event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
QKeyEvent* keyEvent = dynamic_cast<QKeyEvent*>(event);
|
QKeyEvent* keyEvent = dynamic_cast<QKeyEvent*>(event);
|
||||||
bool& pressed = _pressedKeys[keyEvent->key()];
|
auto key = keyEvent->key();
|
||||||
|
bool& pressed = _pressedKeys[key];
|
||||||
|
|
||||||
// Keep track of which key press events the QML has accepted
|
// Keep track of which key press events the QML has accepted
|
||||||
if (result && QEvent::KeyPress == type) {
|
if (result && QEvent::KeyPress == type) {
|
||||||
|
@ -607,7 +609,7 @@ bool OffscreenUi::eventFilter(QObject* originalDestination, QEvent* event) {
|
||||||
// QML input elements absorb key press, but apparently not key release.
|
// QML input elements absorb key press, but apparently not key release.
|
||||||
// therefore we want to ensure that key release events for key presses that were
|
// therefore we want to ensure that key release events for key presses that were
|
||||||
// accepted by the QML layer are suppressed
|
// accepted by the QML layer are suppressed
|
||||||
if (!result && type == QEvent::KeyRelease && pressed) {
|
if (type == QEvent::KeyRelease && pressed) {
|
||||||
pressed = false;
|
pressed = false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue