summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com>2009-07-31 04:36:07 (GMT)
committerAndreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com>2009-07-31 04:39:52 (GMT)
commite5e13c7b3e609006579331b01caf99d680b9f552 (patch)
tree5b03041b3275e52ed5584e97dc48bf37cd533acd /src
parentc3c67a1081f992525cca03430b7cba78915409b3 (diff)
downloadQt-e5e13c7b3e609006579331b01caf99d680b9f552.zip
Qt-e5e13c7b3e609006579331b01caf99d680b9f552.tar.gz
Qt-e5e13c7b3e609006579331b01caf99d680b9f552.tar.bz2
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
Diffstat (limited to 'src')
-rw-r--r--src/declarative/fx/qfxkeyproxy.cpp24
1 files 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<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;