adding a proxyModel

This commit is contained in:
Chris Cochrun 2023-02-17 09:38:20 -06:00
parent 1c1140915e
commit 13c8704bdc
4 changed files with 25 additions and 2 deletions

View file

@ -709,3 +709,14 @@ void SongSqlModel::updateFontSize(const int &row, const int &fontSize) {
submitAll();
emit fontSizeChanged();
}
// SongProxyModel
SongProxyModel::SongProxyModel(QObject *parent)
:QSortFilterProxyModel(parent)
{
SongSqlModel songModel = new SongSqlModel;
setSourceModel(songModel);
setDynamicSortFilter(true);
setFilterRole(Qt::UserRole + 1);
setFilterCaseSensitivity(Qt::CaseInsensitive);
}

View file

@ -2,6 +2,7 @@
#define SONGSQLMODEL_H
#include <QSqlTableModel>
#include <QSortFilterProxyModel>
#include <qobjectdefs.h>
#include <qqml.h>
#include <qvariant.h>
@ -107,4 +108,15 @@ private:
int m_fontSize;
};
class SongProxyModel : public QSortFilterProxyModel
{
Q_OBJECT
public:
explicit SongProxyModel(QObject *parent = nullptr);
};
#endif //SONGSQLMODEL_H