From 77a3e6ac704c84548d383818dfbe17e3378b8151 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Fri, 16 Jun 2017 01:22:44 -0700 Subject: [PATCH] QML UI: clear the previous list when downloading When you start a new session with Download from DC, clear out the table from the last attempt before adding the page. Signed-off-by: Dirk Hohndel --- mobile-widgets/qml/DownloadFromDiveComputer.qml | 1 + mobile-widgets/qml/main.qml | 1 + qt-models/diveimportedmodel.h | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/mobile-widgets/qml/DownloadFromDiveComputer.qml b/mobile-widgets/qml/DownloadFromDiveComputer.qml index c61ac7df1..460fa151e 100644 --- a/mobile-widgets/qml/DownloadFromDiveComputer.qml +++ b/mobile-widgets/qml/DownloadFromDiveComputer.qml @@ -16,6 +16,7 @@ Kirigami.Page { title: qsTr("Dive Computer") property bool selectAll : false + property alias dcImportModel: importModel DCDownloadThread { id: downloadThread diff --git a/mobile-widgets/qml/main.qml b/mobile-widgets/qml/main.qml index c4a6a99d6..5a5d7d20e 100644 --- a/mobile-widgets/qml/main.qml +++ b/mobile-widgets/qml/main.qml @@ -157,6 +157,7 @@ Kirigami.ApplicationWindow { text: qsTr("Download from DC") enabled: true onTriggered: { + downloadFromDc.dcImportModel.clearTable() stackView.push(downloadFromDc) } } diff --git a/qt-models/diveimportedmodel.h b/qt-models/diveimportedmodel.h index 3d128b074..2cca49f3d 100644 --- a/qt-models/diveimportedmodel.h +++ b/qt-models/diveimportedmodel.h @@ -18,7 +18,7 @@ public: QVariant headerData(int section, Qt::Orientation orientation, int role) const; void setImportedDivesIndexes(int first, int last); Qt::ItemFlags flags(const QModelIndex &index) const; - void clearTable(); + Q_INVOKABLE void clearTable(); QHash roleNames() const; Q_INVOKABLE void repopulate(); Q_INVOKABLE void recordDives();