diff options
author | Andreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com> | 2009-07-24 01:40:51 (GMT) |
---|---|---|
committer | Andreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com> | 2009-07-27 05:46:39 (GMT) |
commit | f68fed388dcdba6ab6dad3af4933bcd3aa123cf8 (patch) | |
tree | b0e386b94a444db6bbf9debd93c9fd9b89473114 /src/gui/graphicsview/qgraphicsitem.h | |
parent | 092b004126f82545b4237e43507f21920d06ac58 (diff) | |
download | Qt-f68fed388dcdba6ab6dad3af4933bcd3aa123cf8.zip Qt-f68fed388dcdba6ab6dad3af4933bcd3aa123cf8.tar.gz Qt-f68fed388dcdba6ab6dad3af4933bcd3aa123cf8.tar.bz2 |
Add QGraphicsItem::ItemAutoDetectsFocusProxy and improve subfocus support.
If you set this flag on an item, and descendant item that gains input
focus will become this item's focus proxy. This simplifies how focus
proxy items are assigned from QML; instead of binding the possible
focusProxy property to a named child widget, this assignment happens
automatically as you set the focus property of a descendant to true.
As part of this change, QGraphicsWidget::focusWidget behavior has been
improved and moved into QGraphicsItem. For example, if you set focus on
an item that it's part of a scene, it can gain focus once the parent
has been assigned (which is how object trees are built in QML).
Autotests are included.
Reviewed-by: Michael Brasser
Diffstat (limited to 'src/gui/graphicsview/qgraphicsitem.h')
-rw-r--r-- | src/gui/graphicsview/qgraphicsitem.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/gui/graphicsview/qgraphicsitem.h b/src/gui/graphicsview/qgraphicsitem.h index 5c9297f..0e21a47 100644 --- a/src/gui/graphicsview/qgraphicsitem.h +++ b/src/gui/graphicsview/qgraphicsitem.h @@ -99,7 +99,8 @@ public: ItemUsesExtendedStyleOption = 0x200, ItemHasNoContents = 0x400, ItemSendsGeometryChanges = 0x800, - ItemAcceptsInputMethod = 0x1000 + ItemAcceptsInputMethod = 0x1000, + ItemAutoDetectsFocusProxy = 0x2000 // NB! Don't forget to increase the d_ptr->flags bit field by 1 when adding a new flag. }; Q_DECLARE_FLAGS(GraphicsItemFlags, GraphicsItemFlag) @@ -229,6 +230,8 @@ public: QGraphicsItem *focusProxy() const; void setFocusProxy(QGraphicsItem *item); + QGraphicsItem *focusItem() const; + void grabMouse(); void ungrabMouse(); void grabKeyboard(); |