diff options
author | Bjørn Erik Nilsen <bjorn.nilsen@nokia.com> | 2009-07-09 09:08:48 (GMT) |
---|---|---|
committer | Bjørn Erik Nilsen <bjorn.nilsen@nokia.com> | 2009-07-09 09:08:48 (GMT) |
commit | bdb6d461f4889e38296c859446283c0f9397dbdd (patch) | |
tree | 2ba5ee22e5f10045eb2e918f412760ee9f71b27d /tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp | |
parent | e1b6cd9170d9a20fd3ee1b8d7ef11dcd3364e16d (diff) | |
download | Qt-bdb6d461f4889e38296c859446283c0f9397dbdd.zip Qt-bdb6d461f4889e38296c859446283c0f9397dbdd.tar.gz Qt-bdb6d461f4889e38296c859446283c0f9397dbdd.tar.bz2 |
Rendering artifacts when hiding a QGraphicsItem.
The problem was that update() followed by hide() didn't work as
expected because the update() caused all sub-sequent update requests
to be discareded. This is correct, however, we have to make sure the
ignoreVisible/ignoreOpacity bit is set properly; we won't process a
hidden item otherwise.
Auto-test included.
Diffstat (limited to 'tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp')
-rw-r--r-- | tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index 3f7a50b..d689293 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -6625,6 +6625,17 @@ void tst_QGraphicsItem::update() qApp->processEvents(); QCOMPARE(item->repaints, 0); QCOMPARE(view.repaints, 0); + + // Make sure the area occupied by an item is repainted when hiding it. + view.reset(); + item->repaints = 0; + item->update(); // Full update; all sub-sequent update requests are discarded. + item->hide(); // visible set to 0. ignoreVisible must be set to 1; the item won't be processed otherwise. + qApp->processEvents(); + QCOMPARE(item->repaints, 0); + QCOMPARE(view.repaints, 1); + // The entire item's bounding rect (adjusted for antialiasing) should have been painted. + QCOMPARE(view.paintedRegion, expectedRegion); } void tst_QGraphicsItem::setTransformProperties_data() |