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
25#include <QtCore/qpointer.h>
26#include "private/qobject_p.h"
27
28QT_REQUIRE_CONFIG(action);
29
30QT_BEGIN_NAMESPACE
31
32class QShortcutMap;
33
34class Q_GUI_EXPORT QActionPrivate : public QObjectPrivate
35{
36 Q_DECLARE_PUBLIC(QAction)
37public:
38 QActionPrivate();
39 ~QActionPrivate();
40
41 virtual void destroy();
42
43#if QT_CONFIG(shortcut)
44 virtual QShortcutMap::ContextMatcher contextMatcher() const;
45#endif
46
47 static QActionPrivate *get(QAction *q)
48 {
49 return q->d_func();
50 }
51
52 bool setEnabled(bool enable, bool byGroup);
53 void setVisible(bool b);
54
55 QPointer<QActionGroup> group;
56 QString text;
57 QString iconText;
58 QIcon icon;
59 QString tooltip;
60 QString statustip;
61 QString whatsthis;
62#if QT_CONFIG(shortcut)
63 QList<QKeySequence> shortcuts;
64#endif
65 QVariant userData;
66
67 QObjectList associatedObjects;
68 virtual QObject *menu() const;
69 virtual void setMenu(QObject *menu);
70
71#if QT_CONFIG(shortcut)
72 QList<int> shortcutIds;
73 Qt::ShortcutContext shortcutContext = Qt::WindowShortcut;
74 uint autorepeat : 1;
75#endif
76 QFont font;
77 uint enabled : 1, explicitEnabled : 1, explicitEnabledValue : 1;
78 uint visible : 1, forceInvisible : 1;
79 uint checkable : 1;
80 uint checked : 1;
81 uint separator : 1;
82 uint fontSet : 1;
83
84 int iconVisibleInMenu : 2; // Only has values -1, 0, and 1
85 int shortcutVisibleInContextMenu : 2; // Only has values -1, 0, and 1
86
87 QAction::MenuRole menuRole = QAction::TextHeuristicRole;
88 QAction::Priority priority = QAction::NormalPriority;
89
90#if QT_CONFIG(shortcut)
91 void redoGrab(QShortcutMap &map);
92 void redoGrabAlternate(QShortcutMap &map);
93 void setShortcutEnabled(bool enable, QShortcutMap &map);
94#endif // QT_NO_SHORTCUT
95
96 bool showStatusText(QObject *widget, const QString &str);
97 void sendDataChanged();
98};
99
100QT_END_NAMESPACE
101
102#endif // QACTION_P_H
103

Provided by KDAB

Privacy Policy
Start learning QML with our Intro Training
Find out more

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