summaryrefslogtreecommitdiffstats
path: root/src/declarative/graphicsitems/qdeclarativeitem.cpp
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2010-07-12 06:21:34 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2010-07-13 00:00:39 (GMT)
commit686fca1c78e6d4d2ba597dd75d982c76647c7707 (patch)
treefaa3b83407b4ec02efe1b57e5eec5efc0770e956 /src/declarative/graphicsitems/qdeclarativeitem.cpp
parent8979501336a441e585d38b711ee0fe4a284040f3 (diff)
downloadQt-686fca1c78e6d4d2ba597dd75d982c76647c7707.zip
Qt-686fca1c78e6d4d2ba597dd75d982c76647c7707.tar.gz
Qt-686fca1c78e6d4d2ba597dd75d982c76647c7707.tar.bz2
wantsFocus should be based on FocusScope chain, not parent chain.
Ancestors of the item with focus should only report wantsFocus as true when they are a FocusScope or a top-level item. Reviewed-by: Aaron Kennedy Reviewed-by: Yann Bodson
Diffstat (limited to 'src/declarative/graphicsitems/qdeclarativeitem.cpp')
-rw-r--r--src/declarative/graphicsitems/qdeclarativeitem.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp
index f5ea537..62a3215 100644
--- a/src/declarative/graphicsitems/qdeclarativeitem.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp
@@ -2416,6 +2416,8 @@ QDeclarativeItem *QDeclarativeItem::childAt(qreal x, qreal y) const
void QDeclarativeItemPrivate::focusChanged(bool flag)
{
Q_Q(QDeclarativeItem);
+ if (!(flags & QGraphicsItem::ItemIsFocusScope) && parent)
+ emit q->wantsFocusChanged(flag); //see also QDeclarativeItemPrivate::subFocusItemChange()
emit q->focusChanged(flag);
}
@@ -3107,7 +3109,10 @@ void QDeclarativeItem::setSize(const QSizeF &size)
/*! \internal */
bool QDeclarativeItem::wantsFocus() const
{
- return focusItem() != 0;
+ Q_D(const QDeclarativeItem);
+ return focusItem() == this ||
+ (d->flags & QGraphicsItem::ItemIsFocusScope && focusItem() != 0) ||
+ (!parentItem() && focusItem() != 0);
}
/*!