diff options
author | Martin Jones <martin.jones@nokia.com> | 2010-10-08 04:17:05 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2010-10-08 04:17:05 (GMT) |
commit | 762b03e1ae83ffd66965810e1d70326b364115f5 (patch) | |
tree | e65d8a7b28f28ed607aee6d17924c258ddc223be /src/declarative/graphicsitems | |
parent | 5447a9590dc0efa1a79fde6235fdcf76d3ae81fe (diff) | |
download | Qt-762b03e1ae83ffd66965810e1d70326b364115f5.zip Qt-762b03e1ae83ffd66965810e1d70326b364115f5.tar.gz Qt-762b03e1ae83ffd66965810e1d70326b364115f5.tar.bz2 |
Don't forward keys to invisible items.
Task-number: QTBUG-13685
Reviewed-by: Michael Brasser
Diffstat (limited to 'src/declarative/graphicsitems')
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativeitem.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp index 735698e..51eb5f2 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp @@ -1180,7 +1180,7 @@ void QDeclarativeKeysAttached::keyPressed(QKeyEvent *event, bool post) d->inPress = true; for (int ii = 0; ii < d->targets.count(); ++ii) { QGraphicsItem *i = d->finalFocusProxy(d->targets.at(ii)); - if (i) { + if (i && i->isVisible()) { d->item->scene()->sendEvent(i, event); if (event->isAccepted()) { d->inPress = false; @@ -1222,7 +1222,7 @@ void QDeclarativeKeysAttached::keyReleased(QKeyEvent *event, bool post) d->inRelease = true; for (int ii = 0; ii < d->targets.count(); ++ii) { QGraphicsItem *i = d->finalFocusProxy(d->targets.at(ii)); - if (i) { + if (i && i->isVisible()) { d->item->scene()->sendEvent(i, event); if (event->isAccepted()) { d->inRelease = false; @@ -1247,7 +1247,7 @@ void QDeclarativeKeysAttached::inputMethodEvent(QInputMethodEvent *event, bool p d->inIM = true; for (int ii = 0; ii < d->targets.count(); ++ii) { QGraphicsItem *i = d->finalFocusProxy(d->targets.at(ii)); - if (i && (i->flags() & QGraphicsItem::ItemAcceptsInputMethod)) { + if (i && i->isVisible() && (i->flags() & QGraphicsItem::ItemAcceptsInputMethod)) { d->item->scene()->sendEvent(i, event); if (event->isAccepted()) { d->imeItem = i; @@ -1275,7 +1275,7 @@ QVariant QDeclarativeKeysAttached::inputMethodQuery(Qt::InputMethodQuery query) if (d->item) { for (int ii = 0; ii < d->targets.count(); ++ii) { QGraphicsItem *i = d->finalFocusProxy(d->targets.at(ii)); - if (i && (i->flags() & QGraphicsItem::ItemAcceptsInputMethod) && i == d->imeItem) { //### how robust is i == d->imeItem check? + if (i && i->isVisible() && (i->flags() & QGraphicsItem::ItemAcceptsInputMethod) && i == d->imeItem) { //### how robust is i == d->imeItem check? QVariant v = static_cast<QDeclarativeItemAccessor *>(i)->doInputMethodQuery(query); if (v.userType() == QVariant::RectF) v = d->item->mapRectFromItem(i, v.toRectF()); //### cost? |