QGraphicsScene::update(): Keep the list of updatedRects() unique
Otherwise, the rects will pile up when the item is not part of a view. Task-number: QTBUG-54275 Change-Id: I29c989e25ce0ca1ac0b87d0388a476ef1acd9cfd Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
This commit is contained in:
parent
e2d79b4963
commit
1d09b0d1b2
@ -3215,7 +3215,8 @@ void QGraphicsScene::update(const QRectF &rect)
|
||||
view->d_func()->updateRectF(rect);
|
||||
}
|
||||
} else {
|
||||
d->updatedRects << rect;
|
||||
if (!d->updatedRects.contains(rect))
|
||||
d->updatedRects << rect;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2206,10 +2206,11 @@ void tst_QGraphicsItem::setMatrix()
|
||||
QCOMPARE(spy.count(), 3);
|
||||
QList<QRectF> rlist = qvariant_cast<QList<QRectF> >(spy.last().at(0));
|
||||
|
||||
QCOMPARE(rlist.size(), 3);
|
||||
QCOMPARE(rlist.at(0), rotatedRect); // From item.setMatrix() (clearing rotated rect)
|
||||
QCOMPARE(rlist.at(1), rotatedRect); // From scene.update() (updating scene rect)
|
||||
QCOMPARE(rlist.at(2), unrotatedRect); // From post-update (update current state)
|
||||
QCOMPARE(rlist.size(), 2);
|
||||
// From item.setMatrix() (clearing rotated rect), from scene.update() (updating scene rect),
|
||||
// squashed into one
|
||||
QCOMPARE(rlist.at(0), rotatedRect);
|
||||
QCOMPARE(rlist.at(1), unrotatedRect); // From post-update (update current state)
|
||||
}
|
||||
|
||||
static QList<QGraphicsItem *> _paintedItems;
|
||||
|
Loading…
Reference in New Issue
Block a user