File indexing completed on 2024-12-08 08:02:45

0001 /*
0002     SPDX-FileCopyrightText: 2014-2015 Harald Sitter <sitter@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005 */
0006 
0007 #ifndef GLOBALACTIONCOLLECTION_H
0008 #define GLOBALACTIONCOLLECTION_H
0009 
0010 #include <QAction>
0011 #include <QQuickItem>
0012 
0013 class GlobalAction : public QAction
0014 {
0015     Q_OBJECT
0016     // These members exist in QAction but only "shortcut" is exposed to the metaobject
0017     Q_PROPERTY(QList<QKeySequence> shortcuts READ shortcuts WRITE setShortcuts NOTIFY changed)
0018 public:
0019     explicit GlobalAction(QObject *parent = nullptr);
0020 };
0021 
0022 class GlobalActionCollection : public QQuickItem
0023 {
0024     Q_OBJECT
0025     Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
0026     Q_PROPERTY(QString displayName READ displayName WRITE setDisplayName NOTIFY displayNameChanged)
0027 public:
0028     GlobalActionCollection();
0029 
0030     QString name() const;
0031     void setName(const QString &name);
0032 
0033     QString displayName() const;
0034     void setDisplayName(const QString &displayName);
0035 
0036 Q_SIGNALS:
0037     void nameChanged();
0038     void displayNameChanged();
0039 
0040 protected:
0041     void componentComplete() final;
0042 
0043 private:
0044     QString m_name;
0045     QString m_displayName;
0046 };
0047 
0048 #endif // GLOBALACTIONCOLLECTION_H