diff options
author | Andreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com> | 2009-06-17 08:20:46 (GMT) |
---|---|---|
committer | Andreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com> | 2009-06-17 08:27:06 (GMT) |
commit | 99c5b68d4af7b099f201a7b89c86209df9e9349b (patch) | |
tree | 22b25459c74d80b8c2eacfc3b2b314454fd6ae71 /tests | |
parent | c441020f105249458c389cc167d70f36b39ea28e (diff) | |
download | Qt-99c5b68d4af7b099f201a7b89c86209df9e9349b.zip Qt-99c5b68d4af7b099f201a7b89c86209df9e9349b.tar.gz Qt-99c5b68d4af7b099f201a7b89c86209df9e9349b.tar.bz2 |
Fix QGraphicsItem::ItemHasNoContents rendering of children.
The ItemHasNoContents flag was preventing items that clip their children
from rendering their children at all. Fixed now.
Reviewed-by: bnilsen
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index 63a3f92..e8a6d10 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -229,6 +229,7 @@ private slots: void moveItem(); void sorting_data(); void sorting(); + void itemHasNoContents(); // task specific tests below me void task141694_textItemEnsureVisible(); @@ -7031,5 +7032,31 @@ void tst_QGraphicsItem::sorting() << item1 << item2); } +void tst_QGraphicsItem::itemHasNoContents() +{ + PainterItem *item1 = new PainterItem; + PainterItem *item2 = new PainterItem; + item2->setParentItem(item1); + item2->setPos(50, 50); + item1->setFlag(QGraphicsItem::ItemHasNoContents); + item1->setFlag(QGraphicsItem::ItemClipsChildrenToShape); + + QGraphicsScene scene; + scene.addItem(item1); + + QGraphicsView view(&scene); + view.show(); +#ifdef Q_WS_X11 + qt_x11_wait_for_window_manager(&view); +#endif + QTest::qWait(100); + + _paintedItems.clear(); + + view.viewport()->repaint(); + + QCOMPARE(_paintedItems, QList<QGraphicsItem *>() << item2); +} + QTEST_MAIN(tst_QGraphicsItem) #include "tst_qgraphicsitem.moc" |