diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2018-10-09 09:18:08 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2018-10-09 21:00:44 -0700 |
commit | 19d651a36b8f5c955ef3e147bbb3efa93028f959 (patch) | |
tree | 394a6606f6a2ea1c5019d9117f768305e7be02a4 /qt-models | |
parent | 50e42bffa16728f1b663e37a76db6293cc00b122 (diff) | |
download | subsurface-19d651a36b8f5c955ef3e147bbb3efa93028f959.tar.gz |
Dive sites: remove internalRowCount from LocationInformationModel
This was redundant. Directly use dive_site_table.nr instead.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'qt-models')
-rw-r--r-- | qt-models/divelocationmodel.cpp | 9 | ||||
-rw-r--r-- | qt-models/divelocationmodel.h | 1 |
2 files changed, 3 insertions, 7 deletions
diff --git a/qt-models/divelocationmodel.cpp b/qt-models/divelocationmodel.cpp index ffe5e501f..ba9dede0d 100644 --- a/qt-models/divelocationmodel.cpp +++ b/qt-models/divelocationmodel.cpp @@ -18,8 +18,7 @@ LocationInformationModel *LocationInformationModel::instance() return self; } -LocationInformationModel::LocationInformationModel(QObject *obj) : QAbstractTableModel(obj), - internalRowCount(0) +LocationInformationModel::LocationInformationModel(QObject *obj) : QAbstractTableModel(obj) { } @@ -30,7 +29,7 @@ int LocationInformationModel::columnCount(const QModelIndex&) const int LocationInformationModel::rowCount(const QModelIndex&) const { - return internalRowCount; + return dive_site_table.nr; } QVariant LocationInformationModel::data(const QModelIndex &index, int role) const @@ -74,10 +73,9 @@ QVariant LocationInformationModel::data(const QModelIndex &index, int role) cons void LocationInformationModel::update() { beginResetModel(); - internalRowCount = dive_site_table.nr; qSort(dive_site_table.dive_sites, dive_site_table.dive_sites + dive_site_table.nr, dive_site_less_than); locationNames.clear(); - for (int i = 0; i < internalRowCount; i++) + for (int i = 0; i < dive_site_table.nr; i++) locationNames << QString(dive_site_table.dive_sites[i]->name); endResetModel(); } @@ -96,7 +94,6 @@ bool LocationInformationModel::removeRows(int row, int, const QModelIndex&) struct dive_site *ds = get_dive_site(row); if (ds) delete_dive_site(ds->uuid); - internalRowCount = dive_site_table.nr; endRemoveRows(); return true; } diff --git a/qt-models/divelocationmodel.h b/qt-models/divelocationmodel.h index debbdf871..47164d2d4 100644 --- a/qt-models/divelocationmodel.h +++ b/qt-models/divelocationmodel.h @@ -30,7 +30,6 @@ public slots: void update(); QStringList allSiteNames() const; private: - int internalRowCount; QStringList locationNames; }; |