diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2009-07-31 04:44:34 (GMT) |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2009-07-31 04:44:34 (GMT) |
commit | fb6498857241eb053cbf664d6f83928cab41cc8a (patch) | |
tree | b52d6e3b7343692b7dec9eaa21ab77963d1eb315 | |
parent | c036c4196c338ee6651b44687211cb188f723a07 (diff) | |
parent | e5e13c7b3e609006579331b01caf99d680b9f552 (diff) | |
download | Qt-fb6498857241eb053cbf664d6f83928cab41cc8a.zip Qt-fb6498857241eb053cbf664d6f83928cab41cc8a.tar.gz Qt-fb6498857241eb053cbf664d6f83928cab41cc8a.tar.bz2 |
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
-rw-r--r-- | src/declarative/fx/qfxkeyproxy.cpp | 24 | ||||
-rw-r--r-- | src/gui/graphicsview/qgraphicsitem.h | 1 |
2 files changed, 16 insertions, 9 deletions
diff --git a/src/declarative/fx/qfxkeyproxy.cpp b/src/declarative/fx/qfxkeyproxy.cpp index 85ecc39..b22d686 100644 --- a/src/declarative/fx/qfxkeyproxy.cpp +++ b/src/declarative/fx/qfxkeyproxy.cpp @@ -85,12 +85,20 @@ public: QFxKeyProxyPrivate() : inPress(false), inRelease(false), inIM(false), imeItem(0) {} QList<QFxItem *> targets; + QGraphicsItem *finalFocusProxy(QGraphicsItem *item) + { + QGraphicsItem *fp; + while ((fp = item->focusProxy())) + item = fp; + return item; + } + //loop detection bool inPress:1; bool inRelease:1; bool inIM:1; - QFxItem *imeItem; + QGraphicsItem *imeItem; }; QFxKeyProxy::QFxKeyProxy(QFxItem *parent) @@ -125,7 +133,7 @@ void QFxKeyProxy::keyPressEvent(QKeyEvent *e) if (!d->inPress) { d->inPress = true; for (int ii = 0; ii < d->targets.count(); ++ii) { - QFxItem *i = qobject_cast<QFxItem *>(scene()->focusItem(d->targets.at(ii))); + QGraphicsItem *i = d->finalFocusProxy(d->targets.at(ii)); if (i) { scene()->sendEvent(i, e); if (e->isAccepted()) { @@ -145,7 +153,7 @@ void QFxKeyProxy::keyReleaseEvent(QKeyEvent *e) if (!d->inRelease) { d->inRelease = true; for (int ii = 0; ii < d->targets.count(); ++ii) { - QFxItem *i = qobject_cast<QFxItem *>(scene()->focusItem(d->targets.at(ii))); + QGraphicsItem *i = d->finalFocusProxy(d->targets.at(ii)); if (i) { scene()->sendEvent(i, e); if (e->isAccepted()) { @@ -165,7 +173,7 @@ void QFxKeyProxy::inputMethodEvent(QInputMethodEvent *e) if (!d->inIM) { d->inIM = true; for (int ii = 0; ii < d->targets.count(); ++ii) { - QFxItem *i = qobject_cast<QFxItem *>(scene()->focusItem(d->targets.at(ii))); + QGraphicsItem *i = d->finalFocusProxy(d->targets.at(ii)); if (i && (i->flags() & ItemAcceptsInputMethod)) { scene()->sendEvent(i, e); if (e->isAccepted()) { @@ -179,20 +187,20 @@ void QFxKeyProxy::inputMethodEvent(QInputMethodEvent *e) } } -class QFxItemAccessor : public QFxItem +class QFxItemAccessor : public QGraphicsItem { public: QVariant doInputMethodQuery(Qt::InputMethodQuery query) const { - return QFxItem::inputMethodQuery(query); + return QGraphicsItem::inputMethodQuery(query); } }; QVariant QFxKeyProxy::inputMethodQuery(Qt::InputMethodQuery query) const { for (int ii = 0; ii < d->targets.count(); ++ii) { - QFxItem *i = qobject_cast<QFxItem *>(scene()->focusItem(d->targets.at(ii))); + QGraphicsItem *i = d->finalFocusProxy(d->targets.at(ii)); if (i && (i->flags() & ItemAcceptsInputMethod) && i == d->imeItem) { //### how robust is i == d->imeItem check? - QVariant v = static_cast<QFxItemAccessor*>(i)->doInputMethodQuery(query); + QVariant v = static_cast<QFxItemAccessor *>(i)->doInputMethodQuery(query); if (v.type() == QVariant::RectF) v = mapRectFromItem(i, v.toRectF()); //### cost? return v; diff --git a/src/gui/graphicsview/qgraphicsitem.h b/src/gui/graphicsview/qgraphicsitem.h index c9a581c..6ceca56 100644 --- a/src/gui/graphicsview/qgraphicsitem.h +++ b/src/gui/graphicsview/qgraphicsitem.h @@ -48,7 +48,6 @@ #include <QtCore/qrect.h> #include <QtGui/qpainterpath.h> #include <QtGui/qpixmap.h> -#include <QtGui/qstyleoption.h> class tst_QGraphicsItem; |