[Kst] extragear/graphics/kst/kst
Rick Chern
rchern at interchange.ubc.ca
Wed Aug 10 02:53:56 CEST 2005
SVN commit 444396 by rchern:
- view objects draw their own shadow outlines
- more consistent style outlines for rectangular objects
M +21 -6 ksttoplevelview.cpp
M +7 -0 kstviewellipse.cpp
M +2 -0 kstviewellipse.h
M +15 -0 kstviewline.cpp
M +2 -0 kstviewline.h
M +8 -0 kstviewobject.cpp
M +3 -0 kstviewobject.h
--- trunk/extragear/graphics/kst/kst/ksttoplevelview.cpp #444395:444396
@@ -651,13 +651,15 @@
QRect old = _prevBand;
QPoint topLeft;
QRect r;
+ QPoint originalTopLeft;
r = _pressTarget->geometry();
if (!_selectionList.isEmpty()) {
for (KstViewObjectList::Iterator i = _selectionList.begin(); i != _selectionList.end(); ++i) {
r = r.unite((*i)->geometry());
}
- }
+ }
+ originalTopLeft = r.topLeft();
topLeft = pos - _moveOffset - _pressTarget->geometry().topLeft() + r.topLeft();
r.moveTopLeft(topLeft);
_moveOffsetSticky = QPoint(0, 0);
@@ -723,8 +725,20 @@
p.begin(_w);
p.setRasterOp(Qt::NotROP);
- p.drawWinFocusRect(old);
- p.drawWinFocusRect(r);
+ p.setPen(QPen(Qt::black, 0, Qt::DotLine));
+ if (_selectionList.isEmpty()) {
+ if (old.topLeft() != QPoint(-1, -1)) {
+ _pressTarget->drawShadow(p, old.topLeft());
+ }
+ _pressTarget->drawShadow(p, r.topLeft());
+ } else {
+ for (KstViewObjectList::Iterator iter = _selectionList.begin(); iter != _selectionList.end(); ++iter) {
+ if (old.topLeft() != QPoint(-1, -1)) {
+ (*iter)->drawShadow(p, old.topLeft() + (*iter)->geometry().topLeft() - originalTopLeft);
+ }
+ (*iter)->drawShadow(p, r.topLeft() + (*iter)->geometry().topLeft() - originalTopLeft);
+ }
+ }
p.end();
}
}
@@ -739,11 +753,12 @@
QPainter p;
p.begin(_w);
- p.setRasterOp(Qt::XorROP);
+ p.setRasterOp(Qt::NotROP);
+ p.setPen(QPen(Qt::black, 0, Qt::DotLine));
if (old.topLeft() != QPoint(-1, -1)) {
- p.drawWinFocusRect(old);
+ p.drawRect(old);
}
- p.drawWinFocusRect(_prevBand);
+ p.drawRect(_prevBand);
p.end();
}
}
--- trunk/extragear/graphics/kst/kst/kstviewellipse.cpp #444395:444396
@@ -112,5 +112,12 @@
}
+void KstViewEllipse::drawShadow(QPainter& p, const QPoint& pos) {
+ QRect rect = geometry();
+ rect.moveTopLeft(pos);
+ p.drawEllipse(rect);
+}
+
+
#include "kstviewellipse.moc"
// vim: ts=2 sw=2 et
--- trunk/extragear/graphics/kst/kst/kstviewellipse.h #444395:444396
@@ -41,6 +41,8 @@
// can't have Q_PROPERTY in KstViewObject?
virtual void setForegroundColor(const QColor& color);
virtual QColor foregroundColor() const;
+
+ virtual void drawShadow(QPainter& p, const QPoint& pos);
public slots:
virtual void paint(KstPaintType type, QPainter& p);
--- trunk/extragear/graphics/kst/kst/kstviewline.cpp #444395:444396
@@ -313,5 +313,20 @@
}
+void KstViewLine::drawShadow(QPainter& p, const QPoint& pos) {
+ QPoint point1, point2;
+ QRect rect = geometry();
+ rect.moveTopLeft(pos);
+ if (_orientation == UpLeft || _orientation == DownRight) {
+ point1 = pos;
+ point2 = rect.bottomRight();
+ } else {
+ point1 = rect.topRight();
+ point2 = rect.bottomLeft();
+ }
+ p.drawLine(point1, point2);
+}
+
+
#include "kstviewline.moc"
// vim: ts=2 sw=2 et
--- trunk/extragear/graphics/kst/kst/kstviewline.h #444395:444396
@@ -65,6 +65,8 @@
virtual signed int directionFor(const QPoint& pos);
virtual QMap<QString, QPair<QString, QString> > dialogData() const;
+
+ virtual void drawShadow(QPainter& p, const QPoint& pos);
public slots:
virtual void paint(KstPaintType type, QPainter& p);
--- trunk/extragear/graphics/kst/kst/kstviewobject.cpp #444395:444396
@@ -1529,5 +1529,13 @@
}
+void KstViewObject::drawShadow(QPainter& p, const QPoint& pos) {
+ // default is a rectangle
+ QRect rect = geometry();
+ rect.moveTopLeft(pos);
+ p.drawRect(rect);
+}
+
+
#include "kstviewobject.moc"
// vim: ts=2 sw=2 et
--- trunk/extragear/graphics/kst/kst/kstviewobject.h #444395:444396
@@ -212,6 +212,9 @@
// following format:
// QT_PROPERTY-name -> (Friendly name, widget type)
virtual QMap<QString, QPair<QString, QString> > dialogData() const;
+
+ // draws a minimalistic shadow outline of this object at the given position
+ virtual void drawShadow(QPainter& p, const QPoint& pos);
public slots:
virtual void paint(KstPaintType type, QPainter& p);
More information about the Kst
mailing list