From f8af0239ce4d5549305f72b3668d94834f0074ca Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Thu, 8 Jan 2015 11:00:42 -0200 Subject: Dive d/l selection UI: Set the item flags Now the user can click on the dives that they want to keep. Signed-off-by: Tomaz Canabrava Signed-off-by: Dirk Hohndel --- qt-ui/downloadfromdivecomputer.cpp | 6 ++++++ qt-ui/downloadfromdivecomputer.h | 1 + 2 files changed, 7 insertions(+) diff --git a/qt-ui/downloadfromdivecomputer.cpp b/qt-ui/downloadfromdivecomputer.cpp index a7363c4ed..ff42d41be 100644 --- a/qt-ui/downloadfromdivecomputer.cpp +++ b/qt-ui/downloadfromdivecomputer.cpp @@ -554,6 +554,12 @@ bool DiveImportedModel::setData(const QModelIndex &index, const QVariant &value, dataChanged(index, index, QVector() << Qt::CheckStateRole); } +Qt::ItemFlags DiveImportedModel::flags(const QModelIndex &index) const { + if (index.column() != 0) + return QAbstractTableModel::flags(index); + return QAbstractTableModel::flags(index) | Qt::ItemIsUserCheckable; +} + 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 028f7dda2..8ab7e3651 100644 --- a/qt-ui/downloadfromdivecomputer.h +++ b/qt-ui/downloadfromdivecomputer.h @@ -35,6 +35,7 @@ public: QVariant data(const QModelIndex& index, int role) const; bool setData(const QModelIndex &index, const QVariant &value, int role); void setImportedDivesIndexes(int first, int last); + Qt::ItemFlags flags(const QModelIndex &index) const; private: int firstIndex; int lastIndex; -- cgit v1.2.3-70-g09d2