diff options
author | Andreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com> | 2009-08-17 13:41:51 (GMT) |
---|---|---|
committer | Andreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com> | 2009-08-17 14:03:18 (GMT) |
commit | 85edfcbde9f1d2f77a05edb8d01361c76234f47c (patch) | |
tree | 2ea157a78561ca64fdc6a1edc226b12b610aa6d1 /src/gui/graphicsview/qgraphicsitem.cpp | |
parent | 53807e58770f27d46ca8ecaa33a3d5f7b6925517 (diff) | |
download | Qt-85edfcbde9f1d2f77a05edb8d01361c76234f47c.zip Qt-85edfcbde9f1d2f77a05edb8d01361c76234f47c.tar.gz Qt-85edfcbde9f1d2f77a05edb8d01361c76234f47c.tar.bz2 |
Merge QGV delta from kinetic-declarativeui into master.
New flag: QGraphicsItem::ItemNegativeZStacksBehindParent, which makes
it easy to toggle stack-behind based on the value of Z alone.
Add interface initializations to QGV classes.
Add a simple internal focus policy to QGraphicsItem to allow derived
items to be focusable without allowing clickfocus.
Reviewed-by: Alexis
Diffstat (limited to 'src/gui/graphicsview/qgraphicsitem.cpp')
-rw-r--r-- | src/gui/graphicsview/qgraphicsitem.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 6d75db3..37d969b 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -328,6 +328,10 @@ used for Asian languages. This flag was introduced in Qt 4.6. + \value ItemNegativeZStacksBehindParent The item automatically stacks behind + it's parent if it's z-value is negative. This flag enables setZValue() to + toggle ItemStacksBehindParent. + \value ItemAutoDetectsFocusProxy The item will assign any child that gains input focus as its focus proxy. See also focusProxy(). This flag was introduced in Qt 4.6. @@ -1566,6 +1570,11 @@ void QGraphicsItem::setFlags(GraphicsItemFlags flags) d_ptr->scene->d_func()->updateInputMethodSensitivityInViews(); } + if ((flags & ItemNegativeZStacksBehindParent) != (oldFlags & ItemNegativeZStacksBehindParent)) { + // Update stack-behind. + setFlag(ItemStacksBehindParent, d_ptr->z < qreal(0.0)); + } + if (d_ptr->scene) { d_ptr->scene->d_func()->markDirty(this, QRectF(), /*invalidateChildren=*/true, @@ -3719,6 +3728,9 @@ void QGraphicsItem::setZValue(qreal z) itemChange(ItemZValueHasChanged, newZVariant); + if (d_ptr->flags & ItemNegativeZStacksBehindParent) + setFlag(QGraphicsItem::ItemStacksBehindParent, z < qreal(0.0)); + if (d_ptr->isObject) emit static_cast<QGraphicsObject *>(this)->zChanged(); } @@ -10103,6 +10115,9 @@ QDebug operator<<(QDebug debug, QGraphicsItem::GraphicsItemFlag flag) case QGraphicsItem::ItemAcceptsInputMethod: str = "ItemAcceptsInputMethod"; break; + case QGraphicsItem::ItemNegativeZStacksBehindParent: + str = "ItemNegativeZStacksBehindParent"; + break; case QGraphicsItem::ItemAutoDetectsFocusProxy: str = "ItemAutoDetectsFocusProxy"; break; |