summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2010-08-06 03:39:10 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2010-08-06 03:42:48 (GMT)
commit94b1c07c31ab84d30b198cb23291a48f98164827 (patch)
treefbbf540dfdf6772d9702bf53e2a22964db103530
parent97f64280e37f29bdeb92d6de55fac56b1ff37084 (diff)
downloadQt-94b1c07c31ab84d30b198cb23291a48f98164827.zip
Qt-94b1c07c31ab84d30b198cb23291a48f98164827.tar.gz
Qt-94b1c07c31ab84d30b198cb23291a48f98164827.tar.bz2
Top-level QML item should not have special focus handling.
It's the scene itself that acts as a focus scope, not the top-level item. Task-number: QTBUG-12682 Reviewed-by: Aaron Kennedy
-rw-r--r--src/declarative/graphicsitems/qdeclarativeitem.cpp11
-rw-r--r--tests/auto/declarative/qdeclarativefocusscope/tst_qdeclarativefocusscope.cpp2
2 files changed, 5 insertions, 8 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp
index 5b74129..ff05997 100644
--- a/src/declarative/graphicsitems/qdeclarativeitem.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp
@@ -3196,8 +3196,7 @@ bool QDeclarativeItem::hasActiveFocus() const
{
Q_D(const QDeclarativeItem);
return focusItem() == this ||
- (d->flags & QGraphicsItem::ItemIsFocusScope && focusItem() != 0) ||
- (!parentItem() && focusItem() != 0);
+ (d->flags & QGraphicsItem::ItemIsFocusScope && focusItem() != 0);
}
/*!
@@ -3217,10 +3216,8 @@ bool QDeclarativeItem::hasActiveFocus() const
}
\endqml
- For the purposes of this property, the top level item in the scene
- is assumed to act like a focus scope, and to always have active focus
- when the scene has focus. On a practical level, that means the following
- QML will give active focus to \c input on startup.
+ For the purposes of this property, the scene as a whole is assumed to act like a focus scope.
+ On a practical level, that means the following QML will give active focus to \c input on startup.
\qml
Rectangle {
@@ -3246,7 +3243,7 @@ bool QDeclarativeItem::hasFocus() const
p = p->parentItem();
}
- return hasActiveFocus() ? true : (!QGraphicsItem::parentItem() ? true : false);
+ return hasActiveFocus();
}
/*! \internal */
diff --git a/tests/auto/declarative/qdeclarativefocusscope/tst_qdeclarativefocusscope.cpp b/tests/auto/declarative/qdeclarativefocusscope/tst_qdeclarativefocusscope.cpp
index b138f61..ec8f048 100644
--- a/tests/auto/declarative/qdeclarativefocusscope/tst_qdeclarativefocusscope.cpp
+++ b/tests/auto/declarative/qdeclarativefocusscope/tst_qdeclarativefocusscope.cpp
@@ -336,7 +336,7 @@ void tst_qdeclarativefocusscope::noParentFocus()
view->setSource(QUrl::fromLocalFile(SRCDIR "/data/chain.qml"));
QVERIFY(view->rootObject());
- QVERIFY(view->rootObject()->property("focus1") == true);
+ QVERIFY(view->rootObject()->property("focus1") == false);
QVERIFY(view->rootObject()->property("focus2") == false);
QVERIFY(view->rootObject()->property("focus3") == true);
QVERIFY(view->rootObject()->property("focus4") == true);