summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBjørn Erik Nilsen <bjorn.nilsen@nokia.com>2010-01-19 10:28:54 (GMT)
committerBjørn Erik Nilsen <bjorn.nilsen@nokia.com>2010-01-21 15:48:49 (GMT)
commit1e4d40aaf71469255409227d3c7105b199effcdf (patch)
tree7e7f4d41e889ac53dd421797c4929d16ac226a7c /src
parent38c0ed9870fc6bd8ba759c283eaf2bffb61c2e3f (diff)
downloadQt-1e4d40aaf71469255409227d3c7105b199effcdf.zip
Qt-1e4d40aaf71469255409227d3c7105b199effcdf.tar.gz
Qt-1e4d40aaf71469255409227d3c7105b199effcdf.tar.bz2
Speed up QmlGraphicsItem construction.
It's much faster to just initalize the flags in the constructor of QmlGraphicsItemPrivate than doing a full blown QGraphicsItem::setFlags. We can perfectly do this because QmlGraphicsItem does not listen to any itemChange events related to those flags. Reviewed-by: Aaron Kennedy
Diffstat (limited to 'src')
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsitem_p.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/declarative/graphicsitems/qmlgraphicsitem_p.h b/src/declarative/graphicsitems/qmlgraphicsitem_p.h
index ca850f3..91d2119 100644
--- a/src/declarative/graphicsitems/qmlgraphicsitem_p.h
+++ b/src/declarative/graphicsitems/qmlgraphicsitem_p.h
@@ -116,6 +116,12 @@ public:
smooth(false), keyHandler(0),
width(0), height(0), implicitWidth(0), implicitHeight(0)
{
+ QGraphicsItemPrivate::acceptedMouseButtons = 0;
+ QGraphicsItemPrivate::flags = QGraphicsItem::GraphicsItemFlags(
+ QGraphicsItem::ItemHasNoContents
+ | QGraphicsItem::ItemIsFocusable
+ | QGraphicsItem::ItemNegativeZStacksBehindParent);
+
}
void init(QmlGraphicsItem *parent)
@@ -125,10 +131,6 @@ public:
if (parent)
q->setParentItem(parent);
_baselineOffset.invalidate();
- q->setAcceptedMouseButtons(Qt::NoButton);
- q->setFlags(QGraphicsItem::ItemHasNoContents |
- QGraphicsItem::ItemIsFocusable |
- QGraphicsItem::ItemNegativeZStacksBehindParent);
mouseSetsFocus = false;
}