diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2015-01-08 11:39:34 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-01-08 11:39:34 -0800 |
commit | e6b5a00e3516b1c6e9f5fa638b984f3cf47659ba (patch) | |
tree | 3f26b9bebcee5cb8b663d7093cecb7997033a427 /qt-ui | |
parent | d16bff13bb076e344342f9dbd0f1974e0164c7cf (diff) | |
download | subsurface-e6b5a00e3516b1c6e9f5fa638b984f3cf47659ba.tar.gz |
Dive d/l selection UI: allow clicking anywhere in a row
It seemed silly to only be allowed to click the tiny checkbox.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r-- | qt-ui/downloadfromdivecomputer.cpp | 7 | ||||
-rw-r--r-- | qt-ui/downloadfromdivecomputer.h | 5 |
2 files changed, 12 insertions, 0 deletions
diff --git a/qt-ui/downloadfromdivecomputer.cpp b/qt-ui/downloadfromdivecomputer.cpp index 671225b86..ffda54769 100644 --- a/qt-ui/downloadfromdivecomputer.cpp +++ b/qt-ui/downloadfromdivecomputer.cpp @@ -61,6 +61,7 @@ DownloadFromDCWidget::DownloadFromDCWidget(QWidget *parent, Qt::WindowFlags f) : ui.downloadedView->setColumnWidth(0, startingWidth * 20); ui.downloadedView->setColumnWidth(1, startingWidth * 15); ui.downloadedView->setColumnWidth(2, startingWidth * 10); + connect(ui.downloadedView, SIGNAL(clicked(QModelIndex)), diveImportedModel, SLOT(changeSelected(QModelIndex))); QRect mainGeometry = parent->geometry(); int width = mainGeometry.width() * 0.8; int height = mainGeometry.height() * 0.8; @@ -591,6 +592,12 @@ bool DiveImportedModel::setData(const QModelIndex &index, const QVariant &value, return true; } +void DiveImportedModel::changeSelected(QModelIndex index) +{ + checkStates[index.row()] = !checkStates[index.row()]; + dataChanged(index, index, QVector<int>() << Qt::CheckStateRole); +} + Qt::ItemFlags DiveImportedModel::flags(const QModelIndex &index) const { if (index.column() != 0) diff --git a/qt-ui/downloadfromdivecomputer.h b/qt-ui/downloadfromdivecomputer.h index 80b184304..81a32f206 100644 --- a/qt-ui/downloadfromdivecomputer.h +++ b/qt-ui/downloadfromdivecomputer.h @@ -38,6 +38,11 @@ public: void setImportedDivesIndexes(int first, int last); Qt::ItemFlags flags(const QModelIndex &index) const; void removeUnused(); + +public +slots: + void changeSelected(QModelIndex index); + private: int firstIndex; int lastIndex; |