summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2011-08-30 08:18:02 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2011-08-30 08:18:02 (GMT)
commit50781a66bd11c3201c7f9c520490dc352e239dac (patch)
tree75d77ca3aca8fe671c54e74ed191d1938f6db765 /src/gui
parent78c5825cfb7702350636b7624bf79311dbd0dbd5 (diff)
parenta1b2be3c8a64aee832c648c6dcdff003f22318a3 (diff)
downloadQt-50781a66bd11c3201c7f9c520490dc352e239dac.zip
Qt-50781a66bd11c3201c7f9c520490dc352e239dac.tar.gz
Qt-50781a66bd11c3201c7f9c520490dc352e239dac.tar.bz2
Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt-qml-staging into master-integration
* 'master' of scm.dev.nokia.troll.no:qt/qt-qml-staging: QDeclarative::hasActiveFocus should return false for hidden items FocusScope's focusItem must always be a descendent
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp34
1 files changed, 18 insertions, 16 deletions
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index 2ac2bdf..0c218fc 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -1171,24 +1171,26 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent, const Q
// Update focus scope item ptr in new scope.
QGraphicsItem *newFocusScopeItem = subFocusItem ? subFocusItem : parentFocusScopeItem;
if (newFocusScopeItem && newParent) {
- if (subFocusItem) {
- // Find the subFocusItem's topmost focus scope.
- QGraphicsItem *ancestorScope = 0;
- QGraphicsItem *p = subFocusItem->d_ptr->parent;
- while (p) {
- if (p->d_ptr->flags & QGraphicsItem::ItemIsFocusScope)
- ancestorScope = p;
- if (p->d_ptr->flags & QGraphicsItem::ItemIsPanel)
- break;
- p = p->d_ptr->parent;
- }
- if (ancestorScope)
- newFocusScopeItem = ancestorScope;
- }
-
QGraphicsItem *p = newParent;
while (p) {
if (p->d_ptr->flags & QGraphicsItem::ItemIsFocusScope) {
+ if (subFocusItem && subFocusItem != q_ptr) {
+ // Find the subFocusItem's topmost focus scope within the new parent's focusscope
+ QGraphicsItem *ancestorScope = 0;
+ QGraphicsItem *p2 = subFocusItem->d_ptr->parent;
+ while (p2 && p2 != p) {
+ if (p2->d_ptr->flags & QGraphicsItem::ItemIsFocusScope)
+ ancestorScope = p2;
+ if (p2->d_ptr->flags & QGraphicsItem::ItemIsPanel)
+ break;
+ if (p2 == q_ptr)
+ break;
+ p2 = p2->d_ptr->parent;
+ }
+ if (ancestorScope)
+ newFocusScopeItem = ancestorScope;
+ }
+
p->d_ptr->focusScopeItem = newFocusScopeItem;
newFocusScopeItem->d_ptr->focusScopeItemChange(true);
// Ensure the new item is no longer the subFocusItem. The
@@ -3297,7 +3299,7 @@ void QGraphicsItemPrivate::setFocusHelper(Qt::FocusReason focusReason, bool clim
}
if (climb) {
- while (f->d_ptr->focusScopeItem && f->d_ptr->focusScopeItem->isVisible() && f->d_ptr->focusScopeItem != f)
+ while (f->d_ptr->focusScopeItem && f->d_ptr->focusScopeItem->isVisible())
f = f->d_ptr->focusScopeItem;
}