diff options
author | Andreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com> | 2009-05-29 06:54:31 (GMT) |
---|---|---|
committer | Andreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com> | 2009-06-11 07:19:22 (GMT) |
commit | e83bed831c80657221176b9c0e24962d9c9e7ca2 (patch) | |
tree | fab4fb4a4fc4f3781d56e875412be8579e2ba119 /src/declarative/canvas | |
parent | 2feffad511c2ea535e59221ae1b0b46c91bb8227 (diff) | |
download | Qt-e83bed831c80657221176b9c0e24962d9c9e7ca2.zip Qt-e83bed831c80657221176b9c0e24962d9c9e7ca2.tar.gz Qt-e83bed831c80657221176b9c0e24962d9c9e7ca2.tar.bz2 |
Introduce QGraphicsItem::ItemHasNoContents.
This flag helps optimize the case where an item is used only as a
transformation node in a scene graph, and where the item itself
doesn't paint anything. This is the default for FxItem (the
subclasses that do paint enable the HasContents flag). This lets
Graphics View know whether there's any point in setting up the
world transform, opacity and other things.
Reviewed-by: Lars
Diffstat (limited to 'src/declarative/canvas')
-rw-r--r-- | src/declarative/canvas/qsimplecanvasitem.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/declarative/canvas/qsimplecanvasitem.cpp b/src/declarative/canvas/qsimplecanvasitem.cpp index 7451a5f..cbdc324 100644 --- a/src/declarative/canvas/qsimplecanvasitem.cpp +++ b/src/declarative/canvas/qsimplecanvasitem.cpp @@ -1300,6 +1300,9 @@ void QSimpleCanvasItem::setOptions(Options options, bool set) d->options &= ~IsFocusRealm; } + if (d->graphicsItem) + d->graphicsItem->setFlag(QGraphicsItem::ItemHasNoContents, !(d->options & HasContents)); + if ((old & MouseFilter) != (d->options & MouseFilter)) { if (d->graphicsItem) { if (d->options & MouseFilter) @@ -1487,6 +1490,7 @@ void QSimpleCanvasItemPrivate::convertToGraphicsItem(QGraphicsItem *parent) Q_Q(QSimpleCanvasItem); Q_ASSERT(!graphicsItem); graphicsItem = new QSimpleGraphicsItem(q); + graphicsItem->setFlag(QGraphicsItem::ItemHasNoContents, !(q->options() & QSimpleCanvasItem::HasContents)); if (parent) graphicsItem->setParentItem(parent); |