summaryrefslogtreecommitdiffstats
path: root/src/gui/graphicsview/qgraphicswidget_p.cpp
diff options
context:
space:
mode:
authorAlexis Menard <alexis.menard@nokia.com>2010-05-10 01:43:12 (GMT)
committerAlexis Menard <alexis.menard@nokia.com>2010-05-10 01:46:52 (GMT)
commitb524e356424fe386eae56f65600077ce52ca6f92 (patch)
treec0c2b86b3a649bdc99ad6d1b2b443a31ed952efa /src/gui/graphicsview/qgraphicswidget_p.cpp
parent1ca5742e83b650750d45d03882e8109c61c1f392 (diff)
downloadQt-b524e356424fe386eae56f65600077ce52ca6f92.zip
Qt-b524e356424fe386eae56f65600077ce52ca6f92.tar.gz
Qt-b524e356424fe386eae56f65600077ce52ca6f92.tar.bz2
Optimize QGW constructor.
Mostly by avoiding sending useless QVariant at construction time. itemChange is virtual, the user implementation will never be called. Worst case the QGW one. Reviewed-by:janarve
Diffstat (limited to 'src/gui/graphicsview/qgraphicswidget_p.cpp')
-rw-r--r--src/gui/graphicsview/qgraphicswidget_p.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/gui/graphicsview/qgraphicswidget_p.cpp b/src/gui/graphicsview/qgraphicswidget_p.cpp
index 6e397b6..50b315a 100644
--- a/src/gui/graphicsview/qgraphicswidget_p.cpp
+++ b/src/gui/graphicsview/qgraphicswidget_p.cpp
@@ -71,14 +71,17 @@ void QGraphicsWidgetPrivate::init(QGraphicsItem *parentItem, Qt::WindowFlags wFl
adjustWindowFlags(&wFlags);
windowFlags = wFlags;
- q->setParentItem(parentItem);
+ if (parentItem)
+ setParentItemHelper(parentItem, 0, 0);
+
q->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred, QSizePolicy::DefaultType));
q->setGraphicsItem(q);
resolveLayoutDirection();
q->unsetWindowFrameMargins();
- q->setFlag(QGraphicsItem::ItemUsesExtendedStyleOption);
- q->setFlag(QGraphicsItem::ItemSendsGeometryChanges);
+ flags |= QGraphicsItem::ItemUsesExtendedStyleOption | QGraphicsItem::ItemSendsGeometryChanges;
+ if (windowFlags & Qt::Window)
+ flags |= QGraphicsItem::ItemIsPanel;
}
qreal QGraphicsWidgetPrivate::titleBarHeight(const QStyleOptionTitleBar &options) const