From b20b57b29fe2efcbafb064670a8ca53b0022eca0 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Thu, 25 Apr 2013 20:44:06 -0300 Subject: Make dirk happy by enabling sort in the model. Signed-off-by: Tomaz Canabrava --- qt-ui/mainwindow.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'qt-ui/mainwindow.cpp') diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp index b0b56a4e7..8cdc60193 100644 --- a/qt-ui/mainwindow.cpp +++ b/qt-ui/mainwindow.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #include "divelistview.h" #include "starwidget.h" @@ -22,13 +23,14 @@ MainWindow::MainWindow() : ui(new Ui::MainWindow()), - model(new DiveTripModel(this)) + model(new DiveTripModel(this)), + sortModel(new QSortFilterProxyModel()) { ui->setupUi(this); - ui->ListWidget->setModel(model); - setWindowIcon(QIcon(":subsurface-icon")); - // Just to test the star widgets, can be safely removed. + sortModel->setSourceModel(model); + ui->ListWidget->setModel(sortModel); + setWindowIcon(QIcon(":subsurface-icon")); } void MainWindow::on_actionNew_triggered() @@ -63,6 +65,10 @@ void MainWindow::on_actionOpen_triggered() report_dives(FALSE, FALSE); ui->InfoWidget->reload(); + + model->deleteLater(); + model = new DiveTripModel(this); + sortModel->setSourceModel(model); } void MainWindow::on_actionSave_triggered() -- cgit v1.2.3-70-g09d2