Wed, 01 Jan 2020 17:45:56 +0200
things
#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; }