Hi,

I have a clipping/redraw problem with a custom graphicsItem that I draw using the following painter:

Qt Code:
  1. ypos = xpos = 0;
  2. painter->setPen(Qt::black);
  3. painter->setBrush(Qt::green);
  4. painter->drawLine( width/2, ypos, width/2, height );
  5. painter->drawRect(xpos, ypos, width, height);
To copy to clipboard, switch view to plain text mode 

and an overloaded boundingRect call

Qt Code:
  1. wadjust=7
  2. hadjust=0
  3. return QRectF(xpos,ypos,width+wadjust,height+hadjust);
To copy to clipboard, switch view to plain text mode 

I have found that if I pass an object over this graphicsItem (crosshairs in my scene) I get some clipping. If I set the wadjust to 7 (the magic number), I see no clipping. Anything below that I get the clipping but the clipping is fixed by passing the crosshairs back over the object in the opposite direction or by resizing the scene (complete redraw).

I didn't think the painter pen added width to the drawRect() unless the rectangle was stroked. Any ideas?

I also remember seeing something in the docs that described how objects are drawn and how the outline pixels are placed around an object but can no longer find that explanation. Anyone know what I'm talking about?

Thanks.