summaryrefslogtreecommitdiffstats
path: root/qt-ui/models.h
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-11-18 22:33:01 -0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-11-18 16:53:16 -0800
commit61ac0a7c8d45c0d96e75d5e55ad48c6def5f4257 (patch)
tree252ae3f888829816e2a6be0cf042ec36ccdc7761 /qt-ui/models.h
parent4433830f550f41f0c558786dfe219fcb0fcbd45f (diff)
downloadsubsurface-61ac0a7c8d45c0d96e75d5e55ad48c6def5f4257.tar.gz
Make it posible to renumber dives.
If the user doubleclicks on the number of the dive in the dive list, this will present to him a dialog to change that number. Pressing enter will renumber the dive if there's no dive with the same number already. Fixes #288 Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/models.h')
-rw-r--r--qt-ui/models.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/qt-ui/models.h b/qt-ui/models.h
index de9aab5ce..d7b2eedd2 100644
--- a/qt-ui/models.h
+++ b/qt-ui/models.h
@@ -144,6 +144,9 @@ public:
virtual ~TreeItem();
TreeItem();
virtual QVariant data (int column, int role) const;
+ virtual bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole);
+ virtual Qt::ItemFlags flags(const QModelIndex &index) const;
+
int row() const;
QList<TreeItem*> children;
TreeItem *parent;
@@ -155,7 +158,8 @@ struct DiveItem : public TreeItem {
virtual QVariant data(int column, int role) const;
struct dive* dive;
-
+ virtual bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole);
+ virtual Qt::ItemFlags flags(const QModelIndex& index) const;
QString displayDate() const;
QString displayDuration() const;
QString displayDepth() const;
@@ -174,7 +178,6 @@ class TreeModel : public QAbstractItemModel
public:
TreeModel(QObject *parent = 0);
virtual ~TreeModel();
-
virtual QVariant data(const QModelIndex &index, int role) const;
/*reimp*/ int rowCount(const QModelIndex &parent = QModelIndex()) const;
/*reimp*/ int columnCount(const QModelIndex &parent = QModelIndex()) const;
@@ -197,6 +200,7 @@ public:
Qt::ItemFlags flags(const QModelIndex &index) const;
virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
+ virtual bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole);
DiveTripModel(QObject* parent = 0);
Layout layout() const;
void setLayout(Layout layout);