LTMPlot refresh optimisation

Only refresh when dateRange actually changes
within dateRangeChanged() since it is a signal
used by the HomeWindow to ask a replot when
a tab is selected.

Should speed up navigation across diary and
home view.
This commit is contained in:
Mark Liversedge
2012-12-20 14:50:10 +00:00
parent 1e9f72ab3e
commit 030fa04b0c
2 changed files with 8 additions and 1 deletions

View File

@@ -40,6 +40,7 @@ LTMWindow::LTMWindow(MainWindow *parent, bool useMetricUnits, const QDir &home)
{
main = parent;
setInstanceName("Metric Window");
plotted = DateRange(QDate(01,01,01), QDate(01,01,01));
// the plot
QVBoxLayout *mainLayout = new QVBoxLayout;
@@ -157,6 +158,7 @@ void
LTMWindow::refreshPlot()
{
if (amVisible() == true) {
plotted = myDateRange;
ltmPlot->setData(&settings);
dirty = false;
}
@@ -199,9 +201,13 @@ LTMWindow::metricSelected()
void
LTMWindow::dateRangeChanged(DateRange range)
{ Q_UNUSED( range )
{
if (!amVisible() && !dirty) return;
// we already plotted that date range
if (range.from == plotted.from &&
range.to == plotted.to) return;
settings.data = &results;
settings.measures = &measures;