tst_QWidget: port away from QRegion::rects()

Drop the useless copy 'r' of 'region', reuse 'r' for the rects in 'region',
to clean up the region handling in verifyColor().

Change-Id: I8e159976b4b0152823be864488d2ef25d7cb0078
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
bb10
Marc Mutz 2017-12-06 11:13:45 +01:00
parent 28fbd13e22
commit 85d8975bc9
1 changed files with 3 additions and 4 deletions

View File

@ -5145,13 +5145,12 @@ static QPixmap grabWindow(QWindow *window, int x, int y, int width, int height)
bool verifyColor(QWidget &child, const QRegion &region, const QColor &color, unsigned int callerLine)
{
const QRegion r = QRegion(region);
QWindow *window = child.window()->windowHandle();
Q_ASSERT(window);
const QPoint offset = child.mapTo(child.window(), QPoint(0,0));
bool grabBackingStore = false;
for (int i = 0; i < r.rects().size(); ++i) {
QRect rect = r.rects().at(i).translated(offset);
for (QRect r : region) {
QRect rect = r.translated(offset);
for (int t = 0; t < 6; t++) {
const QPixmap pixmap = grabBackingStore
? child.grab(rect)
@ -5176,7 +5175,7 @@ bool verifyColor(QWidget &child, const QRegion &region, const QColor &color, uns
} else {
if (t == 4) {
grabBackingStore = true;
rect = r.rects().at(i);
rect = r;
} else {
QTest::qWait(200);
}