summaryrefslogtreecommitdiffstats
path: root/examples/widgets/widgets/shortcuteditor/actionmanager.h
blob: da20cd88406664b35d2196b066087f57b92057b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Copyright (C) 2022 Laszlo Papp <lpapp@kde.org>
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause

#ifndef ACTIONMANAGER_H
#define ACTIONMANAGER_H

#include <QList>
#include <QString>

QT_BEGIN_NAMESPACE
class QAction;
QT_END_NAMESPACE

class ActionManager
{
public:
    ActionManager() = default;
    ~ActionManager() = default;

    QList<QAction*> registeredActions() const;

    void registerAction(QAction *action);
    void registerAction(QAction *action, const QString &context, const QString &category);
    QAction *registerAction(const QString &name, const QString &shortcut, const QString &context, const QString &category);

    QString contextForAction(QAction *action);
    QString categoryForAction(QAction *action);

private:
    QList<QAction *> m_actions;
};

#endif