Hi guys,

I have a code (which I can not change) which uses QRubberBand in order to show boundaries on a chart. I need to implement custom display of the rubber band. The code (which, again, I can not change) gets an instance of rubber band to use at initialization time. This means that I can inherit from QRubberBand, reimplement paintEvent method and provide object of my class as the rubber. The only problem I have now is that I need somehow to paint on the area which is a bit bigger than QRubberBand geometry. When I do the painting out of the clipping rectangle, its being clipped. So the question is actually, how can I access the clipping area which is used by painter. QPainter::setClipRect does not help

Here is something close to what I'm trying to do (just to make it a bit clearer):

Qt Code:
  1. void MyRubberBand::paintEvent(QPaintEvent * e)
  2. {
  3. QPainter painter(this);
  4. QRect rect = e->rect();
  5. rect.adjust(-10, -10, 10, 10);
  6.  
  7. painter.save();
  8. painter.setClipRect(rect);
  9. painter.fillRect(rect, Qt::blue);
  10. painter.restore();
  11. }
To copy to clipboard, switch view to plain text mode 

The code above will try to display blue rectangle which is 20 pixels greater in each dimention than the e->rect() (which I believe, is the clip rectangle). But the rectangle will be displayed clipped

Any ideas ?