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 <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2015-01-08 11:00:42 -02:00 committed by Dirk Hohndel
parent 797bf49129
commit f8af0239ce
2 changed files with 7 additions and 0 deletions

View file

@ -554,6 +554,12 @@ bool DiveImportedModel::setData(const QModelIndex &index, const QVariant &value,
dataChanged(index, index, QVector<int>() << 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);

View file

@ -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;