summaryrefslogtreecommitdiffstats
path: root/src/declarative/fx/qfxpathview_p.h
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-08-26 11:48:18 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-08-27 03:42:14 (GMT)
commit928e81b68e0b695662c7ee3dd0bfa409a7ca1ffd (patch)
treed6e02b3a6de3f003c23cc46e4b9687bd990e02ca /src/declarative/fx/qfxpathview_p.h
parentbaeb25062194c9ddc36c4536662de46b6b09cd68 (diff)
downloadQt-928e81b68e0b695662c7ee3dd0bfa409a7ca1ffd.zip
Qt-928e81b68e0b695662c7ee3dd0bfa409a7ca1ffd.tar.gz
Qt-928e81b68e0b695662c7ee3dd0bfa409a7ca1ffd.tar.bz2
Implement Focus Scope support in GraphicsView
Focus Scopes are an additional focus paradigm, designed to be more suitable for use by declarative UI. With focus scopes, graphics view continues to have a single focused item - this is the single item to which key events are *actually* delivered. To simplify the description that follows, we will say that this element has "global focus". Focus scopes partitions focus into a heirarchy. Each focus scope may have one sub-focused item, which may itself be another focus scope. The sub-focused item is said to be have "scope focus" or its ancestor focus scope. Consequently, any given QGraphicsItem may be globally focused, scope focused (which means it is focused within its ancestor focus scope) or both. A focus scope corresponds to a QGraphicsItem with the ItemIsFocusScope flag set. As graphics view doesn't have a single root item, a "virtual" focus scope is modeled as being the ancestor of all the root items. With focus scopes, when QGraphicsItem::setFocus() is called, the item's ancestors are searched until a focus scope is found (remembering the "virtual" root focus scope is used if there is no *actual* ancestor scope). The item is set as the sub-focused item of the focus scope (becoming focus scoped) and any existing sub-focused item of that focus scope has scope focus removed from it. The item that receives global focus is found by beginning at the "virtual" root focus scope and recursively decending into each item that is scope focused until a leaf (non-focus scope) item is reached. The implementation takes shortcuts here to be slightly more optimal, but the end result should be the same as though this abstract algorithm was evaluated each time. Two manual examples of focus scope are found under examples/declarative/focusscope
Diffstat (limited to 'src/declarative/fx/qfxpathview_p.h')
-rw-r--r--src/declarative/fx/qfxpathview_p.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/declarative/fx/qfxpathview_p.h b/src/declarative/fx/qfxpathview_p.h
index a69f75f..60bfdb3 100644
--- a/src/declarative/fx/qfxpathview_p.h
+++ b/src/declarative/fx/qfxpathview_p.h
@@ -87,7 +87,7 @@ public:
Q_Q(QFxPathView);
_offset = 0;
q->setAcceptedMouseButtons(Qt::LeftButton);
- q->setFlag(QGraphicsItem::ItemAutoDetectsFocusProxy);
+ q->setFlag(QGraphicsItem::ItemIsFocusScope);
q->setFiltersChildEvents(true);
q->connect(&tl, SIGNAL(updated()), q, SLOT(ticked()));
}