[Kst] branches/work/kst/portto4/kst/src
Barth Netterfield
netterfield at astro.utoronto.ca
Tue Jan 3 18:55:47 UTC 2012
SVN commit 1271289 by netterfield:
Points scale properly when printing (and resizing windows).
M +1 -1 libkstmath/curve.cpp
M +5 -4 libkstmath/curvepointsymbol.cpp
M +1 -1 libkstmath/curvepointsymbol.h
M +3 -3 widgets/curveappearance.cpp
--- branches/work/kst/portto4/kst/src/libkstmath/curve.cpp #1271288:1271289
@@ -1588,7 +1588,7 @@
if (hasPoints()) {
// draw a point in the middle
p->setPen(QPen(color(), width));
- CurvePointSymbol::draw(PointType, p, bound.left() + bound.width()*.5, bound.top() + bound.height()*.5, width, 600);
+ CurvePointSymbol::draw(PointType, p, bound.left() + bound.width()*.5, bound.top() + bound.height()*.5, width);
}
p->restore();
}
--- branches/work/kst/portto4/kst/src/libkstmath/curvepointsymbol.cpp #1271288:1271289
@@ -24,19 +24,20 @@
namespace CurvePointSymbol {
-void draw(int Type, QPainter *p, double x, double y, int lineSize, int size) {
- Q_UNUSED(size)
+void draw(int Type, QPainter *p, double x, double y, int lineSize) {
double s;
+ s = (p->window().width()+p->window().height())*0.003;
+ if (s<3.0) s = 3.0;
+
if (Type < 0 || Type > KSTPOINT_MAXTYPE) {
Type = 0;
}
if (lineSize == 0 || lineSize == 1) {
- s = 3.0;
} else {
- s = ( 3.0 * lineSize ) / 2.0;
+ s = ( s * lineSize ) / 2.0;
}
switch (Type) {
--- branches/work/kst/portto4/kst/src/libkstmath/curvepointsymbol.h #1271288:1271289
@@ -27,7 +27,7 @@
namespace CurvePointSymbol {
/** draw the point on a painter the scale of the point is based on size */
- KSTMATH_EXPORT void draw(int type, QPainter *p, double x, double y, int lineSize = 0, int size = -1);
+ KSTMATH_EXPORT void draw(int type, QPainter *p, double x, double y, int lineSize = 0);
/** Get the dimension of a point */
KSTMATH_EXPORT int dim(const QRect &window);
}
--- branches/work/kst/portto4/kst/src/widgets/curveappearance.cpp #1271288:1271289
@@ -116,7 +116,7 @@
for (int ptype = 0; ptype < KSTPOINT_MAXTYPE; ptype++) {
pp.fillRect(pp.window(), QColor("white"));
- CurvePointSymbol::draw(ptype, &pp, ppix.width()/2, ppix.height()/2, 0, 600);
+ CurvePointSymbol::draw(ptype, &pp, ppix.width()/2, ppix.height()/2, 0);
combo->addItem(QIcon(ppix), QString());
}
@@ -477,14 +477,14 @@
if (showPoints()) {
pen.setStyle(Qt::SolidLine);
p.setPen(pen);
- CurvePointSymbol::draw(pointType(), &p, pix.width()/2, pix.height()/2, lineWidth(), 600);
+ CurvePointSymbol::draw(pointType(), &p, pix.width()/2, pix.height()/2, lineWidth());
}
if (showHead()) {
pen.setStyle(Qt::SolidLine);
pen.setColor(headColor());
p.setPen(pen);
- CurvePointSymbol::draw(headType(), &p, pix.width()-10, pix.height()/2, lineWidth(), 600);
+ CurvePointSymbol::draw(headType(), &p, pix.width()-10, pix.height()/2, lineWidth());
}
_label->setPixmap(pix);
}
More information about the Kst
mailing list