summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--profile-widget/profilewidget2.cpp1
-rw-r--r--qt-models/divepicturemodel.cpp9
2 files changed, 3 insertions, 7 deletions
diff --git a/profile-widget/profilewidget2.cpp b/profile-widget/profilewidget2.cpp
index de7cebc87..85653d1fc 100644
--- a/profile-widget/profilewidget2.cpp
+++ b/profile-widget/profilewidget2.cpp
@@ -1119,6 +1119,7 @@ void ProfileWidget2::setProfileState()
connect(DivePictureModel::instance(), &DivePictureModel::dataChanged, this, &ProfileWidget2::updatePictures);
connect(DivePictureModel::instance(), SIGNAL(rowsInserted(const QModelIndex &, int, int)), this, SLOT(plotPictures()));
connect(DivePictureModel::instance(), SIGNAL(rowsRemoved(const QModelIndex &, int, int)), this, SLOT(plotPictures()));
+ connect(DivePictureModel::instance(), &DivePictureModel::modelReset, this, &ProfileWidget2::plotPictures);
#endif
/* show the same stuff that the profile shows. */
diff --git a/qt-models/divepicturemodel.cpp b/qt-models/divepicturemodel.cpp
index 2fc7b8311..9b993cb5a 100644
--- a/qt-models/divepicturemodel.cpp
+++ b/qt-models/divepicturemodel.cpp
@@ -57,10 +57,9 @@ void DivePictureModel::updateThumbnails()
void DivePictureModel::updateDivePictures()
{
+ beginResetModel();
if (!pictures.isEmpty()) {
- beginRemoveRows(QModelIndex(), 0, pictures.count() - 1);
pictures.clear();
- endRemoveRows();
rowDDStart = rowDDEnd = 0;
Thumbnailer::instance()->clearWorkQueue();
}
@@ -83,11 +82,7 @@ void DivePictureModel::updateDivePictures()
}
updateThumbnails();
-
- if (!pictures.isEmpty()) {
- beginInsertRows(QModelIndex(), 0, pictures.count() - 1);
- endInsertRows();
- }
+ endResetModel();
}
int DivePictureModel::columnCount(const QModelIndex &parent) const