KeymapModel
KeymapModel
Two-level tree model mapping KeymapManager actions into Category → Action rows. More…
#include <KeymapModel.hpp>
Inherits from QAbstractItemModel
Public Types
| Name | |
|---|---|
| enum | Column { ColName = 0, ColBinding, ColScope, ColDefault, ColumnCount} |
| enum | Roles { ActionIdRole = Qt::UserRole + 1, IsCategoryRole, HasConflictRole, IsOverrideRole} Custom roles for programmatic access. |
Public Functions
| Name | |
|---|---|
| KeymapModel(KeymapSystem::KeymapManager * manager, QObject * parent =[nullptr]) | |
| QModelIndex | index(int row, int column, QModelIndex const & parent ={}) const override |
| QModelIndex | parent(QModelIndex const & child) const override |
| int | rowCount(QModelIndex const & parent ={}) const override |
| int | columnCount(QModelIndex const & parent ={}) const override |
| QVariant | data(QModelIndex const & index, int role =Qt::DisplayRole) const override |
| QVariant | headerData(int section, Qt::Orientation orientation, int role =Qt::DisplayRole) const override |
| Qt::ItemFlags | flags(QModelIndex const & index) const override |
| void | refresh() Rebuild the model data from KeymapManager. |
| QString | actionIdAt(QModelIndex const & index) const Get action_id for a model index (empty for category rows). |
Detailed Description
class KeymapModel;Two-level tree model mapping KeymapManager actions into Category → Action rows.
Thread safety: not thread-safe. Must be used from the GUI thread only.
Public Types Documentation
enum Column
| Enumerator | Value | Description |
|---|---|---|
| ColName | 0 | Display name / category name. |
| ColBinding | Current effective binding. | |
| ColScope | Scope kind label (Global, Focused, Always-Routed). | |
| ColDefault | Default binding (for reference). | |
| ColumnCount |
enum Roles
| Enumerator | Value | Description |
|---|---|---|
| ActionIdRole | Qt::UserRole + 1 | QString action_id (actions only). |
| IsCategoryRole | bool — true for category rows | |
| HasConflictRole | bool — true if this action has a binding conflict | |
| IsOverrideRole | bool — true if user override is active |
Custom roles for programmatic access.
Public Functions Documentation
function KeymapModel
explicit KeymapModel(
KeymapSystem::KeymapManager * manager,
QObject * parent =nullptr
)function index
QModelIndex index(
int row,
int column,
QModelIndex const & parent ={}
) const overridefunction parent
QModelIndex parent(
QModelIndex const & child
) const overridefunction rowCount
int rowCount(
QModelIndex const & parent ={}
) const overridefunction columnCount
int columnCount(
QModelIndex const & parent ={}
) const overridefunction data
QVariant data(
QModelIndex const & index,
int role =Qt::DisplayRole
) const overridefunction headerData
QVariant headerData(
int section,
Qt::Orientation orientation,
int role =Qt::DisplayRole
) const overridefunction flags
Qt::ItemFlags flags(
QModelIndex const & index
) const overridefunction refresh
void refresh()Rebuild the model data from KeymapManager.
function actionIdAt
QString actionIdAt(
QModelIndex const & index
) constGet action_id for a model index (empty for category rows).
Updated on 2026-11-13 at 20:25:40 +0000