diff options
author | Markus Hossner <markus.hossner@innovative-navigation.de> | 2010-04-21 08:56:22 (GMT) |
---|---|---|
committer | Bjørn Erik Nilsen <bjorn.nilsen@nokia.com> | 2010-04-21 08:56:22 (GMT) |
commit | eb7fad0afd164bb9b56ed47990eaa66cad0c2641 (patch) | |
tree | 96f90e3b9db0f42caaabb554bb1847e48d2352a3 /src | |
parent | dd5d297d2969795a47ef7a5234b64a791e080c38 (diff) | |
download | Qt-eb7fad0afd164bb9b56ed47990eaa66cad0c2641.zip Qt-eb7fad0afd164bb9b56ed47990eaa66cad0c2641.tar.gz Qt-eb7fad0afd164bb9b56ed47990eaa66cad0c2641.tar.bz2 |
QAbstractGraphicsShapeItem: ignore already set pen or brush
If setPen() or setBrush() of a QAbstractGraphicsShapeItem is called with
a pen or brush equal to its current pen or brush prepareGeometryChange()
and update() shouldn't be called. Testing for identical pen and brush is
cheap in comparison with a QGraphicsView update() without seeing a change
Merge-request: 562
Reviewed-by: Bjørn Erik Nilsen <bjorn.nilsen@nokia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/graphicsview/qgraphicsitem.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 5735cd6..c19c052 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -7694,6 +7694,8 @@ QPen QAbstractGraphicsShapeItem::pen() const void QAbstractGraphicsShapeItem::setPen(const QPen &pen) { Q_D(QAbstractGraphicsShapeItem); + if (d->pen == pen) + return; prepareGeometryChange(); d->pen = pen; d->boundingRect = QRectF(); @@ -7724,6 +7726,8 @@ QBrush QAbstractGraphicsShapeItem::brush() const void QAbstractGraphicsShapeItem::setBrush(const QBrush &brush) { Q_D(QAbstractGraphicsShapeItem); + if (d->brush == brush) + return; d->brush = brush; update(); } @@ -8854,6 +8858,8 @@ QPen QGraphicsLineItem::pen() const void QGraphicsLineItem::setPen(const QPen &pen) { Q_D(QGraphicsLineItem); + if (d->pen == pen) + return; prepareGeometryChange(); d->pen = pen; update(); |