Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-4151

[REG] QGraphicsItem with parent flag ItemClipsChildrenToShape not visible.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • 4.5.3
    • 4.5.1
    • Widgets: GraphicsView
    • 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();
      }
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            hanssen Andreas Aardal Hanssen (closed Nokia identity) (Inactive)
            goffart Olivier Goffart (closed Nokia identity) (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes