summaryrefslogtreecommitdiffstats
path: root/qt-ui/mainwindow.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-04-25 20:49:03 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-04-25 20:49:03 -0700
commit106659774ae83b7442f6cc749273248e07ff6c80 (patch)
treefecdfd3362abac4065e3e10b70520cfa131640e5 /qt-ui/mainwindow.cpp
parent8da7a6985b057c5abfbd5ad1dbc7bdbfdcdfa0fb (diff)
parentb20b57b29fe2efcbafb064670a8ca53b0022eca0 (diff)
downloadsubsurface-106659774ae83b7442f6cc749273248e07ff6c80.tar.gz
Merge branch 'QtStuff' of git://github.com/tcanabrava/subsurface into Qt
Diffstat (limited to 'qt-ui/mainwindow.cpp')
-rw-r--r--qt-ui/mainwindow.cpp14
1 files changed, 10 insertions, 4 deletions
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 <QMessageBox>
#include <QtDebug>
#include <QDateTime>
+#include <QSortFilterProxyModel>
#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()