Mercurial > trustbridge
comparison ui/certificatetablemodel.cpp @ 1316:ff9cd05e861e
(issue166) Fix certificiate removal
The index that should be removed came from the filter proxy model
and did not map to the real index. This was broken.
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Mon, 13 Oct 2014 17:23:35 +0200 |
parents | 320a64d58e62 |
children |
comparison
equal
deleted
inserted
replaced
1315:12ed0b72e9f5 | 1316:ff9cd05e861e |
---|---|
32 | 32 |
33 bool CertificateTabelModel::removeRows(int row, int count, | 33 bool CertificateTabelModel::removeRows(int row, int count, |
34 const QModelIndex &index) | 34 const QModelIndex &index) |
35 { | 35 { |
36 beginRemoveRows(QModelIndex(), row, row + count - 1); | 36 beginRemoveRows(QModelIndex(), row, row + count - 1); |
37 if ((row + count - 1) > mCertificates.size()) { | 37 if (count < 0 || row < 0 || (row + count) > mCertificates.size()) { |
38 return false; | 38 return false; |
39 } | 39 } |
40 for (int i = row + count - 1; i >= row; i--) { | 40 for (int i = 0; i < count; ++i) { |
41 mCertificates.removeAt(i); | 41 mCertificates.removeAt(row); |
42 } | 42 } |
43 endRemoveRows(); | 43 endRemoveRows(); |
44 return true; | 44 return true; |
45 } | 45 } |
46 | 46 |