diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2009-07-16 00:04:45 (GMT) |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2009-07-16 00:04:45 (GMT) |
commit | b2797c66343ba0cc2e276c7f24e512b59788b6f7 (patch) | |
tree | 5c41b4262b10106703ed3be5526407823dc9c631 /src/declarative | |
parent | fc2079629946879b7adef2bcd58aac6726588387 (diff) | |
download | Qt-b2797c66343ba0cc2e276c7f24e512b59788b6f7.zip Qt-b2797c66343ba0cc2e276c7f24e512b59788b6f7.tar.gz Qt-b2797c66343ba0cc2e276c7f24e512b59788b6f7.tar.bz2 |
Get KeyProxy working correctly with focus realms.
Diffstat (limited to 'src/declarative')
-rw-r--r-- | src/declarative/fx/qfxkeyproxy.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/declarative/fx/qfxkeyproxy.cpp b/src/declarative/fx/qfxkeyproxy.cpp index f07691a..298751f 100644 --- a/src/declarative/fx/qfxkeyproxy.cpp +++ b/src/declarative/fx/qfxkeyproxy.cpp @@ -102,11 +102,13 @@ QList<QFxItem *> *QFxKeyProxy::targets() const void QFxKeyProxy::keyPressEvent(QKeyEvent *e) { + if (!scene()) + return; if (!d->inPress) { d->inPress = true; for (int ii = 0; ii < d->targets.count(); ++ii) { - QFxItem *i = d->targets.at(ii); //### FocusRealm - if (i && scene()) + QFxItem *i = qobject_cast<QFxItem *>(scene()->focusItem(d->targets.at(ii))); + if (i) scene()->sendEvent(i, e); if (e->isAccepted()) { d->inPress = false; @@ -119,11 +121,13 @@ void QFxKeyProxy::keyPressEvent(QKeyEvent *e) void QFxKeyProxy::keyReleaseEvent(QKeyEvent *e) { + if (!scene()) + return; if (!d->inRelease) { d->inRelease = true; for (int ii = 0; ii < d->targets.count(); ++ii) { - QFxItem *i = d->targets.at(ii); //### FocusRealm - if (i && scene()) + QFxItem *i = qobject_cast<QFxItem *>(scene()->focusItem(d->targets.at(ii))); + if (i) scene()->sendEvent(i, e); if (e->isAccepted()) { d->inRelease = false; @@ -136,11 +140,13 @@ void QFxKeyProxy::keyReleaseEvent(QKeyEvent *e) void QFxKeyProxy::inputMethodEvent(QInputMethodEvent *e) { + if (!scene()) + return; if (!d->inIM) { d->inIM = true; for (int ii = 0; ii < d->targets.count(); ++ii) { - QFxItem *i = d->targets.at(ii); //### FocusRealm - if (i && scene()) + QFxItem *i = qobject_cast<QFxItem *>(scene()->focusItem(d->targets.at(ii))); + if (i) scene()->sendEvent(i, e); if (e->isAccepted()) { d->inIM = false; |