Commit 60d2e2ee authored by Volker Krause's avatar Volker Krause
Browse files

Show the current time for singular charts

parent 2740e69b
......@@ -117,8 +117,10 @@ AnalyticsView::AnalyticsView(QWidget* parent) :
connect(ui->chartType, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &AnalyticsView::chartSelected);
connect(ui->timeSlider, &QSlider::valueChanged, this, [this](int value) {
auto aggr = ui->chartType->currentData().value<Aggregator*>();
if (aggr)
aggr->setSingularTime(value);
if (!aggr)
return;
aggr->setSingularTime(value);
ui->timeLabel->setText(aggr->singularAggregationModel()->index(0, 0).data(TimeAggregationModel::TimeDisplayRole).toString());
});
}
......@@ -208,9 +210,10 @@ void AnalyticsView::updateChart()
void AnalyticsView::updateTimeSliderRange()
{
qDebug() << m_timeAggregationModel->rowCount() << ui->timeSlider->maximum() << ui->timeSlider->minimum();
if (m_timeAggregationModel->rowCount() > 0)
if (m_timeAggregationModel->rowCount() > 0) {
ui->timeSlider->setRange(0, m_timeAggregationModel->rowCount() - 1);
ui->timeLabel->setText(m_timeAggregationModel->index(ui->timeSlider->value(), 0).data(TimeAggregationModel::TimeDisplayRole).toString());
}
}
Aggregator* AnalyticsView::createAggregator(const Aggregation& aggr) const
......
......@@ -80,27 +80,22 @@
</widget>
<widget class="QWidget" name="singularPage">
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QtCharts::QChartView" name="singularChartView"/>
</item>
<item>
<widget class="QSlider" name="timeSlider">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QSlider" name="timeSlider">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="timeLabel"/>
</item>
</layout>
</item>
</layout>
</widget>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment