[Kst] extragear/graphics/kst/kst
Rick Chern
rchern at interchange.ubc.ca
Thu Aug 11 02:44:20 CEST 2005
SVN commit 445381 by rchern:
Transparency for ellipses, rectangles, and textboxes.
M +1 -0 kstborderedviewobject.cpp
M +20 -1 kstviewbox.cpp
M +5 -0 kstviewbox.h
M +20 -1 kstviewellipse.cpp
M +6 -0 kstviewellipse.h
M +18 -0 kstviewlabel.cpp
M +6 -0 kstviewlabel.h
--- trunk/extragear/graphics/kst/kst/kstborderedviewobject.cpp #445380:445381
@@ -221,5 +221,6 @@
return KstViewObject::foregroundColor();
}
+
#include "kstborderedviewobject.moc"
// vim: ts=2 sw=2 et
--- trunk/extragear/graphics/kst/kst/kstviewbox.cpp #445380:445381
@@ -32,6 +32,7 @@
_cornerStyle = Qt::MiterJoin;
_layoutActions |= Delete | Raise | Lower | RaiseToTop | LowerToBottom | Rename | MoveTo | Copy | CopyTo;
setTransparent(true);
+ _transparentFill = false;
}
@@ -56,7 +57,11 @@
pen.setStyle(Qt::NoPen);
}
p.setPen(pen);
- p.setBrush(_foregroundColor);
+ if (_transparentFill) {
+ p.setBrush(Qt::NoBrush);
+ } else {
+ p.setBrush(_foregroundColor);
+ }
p.drawRoundRect(_geom, _xRound, _yRound);
// do this last so the focus rectangle isn't covered up
@@ -115,6 +120,16 @@
}
+bool KstViewBox::transparentFill() const {
+ return _transparentFill;
+}
+
+
+void KstViewBox::setTransparentFill(bool yes) {
+ _transparentFill = yes;
+}
+
+
QMap<QString, QVariant > KstViewBox::widgetHints(const QString& propertyName) const {
QMap<QString, QVariant> map = KstBorderedViewObject::widgetHints(propertyName);
if (!map.empty()) {
@@ -131,6 +146,10 @@
} else if (propertyName == "foreColor") {
map.insert(QString("_kst_widgetType"), QString("KColorButton"));
map.insert(QString("_kst_label"), i18n("Fill Color"));
+ } else if (propertyName == "transparentFill") {
+ map.insert(QString("_kst_widgetType"), QString("QCheckBox"));
+ map.insert(QString("_kst_label"), i18n(""));
+ map.insert(QString("text"), i18n("Transparent fill"));
}
return map;
}
--- trunk/extragear/graphics/kst/kst/kstviewbox.h #445380:445381
@@ -29,6 +29,7 @@
Q_OBJECT
Q_PROPERTY(int xRound READ xRound WRITE setXRound)
Q_PROPERTY(int yRound READ yRound WRITE setYRound)
+ Q_PROPERTY(bool transparentFill READ transparentFill WRITE setTransparentFill)
public:
KstViewBox();
KstViewBox(const QDomElement& e);
@@ -40,6 +41,9 @@
int yRound() const;
void setCornerStyle(Qt::PenJoinStyle style);
Qt::PenJoinStyle cornerStyle() const;
+
+ bool transparentFill() const;
+ void setTransparentFill(bool yes);
public slots:
virtual void paint(KstPaintType type, QPainter& p);
@@ -53,6 +57,7 @@
private:
int _xRound, _yRound;
Qt::PenJoinStyle _cornerStyle;
+ bool _transparentFill;
};
typedef KstObjectList<KstViewBoxPtr> KstViewBoxList;
--- trunk/extragear/graphics/kst/kst/kstviewellipse.cpp #445380:445381
@@ -26,6 +26,7 @@
KstViewEllipse::KstViewEllipse()
: KstViewObject("Ellipse"), _borderWidth(0) {
setTransparent(true);
+ _transparentFill = false;
_layoutActions |= Delete | Raise | Lower | RaiseToTop | LowerToBottom | Rename | MoveTo | Copy | CopyTo;
}
@@ -44,7 +45,11 @@
void KstViewEllipse::paint(KstPaintType type, QPainter& p) {
QPen pen(_borderColor, _borderWidth);
p.setPen(pen);
- p.setBrush(_foregroundColor);
+ if (_transparentFill) {
+ p.setBrush(Qt::NoBrush);
+ } else {
+ p.setBrush(_foregroundColor);
+ }
p.drawEllipse(geometry());
KstViewObject::paint(type, p);
}
@@ -111,6 +116,10 @@
} else if (propertyName == "fillColor") {
map.insert(QString("_kst_widgetType"), QString("KColorButton"));
map.insert(QString("_kst_label"), i18n("Fill Color"));
+ } else if (propertyName == "transparentFill") {
+ map.insert(QString("_kst_widgetType"), QString("QCheckBox"));
+ map.insert(QString("_kst_label"), i18n(""));
+ map.insert(QString("text"), i18n("Transparent fill"));
}
return map;
}
@@ -132,6 +141,16 @@
p.drawEllipse(rect);
}
+
+void KstViewEllipse::setTransparentFill(bool yes) {
+ _transparentFill = yes;
+}
+
+bool KstViewEllipse::transparentFill() const {
+ return _transparentFill;
+}
+
+
#include "kstviewellipse.moc"
// vim: ts=2 sw=2 et
--- trunk/extragear/graphics/kst/kst/kstviewellipse.h #445380:445381
@@ -28,6 +28,7 @@
Q_PROPERTY(QColor borderColor READ borderColor WRITE setBorderColor)
Q_PROPERTY(int borderWidth READ borderWidth WRITE setBorderWidth)
Q_PROPERTY(QColor fillColor READ foregroundColor WRITE setForegroundColor)
+ Q_PROPERTY(bool transparentFill READ transparentFill WRITE setTransparentFill)
public:
KstViewEllipse();
KstViewEllipse(const QDomElement& e);
@@ -42,6 +43,10 @@
virtual void setForegroundColor(const QColor& color);
virtual QColor foregroundColor() const;
+ bool transparentFill() const;
+ void setTransparentFill(bool yes);
+
+
virtual void drawShadow(QPainter& p, const QPoint& pos);
public slots:
@@ -58,6 +63,7 @@
private:
int _borderWidth;
QColor _borderColor;
+ bool _transparentFill;
};
typedef KstObjectList<KstViewEllipsePtr> KstViewEllipseList;
--- trunk/extragear/graphics/kst/kst/kstviewlabel.cpp #445380:445381
@@ -475,6 +475,14 @@
map.insert(QString("_kst_label"), i18n("Data precision"));
map.insert(QString("minValue"), 0);
map.insert(QString("maxValue"), 16);
+ } else if (propertyName == "fontSize") {
+ map.insert(QString("_kst_widgetType"), QString("QSpinBox"));
+ map.insert(QString("_kst_label"), i18n("Font size"));
+ map.insert(QString("minValue"), 0);
+ } else if (propertyName == "transparent") {
+ map.insert(QString("_kst_widgetType"), QString("QCheckBox"));
+ map.insert(QString("_kst_label"), i18n(""));
+ map.insert(QString("text"), i18n("Transparent fill"));
}
return map;
}
@@ -497,5 +505,15 @@
return _dataPrecision;
}
+
+void KstViewLabel::setTransparent(bool transparent) {
+ KstViewObject::setTransparent(transparent);
+}
+
+
+bool KstViewLabel::transparent() const {
+ return KstViewObject::transparent();
+}
+
#include "kstviewlabel.moc"
// vim: ts=2 sw=2 et
--- trunk/extragear/graphics/kst/kst/kstviewlabel.h #445380:445381
@@ -34,6 +34,8 @@
Q_PROPERTY(double rotation READ rotation WRITE setRotation)
Q_PROPERTY(QString font READ fontName WRITE setFontName)
Q_PROPERTY(int dataPrecision READ dataPrecision WRITE setDataPrecision)
+ Q_PROPERTY(uint fontSize READ fontSize WRITE setFontSize);
+ Q_PROPERTY(bool transparent READ transparent WRITE setTransparent)
public:
KstViewLabel(const QString& txt, KstLJustifyType justify = 0L, float rotation = 0.0);
virtual ~KstViewLabel();
@@ -69,6 +71,9 @@
void setDataPrecision(int prec);
int dataPrecision() const;
+
+ void setTransparent(bool transparent);
+ bool transparent() const;
virtual void paint(KstPaintType type, QPainter& p);
virtual void resize(const QSize&);
@@ -93,6 +98,7 @@
void computeTextSize(Label::Parsed*);
double _rotation;
+ bool _transparentFill;
QString _txt;
QString _symbolFontName;
QString _fontName;
More information about the Kst
mailing list