diff options
-rw-r--r-- | qt-models/divecomputermodel.cpp | 10 | ||||
-rw-r--r-- | qt-models/divecomputermodel.h | 1 | ||||
-rw-r--r-- | qt-models/gpslistmodel.cpp | 1 |
3 files changed, 11 insertions, 1 deletions
diff --git a/qt-models/divecomputermodel.cpp b/qt-models/divecomputermodel.cpp index 356e24ef8..c51e19279 100644 --- a/qt-models/divecomputermodel.cpp +++ b/qt-models/divecomputermodel.cpp @@ -2,11 +2,21 @@ #include "qt-models/divecomputermodel.h" #include "core/dive.h" #include "core/divelist.h" +#include "core/subsurface-qt/divelistnotifier.h" DiveComputerModel::DiveComputerModel(QObject *parent) : CleanerTableModel(parent), dcs(device_table.devices) { + connect(&diveListNotifier, &DiveListNotifier::dataReset, this, &DiveComputerModel::update); setHeaderDataStrings(QStringList() << "" << tr("Model") << tr("Device ID") << tr("Nickname")); + update(); +} + +void DiveComputerModel::update() +{ + beginResetModel(); + dcs = device_table.devices; + endResetModel(); } QVariant DiveComputerModel::data(const QModelIndex &index, int role) const diff --git a/qt-models/divecomputermodel.h b/qt-models/divecomputermodel.h index 7f3d4171f..17f145f78 100644 --- a/qt-models/divecomputermodel.h +++ b/qt-models/divecomputermodel.h @@ -25,6 +25,7 @@ public: public slots: void remove(const QModelIndex &index); + void update(); private: std::vector<device> dcs; diff --git a/qt-models/gpslistmodel.cpp b/qt-models/gpslistmodel.cpp index c463c3ed2..5fa7d1081 100644 --- a/qt-models/gpslistmodel.cpp +++ b/qt-models/gpslistmodel.cpp @@ -67,4 +67,3 @@ GpsListModel *GpsListModel::instance() static GpsListModel self; return &self; } - |