diff options
-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; }; |