From c3c67a1081f992525cca03430b7cba78915409b3 Mon Sep 17 00:00:00 2001 From: Andreas Aardal Hanssen Date: Fri, 31 Jul 2009 05:23:36 +0200 Subject: Remove unused include. Reviewed-by: TrustMe --- src/gui/graphicsview/qgraphicsitem.h | 1 - 1 file changed, 1 deletion(-) 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 #include #include -#include class tst_QGraphicsItem; -- cgit v0.12 From e5e13c7b3e609006579331b01caf99d680b9f552 Mon Sep 17 00:00:00 2001 From: Andreas Aardal Hanssen Date: Fri, 31 Jul 2009 06:36:07 +0200 Subject: Fix compile breakage in 638fd43 by using QGraphicsItem::focusProxy(). Turned out this functionality was in used after all, although calling "git grep" didn't reveal its usage. Reviewed-by: Michael Brasser --- src/declarative/fx/qfxkeyproxy.cpp | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 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 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(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(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(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(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(i)->doInputMethodQuery(query); + QVariant v = static_cast(i)->doInputMethodQuery(query); if (v.type() == QVariant::RectF) v = mapRectFromItem(i, v.toRectF()); //### cost? return v; -- cgit v0.12