QML UI: select / unselect dive by clicking on it

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2017-05-29 20:36:00 +02:00 committed by Dirk Hohndel
parent 1de1a85e32
commit 52e07a6306
3 changed files with 27 additions and 2 deletions

View file

@ -101,6 +101,12 @@ void DiveImportedModel::selectAll()
dataChanged(index(0, 0), index(lastIndex - firstIndex, 0), QVector<int>() << Qt::CheckStateRole);
}
void DiveImportedModel::selectRow(int row)
{
checkStates[row] = !checkStates[row];
dataChanged(index(row, 0), index(row, 0));
}
void DiveImportedModel::selectNone()
{
memset(checkStates, false, lastIndex - firstIndex + 1);
@ -169,6 +175,7 @@ QHash<int, QByteArray> DiveImportedModel::roleNames() const {
static QHash<int, QByteArray> roles = {
{ DateTime, "datetime"},
{ Depth, "depth"},
{ Duration, "duration"}};
{ Duration, "duration"},
};
return roles;
}