void KstViewBox::paintSelf(KstPainter& p, const QRegion& bounds) { p.save(); if (p.type() != KstPainter::P_PRINT && p.type() != KstPainter::P_EXPORT) { if (p.makingMask()) { p.setRasterOp(Qt::SetROP); } else { const QRegion clip(clipRegion()); KstViewObject::paintSelf(p, bounds - clip); p.setClipRegion(bounds & clip); } } // restrict the border width so we do not draw outside of the rectangle itself int bw(borderWidth() * p.lineWidthAdjustmentFactor()); if (bw > _geom.width() / 2) { bw = _geom.width() / 2; } if (bw > _geom.height()) { bw = _geom.height() / 2; } QPen pen(borderColor(), bw); pen.setJoinStyle(_cornerStyle); if (bw == 0) { pen.setStyle(Qt::NoPen); } p.setPen(pen); if (_transparentFill) { p.setBrush(Qt::NoBrush); } else { p.setBrush(_foregroundColor); } QRect r; r.setX(_geom.left() + bw / 2); r.setY(_geom.top() + bw / 2); r.setWidth(_geom.width() - bw); r.setHeight(_geom.height() - bw); p.drawRoundRect(r, _xRound, _yRound); p.restore(); }