Sat, 01 Feb 2020 15:33:57 +0200
wired renderstyle up
24 | 1 | /* |
2 | * LDForge: LDraw parts authoring CAD | |
3 | * Copyright (C) 2013 - 2020 Teemu Piippo | |
4 | * | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
9 | * | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | */ | |
18 | ||
16 | 19 | #include "uiutilities.h" |
20 | ||
21 | QVector<QAction*> uiutilities::collectActions(QObject* subject) | |
22 | { | |
23 | QVector<QAction*> actions; | |
24 | for (QAction* action : subject->findChildren<QAction*>()) | |
25 | { | |
26 | if (not action->text().isEmpty() | |
27 | and action->data().isNull() | |
28 | and not action->objectName().isEmpty()) | |
29 | { | |
30 | actions.push_back(action); | |
31 | } | |
32 | } | |
33 | return actions; | |
34 | } | |
35 | ||
36 | uiutilities::KeySequenceMap uiutilities::makeKeySequenceMap(const QVector<QAction*>& actions) | |
37 | { | |
38 | KeySequenceMap result; | |
39 | for (QAction* action : actions) | |
40 | { | |
41 | result[action->objectName()] = action->shortcut(); | |
42 | } | |
43 | return result; | |
44 | } |