[Kst] branches/work/kst/1.6/kst/src/libkstapp
Andrew Walker
arwalker at sumusltd.com
Thu Nov 22 01:24:55 CET 2007
SVN commit 739835 by arwalker:
BUG:152613 center axes titles relative to the axes rather than the plot rectangle
M +6 -4 kst2dplot.cpp
M +1 -1 kst2dplot.h
--- branches/work/kst/1.6/kst/src/libkstapp/kst2dplot.cpp #739834:739835
@@ -2710,7 +2710,7 @@
bt_label[i_bt] = "Initialization";
bt[i_bt++] = benchTime.elapsed();
#endif
- plotLabels(p, x_px, y_px, xleft_bdr_px, xright_bdr_px, ytop_bdr_px);
+ plotLabels(p, x_px, y_px, xleft_bdr_px, xright_bdr_px, ytop_bdr_px, ybot_bdr_px);
p.flush();
#ifdef BENCHMARK
bt_label[i_bt] = "Plot Labels";
@@ -6233,17 +6233,19 @@
}
-void Kst2DPlot::plotLabels(QPainter &p, int x_px, int y_px, double xleft_bdr_px, double xright_bdr_px, double ytop_bdr_px) {
+void Kst2DPlot::plotLabels(QPainter &p, int x_px, int y_px, double xleft_bdr_px, double xright_bdr_px, double ytop_bdr_px, double ybot_bdr_px) {
if (!_suppressBottom) {
p.save();
- p.translate((x_px - _xLabel->size().width() + xleft_bdr_px) / 2, y_px - _xLabel->size().height());
+ p.translate((x_px + xleft_bdr_px - xright_bdr_px - _xLabel->size().width()) / 2,
+ y_px - _xLabel->size().height());
_xLabel->paint(p);
p.restore();
}
if (!_suppressLeft) {
p.save();
- p.translate((_yLabel->lineSpacing() - _yLabel->ascent())/2, (y_px - _yLabel->size().height()) / 2 - ytop_bdr_px/2);
+ p.translate((_yLabel->lineSpacing() - _yLabel->ascent())/2,
+ (y_px + ytop_bdr_px - ybot_bdr_px - _yLabel->size().height()) / 2);
_yLabel->paint(p);
p.restore();
}
--- branches/work/kst/1.6/kst/src/libkstapp/kst2dplot.h #739834:739835
@@ -643,7 +643,7 @@
QString _xTransformedExp, _yTransformedExp;
// helper functions for draw(...)
- void plotLabels(QPainter& p, int x_px, int y_px, double xleft_bdr_px, double xright_bdr_px, double ytop_bdr_px);
+ void plotLabels(QPainter& p, int x_px, int y_px, double xleft_bdr_px, double xright_bdr_px, double ytop_bdr_px, double ybot_bdr_px);
void plotAxes(QPainter& p, QRect& plotRegion,
TickParameters tpx,
double xleft_bdr_px, double xright_bdr_px,
More information about the Kst
mailing list