mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-03 03:53:56 -07:00
shortcut search now displays all rows in section (#5307)
This commit is contained in:
parent
205e1c7a59
commit
ec17a477be
2 changed files with 32 additions and 4 deletions
|
|
@ -2,10 +2,23 @@
|
|||
#define SHORTCUT_TREEVIEW_H
|
||||
|
||||
#include <QModelIndex>
|
||||
#include <QSortFilterProxyModel>
|
||||
#include <QStandardItemModel>
|
||||
#include <QTreeView>
|
||||
|
||||
class QSortFilterProxyModel;
|
||||
/**
|
||||
* Custom implementation of QSortFilterProxyModel that also searches in the parent's string when filtering
|
||||
*/
|
||||
class ShortcutFilterProxyModel : public QSortFilterProxyModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ShortcutFilterProxyModel(QObject *parent = nullptr);
|
||||
|
||||
protected:
|
||||
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override;
|
||||
};
|
||||
|
||||
class ShortcutTreeView : public QTreeView
|
||||
{
|
||||
Q_OBJECT
|
||||
|
|
@ -21,7 +34,7 @@ public slots:
|
|||
|
||||
private:
|
||||
QStandardItemModel *shortcutsModel;
|
||||
QSortFilterProxyModel *proxyModel;
|
||||
ShortcutFilterProxyModel *proxyModel;
|
||||
void populateShortcutsModel();
|
||||
|
||||
private slots:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue