Upgraded Qwt to 6.2 (branch: qwt-multiaxes) (#4427)

This commit is based on https://github.com/GoldenCheetah/GoldenCheetah/pull/3956
with the following additions / changes:
* Upgraded to the latest version of the multiaxes-branch, thus eliminating crashes of GoldenCheetah on startup
* Disabled the emitting of Layout Requests on geometry changes of QwtScaleWidget - without this, CPU utilization was up to 100% on one core
* Added the class SplineLookup, reusing small portions of code from Qwt 6.1
* Re-added the splines in WPrime and RideFile (resampling), using the new interface of QwtSpline
* Appveyor: qwt in cache-section now depends on qwt/qwtconfig.prin.in for refresh on version change
This commit is contained in:
Joachim Kohlhammer
2024-01-06 22:59:55 +01:00
committed by GitHub
parent ea044a0c39
commit 49cf6340a4
991 changed files with 63097 additions and 46278 deletions

View File

@@ -154,7 +154,7 @@ QwtScaleDiv LogTimeScaleEngine::divideScale(double x1, double x2,
QwtScaleDiv scaleDiv;
if ( stepSize != 0.0 )
{
QwtValueList ticks[QwtScaleDiv::NTickTypes];
QList<double> ticks[QwtScaleDiv::NTickTypes];
buildTicks(interval, stepSize, maxMinSteps, ticks);
scaleDiv = QwtScaleDiv(interval, ticks);
@@ -168,7 +168,7 @@ QwtScaleDiv LogTimeScaleEngine::divideScale(double x1, double x2,
void LogTimeScaleEngine::buildTicks(
const QwtDoubleInterval& interval, double stepSize, int maxMinSteps,
QwtValueList ticks[QwtScaleDiv::NTickTypes]) const
QList<double> ticks[QwtScaleDiv::NTickTypes]) const
{
const QwtDoubleInterval boundingInterval =
align(interval, stepSize);
@@ -210,12 +210,12 @@ tick_info_t tick_info[] = {
{ -1.0, NULL }
};
QwtValueList LogTimeScaleEngine::buildMajorTicks(
QList<double> LogTimeScaleEngine::buildMajorTicks(
const QwtDoubleInterval &interval, double stepSize) const
{
(void) interval;
(void) stepSize;
QwtValueList ticks;
QList<double> ticks;
tick_info_t *walker = tick_info;
while (walker->label) {
ticks += walker->x;
@@ -224,14 +224,14 @@ QwtValueList LogTimeScaleEngine::buildMajorTicks(
return ticks;
}
QwtValueList LogTimeScaleEngine::buildMinorTicks(
const QwtValueList &majorTicks,
QList<double> LogTimeScaleEngine::buildMinorTicks(
const QList<double> &majorTicks,
int maxMinSteps, double stepSize) const
{
(void) majorTicks;
(void) maxMinSteps;
(void) stepSize;
QwtValueList minorTicks;
QList<double> minorTicks;
return minorTicks;
}

View File

@@ -53,13 +53,13 @@ class LogTimeScaleEngine : public QwtScaleEngine
void buildTicks(
const QwtDoubleInterval &, double stepSize, int maxMinSteps,
QwtValueList ticks[QwtScaleDiv::NTickTypes]) const;
QList<double> ticks[QwtScaleDiv::NTickTypes]) const;
QwtValueList buildMinorTicks(
const QwtValueList& majorTicks,
QList<double> buildMinorTicks(
const QList<double>& majorTicks,
int maxMinMark, double step) const;
QwtValueList buildMajorTicks(
QList<double> buildMajorTicks(
const QwtDoubleInterval &interval, double stepSize) const;
};

View File

@@ -48,26 +48,26 @@ PerfPlot::PerfPlot() : STScurve(NULL), LTScurve(NULL), SBcurve(NULL), DAYcurve(N
{
xsd = new PPTimeScaleDraw(QDateTime());
xsd->setTickLength(QwtScaleDiv::MajorTick, 3);
setAxisScaleDraw(QwtPlot::xBottom, xsd);
setAxisScaleDraw(QwtAxis::XBottom, xsd);
insertLegend(new QwtLegend(), QwtPlot::BottomLegend);
setAxisTitle(yLeft, tr("Exponentially Weighted Average Stress"));
setAxisTitle(xBottom, tr("Time (days)"));
setAxisTitle(yRight, tr("Daily Stress"));
enableAxis(yRight, true);
setAxisTitle(YLeft, tr("Exponentially Weighted Average Stress"));
setAxisTitle(XBottom, tr("Time (days)"));
setAxisTitle(QwtAxis::YRight, tr("Daily Stress"));
setAxisVisible(QwtAxis::YRight, true);
static_cast<QwtPlotCanvas*>(canvas())->setFrameStyle(QFrame::NoFrame);
setAxisMaxMinor(xBottom, 0);
setAxisMaxMinor(yLeft, 0);
setAxisMaxMinor(yRight, 0);
setAxisMaxMinor(XBottom, 0);
setAxisMaxMinor(YLeft, 0);
setAxisMaxMinor(QwtAxis::YRight, 0);
QwtScaleDraw *sd = new QwtScaleDraw;
sd->setTickLength(QwtScaleDiv::MajorTick, 3);
setAxisScaleDraw(QwtPlot::yLeft, sd);
setAxisScaleDraw(QwtAxis::YLeft, sd);
sd = new QwtScaleDraw;
sd->setTickLength(QwtScaleDiv::MajorTick, 3);
setAxisScaleDraw(QwtPlot::yRight, sd);
setAxisScaleDraw(QwtAxis::YRight, sd);
grid = new QwtPlotGrid();
grid->attach(this);
@@ -99,7 +99,7 @@ void PerfPlot::plot() {
int num, tics;
tics = 42;
setAxisScale(yLeft, _sc->min(), _sc->max());
setAxisScale(YLeft, _sc->min(), _sc->max());
num = xmax - xmin;
/*
@@ -117,8 +117,8 @@ void PerfPlot::plot() {
} else if (num < 364) {
tics = 27;
}
setAxisScale(xBottom, xmin, xmax,tics);
axisWidget(xBottom)->update();
setAxisScale(XBottom, xmin, xmax,tics);
axisWidget(XBottom)->update();
// set base
xsd->setBase(startDate);
@@ -142,7 +142,7 @@ void PerfPlot::plot() {
// |
// V
DAYcurve->setSamples(_sc->getDays()+xmin -1 ,_sc->getDAYvalues()+xmin,num);
DAYcurve->setYAxis(yRight);
DAYcurve->setYAxis(QwtAxis::YRight);
DAYcurve->attach(this);
if (STScurve) {
@@ -186,7 +186,7 @@ void PerfPlot::plot() {
SBcurve->setSamples(_sc->getDays()+xmin,_sc->getSBvalues()+xmin,num);
SBcurve->attach(this);
axisWidget(QwtPlot::xBottom)->update();
axisWidget(QwtAxis::XBottom)->update();
replot();
}

View File

@@ -100,7 +100,7 @@ PerformanceManagerWindow::PerformanceManagerWindow(Context *context) :
vlayout->addLayout(PMPickerLayout);
setLayout(vlayout);
PMpicker = new QwtPlotPicker(QwtPlot::xBottom, QwtPlot::yLeft,
PMpicker = new QwtPlotPicker(QwtAxis::XBottom, QwtAxis::YLeft,
QwtPicker::VLineRubberBand,
QwtPicker::AlwaysOff, perfplot->canvas());
PMpicker->setStateMachine(new QwtPickerDragPointMachine);
@@ -283,7 +283,7 @@ void PerformanceManagerWindow::replot()
void
PerformanceManagerWindow::PMpickerMoved(const QPoint &pos)
{
double day = perfplot->invTransform(QwtPlot::xBottom, pos.x());
double day = perfplot->invTransform(QwtAxis::XBottom, pos.x());
QDateTime date;
double sts, lts, sb;

View File

@@ -44,14 +44,14 @@ WeeklySummaryWindow::WeeklySummaryWindow(bool useMetricUnits,
// set up the weekly distance / duration plot:
weeklyPlot = new QwtPlot();
weeklyPlot->enableAxis(QwtPlot::yRight, true);
weeklyPlot->setAxisMaxMinor(QwtPlot::xBottom,0);
weeklyPlot->setAxisScaleDraw(QwtPlot::xBottom, new DaysScaleDraw());
QFont weeklyPlotAxisFont = weeklyPlot->axisFont(QwtPlot::yLeft);
weeklyPlot->setAxisVisible(QwtAxis::YRight, true);
weeklyPlot->setAxisMaxMinor(QwtAxis::XBottom,0);
weeklyPlot->setAxisScaleDraw(QwtAxis::XBottom, new DaysScaleDraw());
QFont weeklyPlotAxisFont = weeklyPlot->axisFont(QwtAxis::YLeft);
weeklyPlotAxisFont.setPointSize(weeklyPlotAxisFont.pointSize() * 0.9f);
weeklyPlot->setAxisFont(QwtPlot::xBottom, weeklyPlotAxisFont);
weeklyPlot->setAxisFont(QwtPlot::yLeft, weeklyPlotAxisFont);
weeklyPlot->setAxisFont(QwtPlot::yRight, weeklyPlotAxisFont);
weeklyPlot->setAxisFont(QwtAxis::XBottom, weeklyPlotAxisFont);
weeklyPlot->setAxisFont(QwtAxis::YLeft, weeklyPlotAxisFont);
weeklyPlot->setAxisFont(QwtAxis::YRight, weeklyPlotAxisFont);
weeklyPlot->canvas()->setFrameStyle(QFrame::NoFrame);
weeklyPlot->setCanvasBackground(Qt::white);
@@ -70,18 +70,18 @@ WeeklySummaryWindow::WeeklySummaryWindow(bool useMetricUnits,
weeklyDurationCurve->setBrush(QColor(255,200,0,255));
weeklyDurationCurve->setRenderHint(QwtPlotItem::RenderAntialiased);
weeklyDurationCurve->setCurveAttribute(QwtPlotCurve::Inverted, true); // inverted, right-to-left
weeklyDurationCurve->setYAxis(QwtPlot::yRight);
weeklyDurationCurve->setYAxis(QwtAxis::YRight);
weeklyDurationCurve->attach(weeklyPlot);
// set up the weekly bike score plot:
weeklyBSPlot = new QwtPlot();
weeklyBSPlot->enableAxis(QwtPlot::yRight, true);
weeklyBSPlot->setAxisMaxMinor(QwtPlot::xBottom,0);
weeklyBSPlot->setAxisScaleDraw(QwtPlot::xBottom, new DaysScaleDraw());
weeklyBSPlot->setAxisVisible(QwtAxis::YRight, true);
weeklyBSPlot->setAxisMaxMinor(QwtAxis::XBottom,0);
weeklyBSPlot->setAxisScaleDraw(QwtAxis::XBottom, new DaysScaleDraw());
QwtText textLabel = QwtText();
weeklyBSPlot->setAxisFont(QwtPlot::xBottom, weeklyPlotAxisFont);
weeklyBSPlot->setAxisFont(QwtPlot::yLeft, weeklyPlotAxisFont);
weeklyBSPlot->setAxisFont(QwtPlot::yRight, weeklyPlotAxisFont);
weeklyBSPlot->setAxisFont(QwtAxis::XBottom, weeklyPlotAxisFont);
weeklyBSPlot->setAxisFont(QwtAxis::YLeft, weeklyPlotAxisFont);
weeklyBSPlot->setAxisFont(QwtAxis::YRight, weeklyPlotAxisFont);
weeklyBSPlot->canvas()->setFrameStyle(QFrame::NoFrame);
weeklyBSPlot->setCanvasBackground(Qt::white);
@@ -99,7 +99,7 @@ WeeklySummaryWindow::WeeklySummaryWindow(bool useMetricUnits,
weeklyRICurve->setBrush(Qt::green);
weeklyRICurve->setRenderHint(QwtPlotItem::RenderAntialiased);
weeklyRICurve->setCurveAttribute(QwtPlotCurve::Inverted, true); // inverted, right-to-left
weeklyRICurve->setYAxis(QwtPlot::yRight);
weeklyRICurve->setYAxis(QwtAxis::YRight);
weeklyRICurve->attach(weeklyBSPlot);
// set baseline curves to obscure linewidth variations along baseline
@@ -342,13 +342,13 @@ WeeklySummaryWindow::refresh()
weeklyPlotAxisTitleFont.setPointSize(10);
weeklyPlotAxisTitleFont.setBold(true);
textLabel.setFont(weeklyPlotAxisTitleFont);
weeklyPlot->setAxisTitle(QwtPlot::yLeft, textLabel);
weeklyPlot->setAxisTitle(QwtAxis::YLeft, textLabel);
textLabel.setText("Minutes");
weeklyPlot->setAxisTitle(QwtPlot::yRight, textLabel);
weeklyPlot->setAxisTitle(QwtAxis::YRight, textLabel);
textLabel.setText(useBikeScore ? "BikeScore" : "kJoules");
weeklyBSPlot->setAxisTitle(QwtPlot::yLeft, textLabel);
weeklyBSPlot->setAxisTitle(QwtAxis::YLeft, textLabel);
textLabel.setText(useBikeScore ? "Intensity" : "xPower");
weeklyBSPlot->setAxisTitle(QwtPlot::yRight, textLabel);
weeklyBSPlot->setAxisTitle(QwtAxis::YRight, textLabel);
// for the daily distance/duration and bikescore plots:
// first point: establish zero position
@@ -428,18 +428,18 @@ WeeklySummaryWindow::refresh()
// Distance/Duration plot:
weeklyDistCurve->setData(xdist, ydist, 16);
weeklyPlot->setAxisScale(QwtPlot::yLeft, 0, weeklyDistCurve->maxYValue()*1.1, 0);
weeklyPlot->setAxisScale(QwtPlot::xBottom, 0.5, 7.5, 0);
weeklyPlot->setAxisTitle(QwtPlot::yLeft, useMetricUnits ? "Kilometers" : "Miles");
weeklyPlot->setAxisScale(QwtAxis::YLeft, 0, weeklyDistCurve->maxYValue()*1.1, 0);
weeklyPlot->setAxisScale(QwtAxis::XBottom, 0.5, 7.5, 0);
weeklyPlot->setAxisTitle(QwtAxis::YLeft, useMetricUnits ? "Kilometers" : "Miles");
weeklyDurationCurve->setData(xdur, ydur, 16);
weeklyPlot->setAxisScale(QwtPlot::yRight, 0, weeklyDurationCurve->maxYValue()*1.1, 0);
weeklyPlot->setAxisScale(QwtAxis::YRight, 0, weeklyDurationCurve->maxYValue()*1.1, 0);
weeklyPlot->replot();
// BikeScore/Relative Intensity plot
weeklyBSCurve->setData(xbsorw, ybsorw, 16);
weeklyBSPlot->setAxisScale(QwtPlot::yLeft, 0, weeklyBSCurve->maxYValue()*1.1, 0);
weeklyBSPlot->setAxisScale(QwtPlot::xBottom, 0.5, 7.5, 0);
weeklyBSPlot->setAxisScale(QwtAxis::YLeft, 0, weeklyBSCurve->maxYValue()*1.1, 0);
weeklyBSPlot->setAxisScale(QwtAxis::XBottom, 0.5, 7.5, 0);
// set axis minimum for relative intensity
double RImin = -1;
@@ -454,7 +454,7 @@ WeeklySummaryWindow::refresh()
yriorxp[i] = RImin;
weeklyRICurve->setBaseline(RImin);
weeklyRICurve->setData(xriorxp, yriorxp, 16);
weeklyBSPlot->setAxisScale(QwtPlot::yRight, RImin, weeklyRICurve->maxYValue()*1.1, 0);
weeklyBSPlot->setAxisScale(QwtAxis::YRight, RImin, weeklyRICurve->maxYValue()*1.1, 0);
weeklyBSPlot->replot();