diff options
Diffstat (limited to 'qt-models')
-rw-r--r-- | qt-models/CMakeLists.txt | 2 | ||||
-rw-r--r-- | qt-models/divelocationmodel.cpp | 8 | ||||
-rw-r--r-- | qt-models/divelocationmodel.h | 4 |
3 files changed, 12 insertions, 2 deletions
diff --git a/qt-models/CMakeLists.txt b/qt-models/CMakeLists.txt index f24f6d2a5..d286fd3eb 100644 --- a/qt-models/CMakeLists.txt +++ b/qt-models/CMakeLists.txt @@ -6,6 +6,7 @@ set(SUBSURFACE_GENERIC_MODELS_LIB_SRCS diveplotdatamodel.cpp diveimportedmodel.cpp completionmodels.cpp + divelocationmodel.cpp ) # models exclusively used in desktop builds @@ -25,7 +26,6 @@ set(SUBSURFACE_DESKTOP_MODELS_LIB_SRCS divetripmodel.cpp diveplannermodel.cpp divecomputerextradatamodel.cpp - divelocationmodel.cpp ssrfsortfilterproxymodel.cpp ) diff --git a/qt-models/divelocationmodel.cpp b/qt-models/divelocationmodel.cpp index d6fb09573..ad58f9c2f 100644 --- a/qt-models/divelocationmodel.cpp +++ b/qt-models/divelocationmodel.cpp @@ -128,9 +128,17 @@ 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++) + locationNames << QString(dive_site_table.dive_sites[i]->name); endResetModel(); } +QStringList LocationInformationModel::allSiteNames() const +{ + return(locationNames); +} + bool LocationInformationModel::setData(const QModelIndex &index, const QVariant &value, int role) { if (!index.isValid() || index.row() < 2) diff --git a/qt-models/divelocationmodel.h b/qt-models/divelocationmodel.h index 0829abd30..404b66f48 100644 --- a/qt-models/divelocationmodel.h +++ b/qt-models/divelocationmodel.h @@ -17,6 +17,7 @@ bool filter_same_gps_cb (QAbstractItemModel *m, int sourceRow, const QModelIndex class LocationInformationModel : public QAbstractTableModel { Q_OBJECT public: + LocationInformationModel(QObject *obj = 0); enum Columns { UUID, NAME, LATITUDE, LONGITUDE, COORDS, DESCRIPTION, NOTES, TAXONOMY_1, TAXONOMY_2, TAXONOMY_3, COLUMNS}; enum Roles { UUID_ROLE = Qt::UserRole + 1 }; static LocationInformationModel *instance(); @@ -29,9 +30,10 @@ public: public slots: void update(); + QStringList allSiteNames() const; private: - LocationInformationModel(QObject *obj = 0); int internalRowCount; + QStringList locationNames; QLineEdit *textField; }; |