diff options
-rw-r--r-- | qt-ui/locationinformation.cpp | 31 | ||||
-rw-r--r-- | qt-ui/locationinformation.h | 12 |
2 files changed, 43 insertions, 0 deletions
diff --git a/qt-ui/locationinformation.cpp b/qt-ui/locationinformation.cpp index 5c11f96f2..38c1492f7 100644 --- a/qt-ui/locationinformation.cpp +++ b/qt-ui/locationinformation.cpp @@ -7,6 +7,37 @@ #include <QDebug> #include <QShowEvent> +LocationInformationModel::LocationInformationModel(QObject *obj) +{ +} + +int LocationInformationModel::rowCount(const QModelIndex &parent) const +{ + +} + +QVariant LocationInformationModel::data(const QModelIndex &index, int role) const +{ + +} + +void LocationInformationModel::update() +{ + int i; + struct dive_site *ds; + for_each_dive_site (i, ds); + + if (rowCount()) { + beginRemoveRows(QModelIndex(), 0, rowCount()); + endRemoveRows(); + } + if (i) { + beginInsertRows(QModelIndex(), 0, i); + internalRowCount = i; + endRemoveRows(); + } +} + LocationInformationWidget::LocationInformationWidget(QWidget *parent) : QGroupBox(parent), modified(false) { ui.setupUi(this); diff --git a/qt-ui/locationinformation.h b/qt-ui/locationinformation.h index 99974af49..1050a87d5 100644 --- a/qt-ui/locationinformation.h +++ b/qt-ui/locationinformation.h @@ -3,6 +3,18 @@ #include "ui_locationInformation.h" #include <stdint.h> +#include <QAbstractListModel> + +class LocationInformationModel : public QAbstractListModel { +Q_OBJECT +public: + LocationInformationModel(QObject *obj = 0); + int rowCount(const QModelIndex &parent = QModelIndex()) const; + QVariant data(const QModelIndex &index = QModelIndex(), int role = Qt::DisplayRole) const; + void update(); +private: + int internalRowCount; +}; class LocationInformationWidget : public QGroupBox { Q_OBJECT |