Skip to content

Commit

Permalink
fix playlists view search; release 1.0.24
Browse files Browse the repository at this point in the history
  • Loading branch information
olegantonyan committed May 21, 2024
1 parent 7bd251f commit 7985c57
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 10 deletions.
6 changes: 3 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
## [1.0.24] -
### Added
## [1.0.24] - 2024-05-21

### Fixed
- start position of track with CUE
- start position of track with CUE
- filter playlists with long list view

### Misc
- no more crash under Wayland (disabled QHotKey registration)
Expand Down
15 changes: 8 additions & 7 deletions app/playlists_ui/playlistscontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,12 +186,13 @@ namespace PlaylistsUi {
}

void Controller::on_search(const QString &term) {
proxy->setFilterWildcard("*" + term + "*");

QTimer::singleShot(20, [=]() {
if (!view->selectionModel()->selectedRows().isEmpty()) {
view->scrollTo(view->selectionModel()->selectedRows().first(), QAbstractItemView::PositionAtCenter);
}
});
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
QRegularExpression regex(term);
proxy->setFilterRegularExpression(regex);
#else
QRegExp regex(term, Qt::CaseInsensitive, QRegExp::Wildcard);
proxy->setFilterRegExp(regex);
#endif
proxy->setFilterCaseSensitivity(Qt::CaseInsensitive);
}
}
9 changes: 9 additions & 0 deletions app/playlists_ui/playlistsproxyfiltermodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@ namespace PlaylistsUi {

int ProxyFilterModel::rowCount(const QModelIndex &parent) const {
Q_UNUSED(parent)
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
if(!filterRegularExpression().pattern().isEmpty()) {
return QSortFilterProxyModel::rowCount(parent);
}
#else
if(!filterRegExp().isEmpty()) {
return QSortFilterProxyModel::rowCount(parent);
}
#endif
if (sourceModel()) {
return sourceModel()->rowCount();
}
Expand Down

0 comments on commit 7985c57

Please sign in to comment.