mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-13 16:18:42 +00:00
Fix TopNOverviewItem refresh when config changes
.. lookup metric when the configuration changes.
This commit is contained in:
@@ -793,14 +793,20 @@ TopNOverviewItem::TopNOverviewItem(ChartSpace *parent, QString name, QString sym
|
||||
this->type = OverviewItemType::TOPN;
|
||||
this->symbol = symbol;
|
||||
|
||||
RideMetricFactory &factory = RideMetricFactory::instance();
|
||||
this->metric = const_cast<RideMetric*>(factory.rideMetric(symbol));
|
||||
if (metric) units = metric->units(GlobalContext::context()->useMetricUnits);
|
||||
|
||||
animator=new QPropertyAnimation(this, "transition");
|
||||
|
||||
configwidget = new OverviewItemConfig(this);
|
||||
configwidget->hide();
|
||||
|
||||
configChanged(0);
|
||||
}
|
||||
|
||||
void
|
||||
TopNOverviewItem::configChanged(qint32)
|
||||
{
|
||||
RideMetricFactory &factory = RideMetricFactory::instance();
|
||||
this->metric = const_cast<RideMetric*>(factory.rideMetric(symbol));
|
||||
if (metric) units = metric->units(GlobalContext::context()->useMetricUnits);
|
||||
}
|
||||
|
||||
TopNOverviewItem::~TopNOverviewItem()
|
||||
|
||||
@@ -284,17 +284,18 @@ class TopNOverviewItem : public ChartSpaceItem
|
||||
int getTransition() const {return transition;}
|
||||
void setTransition(int x) { if (transition !=x) {transition=x; update();}}
|
||||
|
||||
bool sceneEvent(QEvent *event);
|
||||
void itemPaint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *);
|
||||
void itemGeometryChanged();
|
||||
void setData(RideItem *) {} // doesn't support analysis view
|
||||
void setDateRange(DateRange);
|
||||
QRectF hotspot();
|
||||
bool sceneEvent(QEvent *event) override;
|
||||
void itemPaint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) override;
|
||||
void itemGeometryChanged() override;
|
||||
void setData(RideItem *) override {} // doesn't support analysis view
|
||||
void setDateRange(DateRange) override;
|
||||
QRectF hotspot() override;
|
||||
|
||||
QWidget *config() { return configwidget; }
|
||||
QWidget *config() override { return configwidget; }
|
||||
|
||||
// create and config
|
||||
static ChartSpaceItem *create(ChartSpace *parent) { return new TopNOverviewItem(parent, "PowerIndex", "power_index"); }
|
||||
void configChanged(qint32) override;
|
||||
|
||||
QString symbol;
|
||||
RideMetric *metric;
|
||||
|
||||
Reference in New Issue
Block a user