Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
4.5.1
-
None
-
f9d6862d13ae38c59ec4a58092c8126620801e0b
Description
If a QGraphicsScene contains an item with the flag ItemClipsChildrenToShape (with some children) and another totally unrelated item with the flag ItemIgnoresTransformations set, the children of the item with ItemClipsChildrenToShape aren't painted at all
Example :
(resize it smaller to observe that the blue item disapears)
#include <QtGui> int main( int argc, char * argv[]) { QApplication app( argc, argv ); QGraphicsScene scene; QGraphicsRectItem *parent = new QGraphicsRectItem(QRectF(0,0, 50, 50), 0); parent->setBrush(Qt::red); QGraphicsRectItem *child = new QGraphicsRectItem(QRectF(-10,-10, 40, 40), parent); child->setBrush(Qt::blue); QGraphicsRectItem *ignore = new QGraphicsRectItem(QRectF(60, 60, 50, 50), 0); ignore->setBrush(Qt::green); //comment either of those two lines to make it work parent->setFlags( QGraphicsItem::ItemClipsChildrenToShape ); ignore->setFlag(QGraphicsItem::ItemIgnoresTransformations); scene.addItem(parent); scene.addItem(ignore); QGraphicsView view( &scene ); view.show(); return app.exec(); }