diff options
author | Tomaz Canabrava <tcanabrava@kde.org> | 2013-05-22 11:00:20 -0300 |
---|---|---|
committer | Tomaz Canabrava <tcanabrava@kde.org> | 2013-05-22 11:00:20 -0300 |
commit | 0b30c821ae5b8cb9f5e3e8d49152d56f215aeec4 (patch) | |
tree | 5d4a6c9ca607465f4a67dd31f3b94129cc81ee80 /qt-ui/models.h | |
parent | 94ba79c0fedc92113df22da27a4ff2cf01b26f94 (diff) | |
download | subsurface-0b30c821ae5b8cb9f5e3e8d49152d56f215aeec4.tar.gz |
Added a 'trash' icon on the Cylinders and Weigthsystem models
So, the Cylinders and Weigthsystems got a new Trash icon,
and the interface already intercepts the clicks ( on all
columns ) and send this to the 'remove' method on boch
models. On the model I'm just filtering the indexes that
are not 'DELETE' and creating a stub method to be filled
later.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Diffstat (limited to 'qt-ui/models.h')
-rw-r--r-- | qt-ui/models.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/qt-ui/models.h b/qt-ui/models.h index 62ae3913c..98f955bf6 100644 --- a/qt-ui/models.h +++ b/qt-ui/models.h @@ -38,18 +38,21 @@ private: class CylindersModel : public QAbstractTableModel { Q_OBJECT public: - enum Column {TYPE, SIZE, MAXPRESS, START, END, O2, HE}; + enum Column {REMOVE, TYPE, SIZE, MAXPRESS, START, END, O2, HE, COLUMNS}; explicit CylindersModel(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; /*reimp*/ int rowCount(const QModelIndex& parent = QModelIndex()) const; + /*reimp*/ Qt::ItemFlags flags(const QModelIndex& index) const; void add(cylinder_t *cyl); void clear(); void update(); void setDive(struct dive *d); +public slots: + void remove(const QModelIndex& index); private: struct dive *current; @@ -61,16 +64,19 @@ private: class WeightModel : public QAbstractTableModel { Q_OBJECT public: - enum Column {TYPE, WEIGHT}; + enum Column {REMOVE, TYPE, WEIGHT, COLUMNS}; /*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*/ Qt::ItemFlags flags(const QModelIndex& index) const; void add(weightsystem_t *weight); void clear(); void update(); void setDive(struct dive *d); +public slots: + void remove(const QModelIndex& index); private: struct dive *current; |