From a169ca87cbe7b3ebe6f9ef24335f65ca64791116 Mon Sep 17 00:00:00 2001 From: Arno Date: Sat, 25 Feb 2017 18:45:49 +0100 Subject: Implement filtering Well, as it turns out, QSortFilterProxyModel isn't the weapon of choice for this. Implement it by creating a separate model which is populated by SQL-Queries. --- playerwidget.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'playerwidget.h') diff --git a/playerwidget.h b/playerwidget.h index c9206cd..5a6ff95 100644 --- a/playerwidget.h +++ b/playerwidget.h @@ -5,7 +5,7 @@ class QTreeView; class QStandardItemModel; -class QSortFilterProxyModel; +class QStandardItem; class QLineEdit; class QLabel; class QSlider; @@ -16,7 +16,7 @@ class BeetPlayerProxy; class PlayerWidget : public QWidget { Q_OBJECT public: - enum ItemType { Artist, Album, Song }; + enum ItemType { Artist, Album, Song, Genre }; enum CustomRoles { TypeRole = Qt::UserRole + 1, IdRole = Qt::UserRole + 2, FullPathRole = Qt::UserRole + 3, GenreRole = Qt::UserRole + 4 }; explicit PlayerWidget(QWidget *parent = 0); @@ -27,11 +27,14 @@ class PlayerWidget : public QWidget { private: void setupGui(); + void populateByArtist(QStandardItem *parent, const QString &filter); + void populateBySong(QStandardItem *parent, const QString &filter); + void populateByGenre(QStandardItem *parent, const QString &filter); QLineEdit *mFilter; QMediaPlayer *mPlayer; QTreeView *mView; QStandardItemModel *mViewModel; - BeetPlayerProxy *mViewProxy; + QStandardItemModel *mSearchModel; QLabel *mNowPlayingL; QSlider *mSlider; QTextEdit *mCurrentTE; -- cgit v1.2.3-70-g09d2