Sat, 02 Jul 2022 19:05:05 +0300
Allow make a cylinder even if the world position is not on grid
| 16 | 1 | #include <QAction> |
|
264
76a025db4948
Convert all includes to be relative to project root directory. Files that cannot be found in this manner use angle brackets.
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
259
diff
changeset
|
2 | #include "src/uiutilities.h" |
|
76a025db4948
Convert all includes to be relative to project root directory. Files that cannot be found in this manner use angle brackets.
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
259
diff
changeset
|
3 | #include "src/settingseditor/keyboardshortcutseditor.h" |
| 16 | 4 | |
| 5 | KeyboardShortcutsEditor::KeyboardShortcutsEditor(QObject* subject, QObject* parent) : | |
| 6 | QAbstractTableModel{parent}, | |
| 7 | actions{uiutilities::collectActions(subject)} | |
| 8 | { | |
| 9 | } | |
| 10 | ||
| 11 | int KeyboardShortcutsEditor::rowCount(const QModelIndex&) const | |
| 12 | { | |
|
259
c27612f0eac0
- Made it build under Qt6
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
16
diff
changeset
|
13 | return static_cast<int>(this->actions.size()); |
| 16 | 14 | } |
| 15 | ||
| 16 | int KeyboardShortcutsEditor::columnCount(const QModelIndex&) const | |
| 17 | { | |
| 18 | return 2; | |
| 19 | } | |
| 20 | ||
| 21 | QVariant KeyboardShortcutsEditor::data( | |
| 22 | const QModelIndex& index, | |
| 23 | int role) const | |
| 24 | { | |
|
259
c27612f0eac0
- Made it build under Qt6
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
16
diff
changeset
|
25 | QAction* const action = this->actions[static_cast<std::size_t>(index.row())]; |
| 16 | 26 | const Column column = static_cast<Column>(index.column()); |
| 27 | switch(role) | |
| 28 | { | |
| 29 | case Qt::DisplayRole: | |
| 30 | switch (column) { | |
| 31 | case TitleColumn: | |
| 32 | return action->text(); | |
| 33 | case ShortcutColumn: | |
| 34 | return action->shortcut().toString(QKeySequence::NativeText); | |
| 35 | } | |
| 36 | break; | |
| 37 | } | |
| 38 | return {}; | |
| 39 | } | |
| 40 | ||
| 41 | QVariant KeyboardShortcutsEditor::headerData( | |
| 42 | int section, | |
| 43 | Qt::Orientation orientation, | |
| 44 | int role) const | |
| 45 | { | |
| 46 | if (orientation == Qt::Horizontal and role == Qt::DisplayRole) | |
| 47 | { | |
| 48 | switch (static_cast<Column>(section)) | |
| 49 | { | |
| 50 | case TitleColumn: | |
| 51 | return tr("Action"); | |
| 52 | case ShortcutColumn: | |
| 53 | return tr("Shortcut"); | |
| 54 | } | |
| 55 | } | |
| 56 | return {}; | |
| 57 | } | |
| 58 |