From e83bed831c80657221176b9c0e24962d9c9e7ca2 Mon Sep 17 00:00:00 2001 From: Andreas Aardal Hanssen Date: Fri, 29 May 2009 08:54:31 +0200 Subject: 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 --- src/declarative/canvas/qsimplecanvasitem.cpp | 4 ++++ 1 file changed, 4 insertions(+) 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); -- cgit v0.12