[Kst] extragear/graphics/kst/kst
George Staikos
staikos at kde.org
Wed Dec 21 07:16:04 CET 2005
SVN commit 490219 by staikos:
add clipping support
M +26 -1 kstborderedviewobject.cpp
M +2 -0 kstborderedviewobject.h
--- trunk/extragear/graphics/kst/kst/kstborderedviewobject.cpp #490218:490219
@@ -78,7 +78,11 @@
if (_borderWidth > 0) {
QRect r;
QPen pen(_borderColor, _borderWidth);
- p.setBrush(Qt::NoBrush);
+ if (_transparent) {
+ p.setBrush(Qt::NoBrush);
+ } else {
+ p.setBrush(_backgroundColor);
+ }
p.setPen(pen);
r.setX(_geom.left() + _margin + _borderWidth/2);
r.setY(_geom.top() + _margin + _borderWidth/2);
@@ -91,6 +95,27 @@
}
+QRegion KstBorderedViewObject::clipRegion() {
+ QRegion r;
+ if (!_transparent) {
+ r += _geom;
+ } else if (_borderWidth > 0) {
+ QRect rect;
+ rect.setX(_geom.left() + _margin);
+ rect.setY(_geom.top() + _margin);
+ rect.setWidth(_geom.width() - 2 * _margin);
+ rect.setHeight(_geom.height() - 2 * _margin);
+ r += rect;
+ rect.setX(_geom.left() + _margin + _borderWidth);
+ rect.setY(_geom.top() + _margin + _borderWidth);
+ rect.setWidth(_geom.width() - 2 * (_margin + _borderWidth));
+ rect.setHeight(_geom.height() - 2 * (_margin + _borderWidth));
+ r -= rect;
+ }
+ return r;
+}
+
+
void KstBorderedViewObject::setBorderColor(const QColor& c) {
if (_borderColor != c) {
setDirty();
--- trunk/extragear/graphics/kst/kst/kstborderedviewobject.h #490218:490219
@@ -101,6 +101,8 @@
virtual void paint(KstPainter& p, const QRegion& bounds);
+ virtual QRegion clipRegion();
+
protected:
virtual void readBinary(QDataStream& str);
virtual void writeBinary(QDataStream& str);
More information about the Kst
mailing list