mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-08-22 08:34:12 +02:00
Make the shortcut list browsable and searchable
Replace the flat QTableWidget with a QTreeWidget that groups actions under one collapsible top-level node per category. Fix the search box so it also matches the current key sequence (exactly), accepts multi-keyword queries (AND, any word order) and is accent-insensitive, auto-expands matching groups and shows an "N actions" count. Add a quick filter (all / bound / unbound / conflicts) that combines with the text query. Conflict detection, per-row reset, reset-all and persistence are preserved. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -22,9 +22,12 @@
|
||||
|
||||
#include <QKeySequence>
|
||||
|
||||
class QComboBox;
|
||||
class QKeySequenceEdit;
|
||||
class QLabel;
|
||||
class QLineEdit;
|
||||
class QTableWidget;
|
||||
class QTreeWidget;
|
||||
class QTreeWidgetItem;
|
||||
|
||||
/**
|
||||
@brief The ShortcutsConfigPage class
|
||||
@@ -47,21 +50,36 @@ class ShortcutsConfigPage : public ConfigPage
|
||||
|
||||
private slots:
|
||||
void filterRows(const QString &filter_text);
|
||||
void quickFilterChanged(int index);
|
||||
void checkConflicts();
|
||||
void resetAllRows();
|
||||
|
||||
private:
|
||||
enum QuickFilter {
|
||||
ShowAll = 0,
|
||||
BoundOnly,
|
||||
UnboundOnly,
|
||||
ConflictsOnly
|
||||
};
|
||||
|
||||
struct Row {
|
||||
QString id;
|
||||
QString category;
|
||||
QString description;
|
||||
QKeySequence default_sequence;
|
||||
QKeySequenceEdit *edit;
|
||||
QTreeWidgetItem *item;
|
||||
bool conflicted;
|
||||
};
|
||||
|
||||
void populateTable();
|
||||
void applyFilter();
|
||||
void resetRow(int row_index);
|
||||
|
||||
QLineEdit *m_filter_edit;
|
||||
QTableWidget *m_table;
|
||||
QComboBox *m_quick_filter;
|
||||
QLabel *m_count_label;
|
||||
QTreeWidget *m_tree;
|
||||
QList<Row> m_rows;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user