summaryrefslogtreecommitdiffstats
path: root/src/declarative/graphicsitems/qdeclarativeitem.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/declarative/graphicsitems/qdeclarativeitem.cpp')
-rw-r--r--src/declarative/graphicsitems/qdeclarativeitem.cpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp
index d19967a..bdd24b6 100644
--- a/src/declarative/graphicsitems/qdeclarativeitem.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp
@@ -1595,10 +1595,10 @@ void QDeclarativeItemPrivate::transform_clear(QDeclarativeListProperty<QGraphics
}
}
-void QDeclarativeItemPrivate::parentProperty(QObject *o, void *rv, QDeclarativeNotifierEndpoint *e)
+void QDeclarativeItemPrivate::parentProperty(QObject *o, void *rv, QDeclarativeNotifierEndpoint *e)
{
QDeclarativeItem *item = static_cast<QDeclarativeItem*>(o);
- if (e)
+ if (e)
e->connect(&item->d_func()->parentNotifier);
*((QDeclarativeItem **)rv) = item->parentItem();
}
@@ -2280,6 +2280,23 @@ QScriptValue QDeclarativeItem::mapToItem(const QScriptValue &item, qreal x, qrea
return sv;
}
+/*!
+ \qmlmethod Item::forceFocus()
+
+ Force the focus on the item.
+ This method sets the focus on the item and makes sure that all the focus scopes higher in the object hierarchy are given focus.
+*/
+void QDeclarativeItem::forceFocus()
+{
+ setFocus(true);
+ QGraphicsItem *parent = parentItem();
+ while (parent) {
+ if (parent->flags() & QGraphicsItem::ItemIsFocusScope)
+ parent->setFocus(Qt::OtherFocusReason);
+ parent = parent->parentItem();
+ }
+}
+
void QDeclarativeItemPrivate::focusChanged(bool flag)
{
Q_Q(QDeclarativeItem);