Start the model for location information.

And implement the reset method.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2015-05-17 16:33:23 -03:00 committed by Dirk Hohndel
parent 5eb572b9c6
commit 8115855428
2 changed files with 43 additions and 0 deletions

View file

@ -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);

View file

@ -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