aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2015-01-08 10:55:38 -0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-01-08 07:43:01 -0800
commit797bf49129769842b5ca872e5efe40b4a575d1d5 (patch)
tree2d67dcfaaf8be7fc1b21d5f7da6c1cb0b3253654 /qt-ui
parent55cc16d77df3c43504ab932329c8fc15412d11e4 (diff)
downloadsubsurface-797bf49129769842b5ca872e5efe40b4a575d1d5.tar.gz
Dive d/l selection UI: Add the setData method
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/downloadfromdivecomputer.cpp15
-rw-r--r--qt-ui/downloadfromdivecomputer.h1
2 files changed, 16 insertions, 0 deletions
diff --git a/qt-ui/downloadfromdivecomputer.cpp b/qt-ui/downloadfromdivecomputer.cpp
index 91e38ae36..a7363c4ed 100644
--- a/qt-ui/downloadfromdivecomputer.cpp
+++ b/qt-ui/downloadfromdivecomputer.cpp
@@ -539,6 +539,21 @@ QVariant DiveImportedModel::data(const QModelIndex& index, int role) const
return QVariant();
}
+bool DiveImportedModel::setData(const QModelIndex &index, const QVariant &value, int role)
+{
+ if (!index.isValid())
+ return false;
+
+ if (index.row() + firstIndex > lastIndex)
+ return false;
+
+ if (role != Qt::CheckStateRole)
+ return false;
+
+ checkStates[index.row() + firstIndex ] = value.toBool();
+ dataChanged(index, index, QVector<int>() << Qt::CheckStateRole);
+}
+
void DiveImportedModel::setImportedDivesIndexes(int first, int last)
{
beginRemoveRows(QModelIndex(), 0, lastIndex - firstIndex);
diff --git a/qt-ui/downloadfromdivecomputer.h b/qt-ui/downloadfromdivecomputer.h
index c49ad9a40..028f7dda2 100644
--- a/qt-ui/downloadfromdivecomputer.h
+++ b/qt-ui/downloadfromdivecomputer.h
@@ -33,6 +33,7 @@ public:
int columnCount(const QModelIndex& index = QModelIndex()) const;
int rowCount(const QModelIndex& index = QModelIndex()) const;
QVariant data(const QModelIndex& index, int role) const;
+ bool setData(const QModelIndex &index, const QVariant &value, int role);
void setImportedDivesIndexes(int first, int last);
private:
int firstIndex;