summaryrefslogtreecommitdiffstats
path: root/qt-ui/models.h
diff options
context:
space:
mode:
Diffstat (limited to 'qt-ui/models.h')
-rw-r--r--qt-ui/models.h33
1 files changed, 31 insertions, 2 deletions
diff --git a/qt-ui/models.h b/qt-ui/models.h
index 5fa97eb56..ad909abe1 100644
--- a/qt-ui/models.h
+++ b/qt-ui/models.h
@@ -9,6 +9,7 @@
#include <QAbstractTableModel>
#include <QCoreApplication>
+#include <QStringList>
#include "../dive.h"
#include "../divelist.h"
@@ -18,19 +19,43 @@
class TankInfoModel : public QAbstractTableModel {
Q_OBJECT
public:
- enum Column { DESCRIPTION, ML, BAR};
+ static TankInfoModel* instance();
+
+ enum Column {DESCRIPTION, ML, BAR};
TankInfoModel();
/*reimp*/ QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
/*reimp*/ int columnCount(const QModelIndex& parent = QModelIndex()) const;
/*reimp*/ QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
/*reimp*/ int rowCount(const QModelIndex& parent = QModelIndex()) const;
+ /*reimp*/ bool insertRows(int row, int count, const QModelIndex& parent = QModelIndex());
+ /*reimp*/ bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole);
+ void clear();
+ void update();
+private:
+ int rows;
+};
+
+/* Encapsulate ws_info */
+class WSInfoModel : public QAbstractTableModel {
+Q_OBJECT
+public:
+ static WSInfoModel* instance();
+
+ enum Column {DESCRIPTION, GR};
+ WSInfoModel();
- void add(const QString& description);
+ /*reimp*/ QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
+ /*reimp*/ int columnCount(const QModelIndex& parent = QModelIndex()) const;
+ /*reimp*/ QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
+ /*reimp*/ int rowCount(const QModelIndex& parent = QModelIndex()) const;
+ /*reimp*/ bool insertRows(int row, int count, const QModelIndex& parent = QModelIndex());
+ /*reimp*/ bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole);
void clear();
void update();
private:
int rows;
+
};
/* Encapsulation of the Cylinder Model, that presents the
@@ -48,6 +73,7 @@ public:
/*reimp*/ Qt::ItemFlags flags(const QModelIndex& index) const;
/*reimp*/ bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole);
+ void passInData(const QModelIndex& index, const QVariant& value);
void add();
void clear();
void update();
@@ -66,6 +92,8 @@ class WeightModel : public QAbstractTableModel {
Q_OBJECT
public:
enum Column {REMOVE, TYPE, WEIGHT, COLUMNS};
+
+ explicit WeightModel(QObject *parent = 0);
/*reimp*/ QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
/*reimp*/ int columnCount(const QModelIndex& parent = QModelIndex()) const;
/*reimp*/ QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
@@ -73,6 +101,7 @@ public:
/*reimp*/ Qt::ItemFlags flags(const QModelIndex& index) const;
/*reimp*/ bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole);
+ void passInData(const QModelIndex& index, const QVariant& value);
void add();
void clear();
void update();