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

QGraphicsScene should use setClipRect and not setClipShape when widget has simple rectangular shape

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • 4.6.2
    • 4.6.1
    • Widgets: GraphicsView
    • None
    • qt 4.6.1
    • 80e114ad0b7974894858a17153d6f54546835066

    Description

      I have a widget (rectangular in shape) which clips its children (which are also simple rectangles).

      For example if I have two widgets scrolLWidget and contentWidget::
      
       QGraphicsWidget *scrollWidget = new QGraphicsWidget();
      scrollWidget->setFlag(Qt::ItemClipsChildrenToShape,true);
      QGraphicsWidget *contentWidget = new QGraphicsWidget();
      We can add any content to this i.etext, icons etc
      
      scrollWidget->setContentWidget(contentWidget); ---->this would also set contentWidget as its child
      
      We dont apply any kind of transformations, scaling etc.We expect a simple "untransformed" rectangular clip.
      
      Lets see how QGraphicsScene handle this:
      
      In QGraphicsScenePrivate::draw(...)
      ...
       if (itemClipsChildrenToShape) {
           painter->setClipPath(item->shape(), Qt::IntersectClip); 
          }
      ...  
      
      

      this results using complex alphamasking in openVg side(anyway, I guess this is valid even for raster engine).This is definetly going to slow things up, masking is always expensive and is it really needed in this case?

      Should scene use setClipRect when the shape is simple rectangle and not go for path?

      Attachments

        Issue Links

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

          Activity

            People

              bjnilsen Bjørn Erik Nilsen
              kalyanreddy2005 Kalyan kondapally
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes