32 QAbstractTableModel(parent)
34 registeredShortcuts = Shortcuts;
40 registeredShortcuts = Shortcuts;
41 emit(layoutChanged());
47 return registeredShortcuts.size();
64 if (
index.row() >= registeredShortcuts.size() ||
index.row() < 0)
69 if (role == Qt::DisplayRole)
71 if (
index.column() == 0)
73 return tr(registeredShortcuts.keys().at(
index.row()).toStdString().c_str());
75 else if (
index.column() == 1)
78 registeredShortcuts.values().at(
index.row()).toString().toStdString().c_str());
88 if (role != Qt::DisplayRole)
93 if (orientation == Qt::Horizontal)
101 return tr(
"Key-Sequence");
114 if (!
index.isValid())
119 if (
index.row() >= registeredShortcuts.size() ||
index.row() < 0)
124 if (role == Qt::DisplayRole)
126 return registeredShortcuts.keys().at(
index.row()).toStdString().c_str();
int rowCount(const QModelIndex &parent) const override
Returns the number of given rows.
QVariant headerData(int section, Qt::Orientation orientation, int role) const override
Returns the header of a given Section by orientation.
QVariant actionName(const QModelIndex &index, int role) const
Returns the Name of the Action of the given Row.
int columnCount(const QModelIndex &parent) const override
Returns the number of given columns (standard = 2).
ShortcutTableModel(QObject *parent=0)
A constructor.
QVariant data(const QModelIndex &index, int role) const override
Returns the value of a given Position in the model.
void setShortcutHashTable(QHash< QString, QKeySequence > Shortcuts)
Sets a predefined Shortcuts-Hash as new Hash of this ShortcutTableModel.