Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/placesview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ PlacesProxyModel::~PlacesProxyModel() {
void PlacesProxyModel::restoreHiddenItems(const QSet<QString>& items) {
// hidden items should be restored only once
if(!hiddenItemsRestored_ && !items.isEmpty()) {
beginFilterChange();
hidden_.clear();
QSet<QString>::const_iterator i = items.constBegin();
while (i != items.constEnd()) {
Expand All @@ -59,11 +60,12 @@ void PlacesProxyModel::restoreHiddenItems(const QSet<QString>& items) {
++i;
}
hiddenItemsRestored_ = true;
invalidateFilter();
endFilterChange();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes should be done between beginFilterChange() and endFilterChange(), like this:

    if(!hiddenItemsRestored_ && !items.isEmpty()) {
        beginFilterChange();
        hidden_.clear();
        ....
        endFilterChange();

And also in the other cases.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done hopefully right.

}
}

void PlacesProxyModel::setHidden(const QString& str, bool hide) {
beginFilterChange();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

beginFilterChange(); should be before if(hide) {.

@stefonarch stefonarch Apr 29, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't do this work when tired as now...

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we rise Qt version in this PR too?

if(hide) {
if(!str.isEmpty()) {
hidden_ << str;
Expand All @@ -72,12 +74,13 @@ void PlacesProxyModel::setHidden(const QString& str, bool hide) {
else {
hidden_.remove(str);
}
invalidateFilter();
endFilterChange();
}

void PlacesProxyModel::showAll(bool show) {
beginFilterChange();
showAll_ = show;
invalidateFilter();
endFilterChange();
}

bool PlacesProxyModel::filterAcceptsRow(int source_row, const QModelIndex& source_parent) const {
Expand Down
12 changes: 8 additions & 4 deletions src/proxyfoldermodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,18 @@ void ProxyFolderModel::sort(int column, Qt::SortOrder order) {

void ProxyFolderModel::setShowHidden(bool show) {
if(show != showHidden_) {
beginFilterChange();
showHidden_ = show;
invalidateFilter();
endFilterChange();
Q_EMIT sortFilterChanged();
}
}

void ProxyFolderModel::setBackupAsHidden(bool backupAsHidden) {
if(backupAsHidden != backupAsHidden_) {
beginFilterChange();
backupAsHidden_ = backupAsHidden;
invalidateFilter();
endFilterChange();
Q_EMIT sortFilterChanged();
}
}
Expand Down Expand Up @@ -341,14 +343,16 @@ void ProxyFolderModel::onThumbnailLoaded(const QModelIndex& srcIndex, int size)
}

void ProxyFolderModel::addFilter(ProxyFolderModelFilter* filter) {
beginFilterChange();
filters_.append(filter);
invalidateFilter();
endFilterChange();
Q_EMIT sortFilterChanged();
}

void ProxyFolderModel::removeFilter(ProxyFolderModelFilter* filter) {
beginFilterChange();
filters_.removeOne(filter);
invalidateFilter();
endFilterChange();
Q_EMIT sortFilterChanged();
}

Expand Down