mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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:
parent
5eb572b9c6
commit
8115855428
2 changed files with 43 additions and 0 deletions
|
@ -7,6 +7,37 @@
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QShowEvent>
|
#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)
|
LocationInformationWidget::LocationInformationWidget(QWidget *parent) : QGroupBox(parent), modified(false)
|
||||||
{
|
{
|
||||||
ui.setupUi(this);
|
ui.setupUi(this);
|
||||||
|
|
|
@ -3,6 +3,18 @@
|
||||||
|
|
||||||
#include "ui_locationInformation.h"
|
#include "ui_locationInformation.h"
|
||||||
#include <stdint.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 {
|
class LocationInformationWidget : public QGroupBox {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
Loading…
Add table
Reference in a new issue