Further UI fixups

More work to unify the tab view with the overall
UI look-and-feel, allowing you to remove and add
tabs via mouse over rather than the close tab
icon. Also added a number of cosmetic adjustments.

Fixed up PerformanceManager and ScatterPlot to
pick up on the chart fonts and tick size etc.

Removed some erroneous static members in the
ScatterPlot that caused a SEGV when adding multiple
charts (or cancelling an add then adding again).
This commit is contained in:
Mark Liversedge
2011-06-10 23:27:51 +01:00
parent 819729f4db
commit da8eec1b13
8 changed files with 95 additions and 15 deletions

View File

@@ -22,6 +22,7 @@
#include <qwt_data.h>
#include <qwt_legend.h>
#include <qwt_plot_curve.h>
#include <qwt_plot_canvas.h>
#include <qwt_plot_grid.h>
#include "RideItem.h"
#include "RideFile.h"
@@ -34,11 +35,27 @@ PerfPlot::PerfPlot() : STScurve(NULL), LTScurve(NULL), SBcurve(NULL), DAYcurve(N
setInstanceName("PM Plot");
insertLegend(new QwtLegend(), QwtPlot::BottomLegend);
setTitle(tr("Performance Manager"));
setAxisTitle(yLeft, "Exponentially Weighted Average Stress");
setAxisTitle(xBottom, "Time (days)");
setAxisTitle(yRight, "Daily Stress");
enableAxis(yRight, true);
canvas()->setFrameStyle(QFrame::NoFrame);
setAxisMaxMinor(xBottom, 0);
setAxisMaxMinor(yLeft, 0);
setAxisMaxMinor(yRight, 0);
QwtScaleDraw *sd = new QwtScaleDraw;
sd->setTickLength(QwtScaleDiv::MajorTick, 3);
setAxisScaleDraw(QwtPlot::xBottom, sd);
sd = new QwtScaleDraw;
sd->setTickLength(QwtScaleDiv::MajorTick, 3);
setAxisScaleDraw(QwtPlot::yLeft, sd);
sd = new QwtScaleDraw;
sd->setTickLength(QwtScaleDiv::MajorTick, 3);
setAxisScaleDraw(QwtPlot::yRight, sd);
grid = new QwtPlotGrid();
grid->attach(this);
@@ -176,5 +193,16 @@ void PerfPlot::resize(int newmin, int newmax)
}
void
PerfPlot::setAxisTitle(int axis, QString label)
{
// setup the default fonts
QFont stGiles; // hoho - Chart Font St. Giles ... ok you have to be British to get this joke
stGiles.fromString(appsettings->value(this, GC_FONT_CHARTLABELS, QFont().toString()).toString());
stGiles.setPointSize(appsettings->value(NULL, GC_FONT_CHARTLABELS_SIZE, 8).toInt());
QwtText title(label);
title.setFont(stGiles);
QwtPlot::setAxisFont(axis, stGiles);
QwtPlot::setAxisTitle(axis, title);
}