Permalink
Browse files

CP Plot Helper show model name

.. set the model overlay title to the full name of the
   model being used.
  • Loading branch information...
liversedge committed Sep 4, 2018
1 parent dd4ff86 commit 74fe950fc2b7f56f729e395c600487d531175024
Showing with 23 additions and 1 deletion.
  1. +9 −0 src/Charts/CPPlot.cpp
  2. +7 −1 src/Charts/GcOverlayWidget.cpp
  3. +7 −0 src/Charts/GcOverlayWidget.h
View
@@ -40,6 +40,7 @@
#include <algorithm> // for std::lower_bound
#include "CriticalPowerWindow.h"
#include "GcOverlayWidget.h"
#include "RideItem.h"
#include "IntervalItem.h"
#include "LogTimeScaleDraw.h"
@@ -370,6 +371,9 @@ CPPlot::initModel()
if (pdModel) {
// Model helper
parent->overlayWidget->setTitle(0, pdModel->name());
if (fit == 0 || model >= 3) { //!!! always envelope fit the ecp, ward-smith and velo model
// envelope fit always uses all data
@@ -400,6 +404,11 @@ CPPlot::initModel()
updateModelHelper();
parent->setSummary(pdModel->fitsummary);
} else {
// Model helper
parent->overlayWidget->setTitle(0, tr("No Model"));
}
#if GC_HAVE_MODEL_LABS
@@ -139,8 +139,8 @@ void
GcOverlayWidget::setCurrentIndex(int index)
{
if (initial || index != stack->currentIndex()) {
titleLabel->setText(items.at(index).name);
stack->setCurrentIndex(index);
setLabel();
// tell everyone we changed
emit currentIndexChanged(index);
@@ -149,6 +149,12 @@ GcOverlayWidget::setCurrentIndex(int index)
}
}
void
GcOverlayWidget::setLabel()
{
titleLabel->setText(items.at(stack->currentIndex()).name);
}
int
GcOverlayWidget::currentIndex() const
{
@@ -66,6 +66,7 @@ public slots:
// events
void paintEvent (QPaintEvent *event);
void setLabel(); // when name changes
//void resizeEvent(QResizeEvent *);
//bool eventFilter(QObject *object, QEvent *e); // trap resize
void configChanged(qint32);
@@ -75,6 +76,12 @@ public slots:
void scrollLeft(); // scroll left action
void scrollRight(); // scroll right action
// set the title
void setTitle(int index, QString text) {
items[index].name = text;
setLabel();
}
signals:
void currentIndexChanged(int);

0 comments on commit 74fe950

Please sign in to comment.