diff options
author | Alexis Menard <alexis.menard@nokia.com> | 2010-05-05 04:57:26 (GMT) |
---|---|---|
committer | Alexis Menard <alexis.menard@nokia.com> | 2010-05-05 23:44:28 (GMT) |
commit | 3c4d3a65bbce6b1f9e649412f141ee8890a7b6cd (patch) | |
tree | 801be34e129444e7f7c908b31ef27462637342a2 /src/gui/graphicsview/qgraphicswidget_p.cpp | |
parent | b7513f4a15ecac1adf54f2abdda6b56c89d6bef4 (diff) | |
download | Qt-3c4d3a65bbce6b1f9e649412f141ee8890a7b6cd.zip Qt-3c4d3a65bbce6b1f9e649412f141ee8890a7b6cd.tar.gz Qt-3c4d3a65bbce6b1f9e649412f141ee8890a7b6cd.tar.bz2 |
QGraphicsWidget was not working properly when ItemSendsPositionChanges is false
The geometry was not properly set because QGraphicsWidget rely on itemChange
to update its own geometry. Now when calling setPos we also ensure that
for a widget the geometry will be up to date. Setting the flag
ItemSendsPositionChanges to false for a given widget will give a small
performance boost.
Reviewed-by:janarve
Reviewed-by:bnilsen
Diffstat (limited to 'src/gui/graphicsview/qgraphicswidget_p.cpp')
-rw-r--r-- | src/gui/graphicsview/qgraphicswidget_p.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/gui/graphicsview/qgraphicswidget_p.cpp b/src/gui/graphicsview/qgraphicswidget_p.cpp index 1835c74..daa007f 100644 --- a/src/gui/graphicsview/qgraphicswidget_p.cpp +++ b/src/gui/graphicsview/qgraphicswidget_p.cpp @@ -825,6 +825,18 @@ void QGraphicsWidgetPrivate::setLayout_helper(QGraphicsLayout *l) } } +void QGraphicsWidgetPrivate::setGeometryFromSetPos() +{ + if (inSetGeometry) + return; + Q_Q(QGraphicsWidget); + inSetPos = 1; + // Ensure setGeometry is called (avoid recursion when setPos is + // called from within setGeometry). + q->setGeometry(QRectF(pos, q->size())); + inSetPos = 0 ; +} + QT_END_NAMESPACE #endif //QT_NO_GRAPHICSVIEW |