summaryrefslogtreecommitdiffstats
path: root/qt-ui/models.h
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-05-23 18:40:16 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-05-23 21:36:33 -0700
commit01a3bd2cc6dcc035607cce61285ed9cc8d807b9b (patch)
treeb263322c484290a41af33fa74521f03349cf9cca /qt-ui/models.h
parentecbcd4db4721c9e4a6b4253a5f45f43fa9e80fc7 (diff)
downloadsubsurface-01a3bd2cc6dcc035607cce61285ed9cc8d807b9b.tar.gz
Add weightsystem delegate to enable editing of weightsystem
This is very much analogous to the way cylinders are implemented. That means that just like with cylinders, if the user enters a new type and hits 'tab' before hitting 'enter', Subsurface will crash. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/models.h')
-rw-r--r--qt-ui/models.h27
1 files changed, 26 insertions, 1 deletions
diff --git a/qt-ui/models.h b/qt-ui/models.h
index 556651ffe..ad909abe1 100644
--- a/qt-ui/models.h
+++ b/qt-ui/models.h
@@ -21,7 +21,7 @@ Q_OBJECT
public:
static TankInfoModel* instance();
- enum Column { DESCRIPTION, ML, BAR};
+ enum Column {DESCRIPTION, ML, BAR};
TankInfoModel();
/*reimp*/ QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
@@ -36,6 +36,28 @@ private:
int rows;
};
+/* Encapsulate ws_info */
+class WSInfoModel : public QAbstractTableModel {
+Q_OBJECT
+public:
+ static WSInfoModel* instance();
+
+ enum Column {DESCRIPTION, GR};
+ WSInfoModel();
+
+ /*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
* Current cylinders that are used on a dive. */
class CylindersModel : public QAbstractTableModel {
@@ -70,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;
@@ -77,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();