diff options
author | Michael Hasselmann <michaelh@openismus.com> | 2011-02-10 18:14:45 (GMT) |
---|---|---|
committer | Jan-Arve Sæther <jan-arve.saether@nokia.com> | 2011-03-16 08:37:52 (GMT) |
commit | 517290f73be74d1cf08fbd603870d3dacc379ff3 (patch) | |
tree | 8354ffe3c15c37544fae1e284bfa6bb0ec18e3f2 /src/gui/graphicsview/qgraphicsitem.cpp | |
parent | 5949c215bd53582d0c6481f606a9ec015f067b37 (diff) | |
download | Qt-517290f73be74d1cf08fbd603870d3dacc379ff3.zip Qt-517290f73be74d1cf08fbd603870d3dacc379ff3.tar.gz Qt-517290f73be74d1cf08fbd603870d3dacc379ff3.tar.bz2 |
Introduce QGraphicsItem::ItemStopsFocusHandling flag
When set for an item, QGraphicsScene will skip focus handling for this item and
everything underneath it (including focus-out). Allows users to reimplement
custom focus handling.
Use case: touch devices that implement panning. Here, focus-in has to happen
only if no panning was triggered. Analogous, no focus-out should happen when
panning was detected.
Fixes the alternative proposal ("black holes for focus changes") of
QTBUG-16343: QGraphicsView doesn't support focus change on mouse release.
The previous test was only testing one scenario, which didn't give a good idea
whether the flag was actually working as intended.
Task-number: QTBUG-17505
Reviewed-by: Yoann Lopes
Reviewed-by: Jan-Arve Sæther
Diffstat (limited to 'src/gui/graphicsview/qgraphicsitem.cpp')
-rw-r--r-- | src/gui/graphicsview/qgraphicsitem.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index f463887..4e2d4e2 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -417,6 +417,11 @@ click focus to items underneath when being clicked on. This flag allows you create a non-focusable item that can be clicked on without changing the focus. \endomit + + \omitvalue ItemStopsFocusHandling \omit Same as + ItemStopsClickFocusPropagation, but also suppresses focus-out. This flag + allows you to completely take over focus handling. + This flag was introduced in Qt 4.7. */ /*! @@ -11549,6 +11554,9 @@ QDebug operator<<(QDebug debug, QGraphicsItem::GraphicsItemFlag flag) case QGraphicsItem::ItemStopsClickFocusPropagation: str = "ItemStopsClickFocusPropagation"; break; + case QGraphicsItem::ItemStopsFocusHandling: + str = "ItemStopsFocusHandling"; + break; } debug << str; return debug; |