mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
divepicturemodel: Reset start and end row for displayed_dive correctly
Correct way of using indices for rowDDstart and rowDDend. Reset rowDDstart and rowDDend at beginning of updating dive pictures. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
This commit is contained in:
parent
ef543da5af
commit
2890be9256
2 changed files with 3 additions and 2 deletions
|
@ -2000,7 +2000,7 @@ void ProfileWidget2::plotPictures()
|
||||||
|
|
||||||
double x, y, lastX = -1.0, lastY = -1.0;
|
double x, y, lastX = -1.0, lastY = -1.0;
|
||||||
DivePictureModel *m = DivePictureModel::instance();
|
DivePictureModel *m = DivePictureModel::instance();
|
||||||
for (int i = m->rowDDStart; i <= m->rowDDEnd; i++) {
|
for (int i = m->rowDDStart; i < m->rowDDEnd; i++) {
|
||||||
int offsetSeconds = m->index(i, 1).data(Qt::UserRole).value<int>();
|
int offsetSeconds = m->index(i, 1).data(Qt::UserRole).value<int>();
|
||||||
// it's a correct picture, but doesn't have a timestamp: only show on the widget near the
|
// it's a correct picture, but doesn't have a timestamp: only show on the widget near the
|
||||||
// information area.
|
// information area.
|
||||||
|
|
|
@ -54,6 +54,7 @@ void DivePictureModel::updateDivePictures()
|
||||||
beginRemoveRows(QModelIndex(), 0, pictures.count() - 1);
|
beginRemoveRows(QModelIndex(), 0, pictures.count() - 1);
|
||||||
pictures.clear();
|
pictures.clear();
|
||||||
endRemoveRows();
|
endRemoveRows();
|
||||||
|
rowDDStart = rowDDEnd = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if the dive_table is empty, quit
|
// if the dive_table is empty, quit
|
||||||
|
@ -69,7 +70,7 @@ void DivePictureModel::updateDivePictures()
|
||||||
FOR_EACH_PICTURE(dive)
|
FOR_EACH_PICTURE(dive)
|
||||||
pictures.push_back({picture, picture->filename, QImage(), picture->offset.seconds});
|
pictures.push_back({picture, picture->filename, QImage(), picture->offset.seconds});
|
||||||
if (dive->id == displayed_dive.id)
|
if (dive->id == displayed_dive.id)
|
||||||
rowDDEnd = pictures.count() - 1;
|
rowDDEnd = pictures.count();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QtConcurrent::blockingMap(pictures, scaleImages);
|
QtConcurrent::blockingMap(pictures, scaleImages);
|
||||||
|
|
Loading…
Add table
Reference in a new issue