--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/uiutilities.cpp Fri Nov 08 19:05:07 2019 +0200 @@ -0,0 +1,26 @@ +#include "uiutilities.h" + +QVector<QAction*> uiutilities::collectActions(QObject* subject) +{ + QVector<QAction*> actions; + for (QAction* action : subject->findChildren<QAction*>()) + { + if (not action->text().isEmpty() + and action->data().isNull() + and not action->objectName().isEmpty()) + { + actions.push_back(action); + } + } + return actions; +} + +uiutilities::KeySequenceMap uiutilities::makeKeySequenceMap(const QVector<QAction*>& actions) +{ + KeySequenceMap result; + for (QAction* action : actions) + { + result[action->objectName()] = action->shortcut(); + } + return result; +}