Commit be6dbb62 authored by Martin Tobias Holmedahl Sandsmark's avatar Martin Tobias Holmedahl Sandsmark
Browse files

Improve responsiveness when showing single image without thumbnail bar

Editing an image in a huge folder before this patch is pretty
frustrating because there's a ton of (unnecessary) stuff happening in
the background.

In this case it is the thumbnail delegates that constantly fetch and
convert qmodelindexes to positions to check if they need to update their
hover ui, even if the hover ui things are off. Further improvements
would be to actually check if the hover stuff is used, but with this
patch things seem pretty smooth at least.

Differential Revision:
parent ce981b54
......@@ -358,8 +358,13 @@ void ThumbnailView::setModel(QAbstractItemModel* newModel)
disconnect(model(), nullptr, this, nullptr);
connect(model(), &QAbstractItemModel::rowsRemoved,
this, &ThumbnailView::rowsRemovedSignal);
connect(model(), &QAbstractItemModel::rowsRemoved, this, [=](const QModelIndex &index, int first, int last) {
// Avoid the delegate doing a ton of work if we're not visible
if (isVisible()) {
emit rowsRemovedSignal(index, first, last);
void ThumbnailView::setThumbnailProvider(ThumbnailProvider* thumbnailProvider)
......@@ -512,7 +517,10 @@ void ThumbnailView::rowsInserted(const QModelIndex& parent, int start, int end)
QListView::rowsInserted(parent, start, end);
emit rowsInsertedSignal(parent, start, end);
if (isVisible()) {
emit rowsInsertedSignal(parent, start, end);
void ThumbnailView::dataChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight, const QVector<int> &roles)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment