[PATCH] Fix (un)selecting of downloaded dives

Miika Turkia miika.turkia at gmail.com
Mon Jan 26 20:33:34 PST 2015


Last index was not included in the selecting or unselecting the
downloaded dives.

Fixes #819

Signed-off-by: Miika Turkia <miika.turkia at gmail.com>
---
 qt-ui/downloadfromdivecomputer.cpp | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/qt-ui/downloadfromdivecomputer.cpp b/qt-ui/downloadfromdivecomputer.cpp
index c667925..6fa83e1 100644
--- a/qt-ui/downloadfromdivecomputer.cpp
+++ b/qt-ui/downloadfromdivecomputer.cpp
@@ -599,14 +599,14 @@ void DiveImportedModel::changeSelected(QModelIndex clickedIndex)
 
 void DiveImportedModel::selectAll()
 {
-	memset(checkStates, true, lastIndex - firstIndex);
-	dataChanged(index(0, 0), index(0, lastIndex - firstIndex - 1), QVector<int>() << Qt::CheckStateRole);
+	memset(checkStates, true, lastIndex - firstIndex + 1);
+	dataChanged(index(0, 0), index(0, lastIndex - firstIndex), QVector<int>() << Qt::CheckStateRole);
 }
 
 void DiveImportedModel::selectNone()
 {
-	memset(checkStates, false, lastIndex - firstIndex);
-	dataChanged(index(0, 0), index(0, lastIndex - firstIndex - 1), QVector<int>() << Qt::CheckStateRole);
+	memset(checkStates, false, lastIndex - firstIndex + 1);
+	dataChanged(index(0, 0), index(0, lastIndex - firstIndex), QVector<int>() << Qt::CheckStateRole);
 }
 
 Qt::ItemFlags DiveImportedModel::flags(const QModelIndex &index) const
-- 
1.9.1



More information about the subsurface mailing list