1// Copyright (C) 2019 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QACTION_P_H
5#define QACTION_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists for the convenience
12// of other Qt classes. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtGui/private/qtguiglobal_p.h>
19#include <QtGui/qaction.h>
20#include <QtGui/qfont.h>
21#if QT_CONFIG(shortcut)
22# include <QtGui/private/qshortcutmap_p.h>
23#endif
24#include "private/qobject_p.h"
25
26QT_REQUIRE_CONFIG(action);
27
28QT_BEGIN_NAMESPACE
29
30class QShortcutMap;
31
32class Q_GUI_EXPORT QActionPrivate : public QObjectPrivate
33{
34 Q_DECLARE_PUBLIC(QAction)
35public:
36 QActionPrivate();
37 ~QActionPrivate();
38
39 virtual void destroy();
40
41#if QT_CONFIG(shortcut)
42 virtual QShortcutMap::ContextMatcher contextMatcher() const;
43#endif
44
45 static QActionPrivate *get(QAction *q)
46 {
47 return q->d_func();
48 }
49
50 bool setEnabled(bool enable, bool byGroup);
51 void setVisible(bool b);
52
53 QPointer<QActionGroup> group;
54 QString text;
55 QString iconText;
56 QIcon icon;
57 QString tooltip;
58 QString statustip;
59 QString whatsthis;
60#if QT_CONFIG(shortcut)
61 QList<QKeySequence> shortcuts;
62#endif
63 QVariant userData;
64
65 QObjectList associatedObjects;
66 virtual QObject *menu() const;
67 virtual void setMenu(QObject *menu);
68
69#if QT_CONFIG(shortcut)
70 QList<int> shortcutIds;
71 Qt::ShortcutContext shortcutContext = Qt::WindowShortcut;
72 uint autorepeat : 1;
73#endif
74 QFont font;
75 uint enabled : 1, explicitEnabled : 1, explicitEnabledValue : 1;
76 uint visible : 1, forceInvisible : 1;
77 uint checkable : 1;
78 uint checked : 1;
79 uint separator : 1;
80 uint fontSet : 1;
81
82 int iconVisibleInMenu : 2; // Only has values -1, 0, and 1
83 int shortcutVisibleInContextMenu : 2; // Only has values -1, 0, and 1
84
85 QAction::MenuRole menuRole = QAction::TextHeuristicRole;
86 QAction::Priority priority = QAction::NormalPriority;
87
88#if QT_CONFIG(shortcut)
89 void redoGrab(QShortcutMap &map);
90 void redoGrabAlternate(QShortcutMap &map);
91 void setShortcutEnabled(bool enable, QShortcutMap &map);
92#endif // QT_NO_SHORTCUT
93
94 bool showStatusText(QObject *widget, const QString &str);
95 void sendDataChanged();
96};
97
98QT_END_NAMESPACE
99
100#endif // QACTION_P_H
101

source code of qtbase/src/gui/kernel/qaction_p.h