diff options
author | Tomaz Canabrava <tcanabrava@kde.org> | 2013-05-23 15:33:20 -0300 |
---|---|---|
committer | Tomaz Canabrava <tcanabrava@kde.org> | 2013-05-23 15:33:20 -0300 |
commit | babbfa9204b45d459227bdde0ff63469244b1c39 (patch) | |
tree | 888bcba51a30c37b608d9c55823fec0571876c82 /qt-ui/models.h | |
parent | c917a99eb2973701a79ba8bdb6002bb6ec0ad880 (diff) | |
download | subsurface-babbfa9204b45d459227bdde0ff63469244b1c39.tar.gz |
Added support for Completing on the Cylinder Type delegate
I had to immprove the TankInfoModel with two new methods,
insertRows and setData, because the delegate used this
model to show what kind of Tanks we are offering.
Since the user can enter a new type of Tank, it's important
to add this tank to all lists using the delegates.
I Also added two new methods on the delegate itself,
to correctly shows the data, and set the data on the
model. This also will help dirk with a working example
on how to edit things while using a delegate.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Diffstat (limited to 'qt-ui/models.h')
-rw-r--r-- | qt-ui/models.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/qt-ui/models.h b/qt-ui/models.h index 5fa97eb56..038f400a7 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,6 +19,8 @@ class TankInfoModel : public QAbstractTableModel { Q_OBJECT public: + static TankInfoModel* instance(); + enum Column { DESCRIPTION, ML, BAR}; TankInfoModel(); @@ -25,8 +28,8 @@ public: /*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; - - void add(const QString& description); + /*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: |