MainWindow: maintain one window instance of the yearly statistics

This is a bit tricky because we are using a plain widget for
a window and don't have a class for it (req. more source files).
Also for the table model to update we need to create a new
YearlyStatisticsModel instance each time. At least, in that regard
we can re-create the model each time refreshDisplay() is called.

This patch adds a couple of private variables that are used
to manage the memory of the yearly statistics model and window
and also close that same window on MainWindow::closeEvent().

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Lubomir I. Ivanov 2014-03-11 18:31:00 +02:00 committed by Dirk Hohndel
parent 4abe9d5c8b
commit 5b3dab719e
2 changed files with 34 additions and 9 deletions

View file

@ -156,6 +156,8 @@ private:
QAction *actionNextDive;
QAction *actionPreviousDive;
UserManual *helpView;
QTreeView *yearlyStats;
QAbstractItemModel *yearlyStatsModel;
CurrentState state;
QString filter();
static MainWindow *m_Instance;