Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qquickaction_p_p.h
Go to the documentation of this file.
1// Copyright (C) 2017 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 QQUICKACTION_P_P_H
5#define QQUICKACTION_P_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 purely as an
12// implementation detail. 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 <QtCore/private/qobject_p.h>
19#include <QtCore/qvariant.h>
20#include <QtCore/qstring.h>
21#if QT_CONFIG(shortcut)
22# include <QtGui/qkeysequence.h>
23#endif
24#include <QtQuick/private/qquickitemchangelistener_p.h>
25
27
28class QShortcutEvent;
30
32{
33 Q_DECLARE_PUBLIC(QQuickAction)
34
35public:
37 {
38 return action->d_func();
39 }
40
41#if QT_CONFIG(shortcut)
42 QVariant shortcut() const;
43 void setShortcut(const QVariant &shortcut);
44#endif
45
46 void setEnabled(bool enable);
47
50
53
55 void itemDestroyed(QQuickItem *item) override;
56
58
59 void trigger(QObject*, bool doToggle);
60
61#if QT_CONFIG(shortcut)
62 class ShortcutEntry
63 {
64 public:
65 explicit ShortcutEntry(QObject *target);
66 ~ShortcutEntry();
67
68 QObject *target() const;
69 int shortcutId() const;
70
71 void grab(const QKeySequence &vshortcut, bool enabled);
72 void ungrab();
73
74 void setEnabled(bool enabled);
75
76 private:
77 int m_shortcutId = 0;
78 QObject *m_target = nullptr;
79 };
80
81 ShortcutEntry *findShortcutEntry(QObject *target) const;
82 void updateDefaultShortcutEntry();
83#endif // QT_CONFIG(shortcut)
84
85 bool explicitEnabled = false;
86 bool enabled = true;
87 bool checked = false;
88 bool checkable = false;
91#if QT_CONFIG(shortcut)
92 QKeySequence keySequence;
93 QVariant vshortcut;
94 ShortcutEntry *defaultShortcutEntry = nullptr;
95 QList<ShortcutEntry *> shortcutEntries;
96#endif
98};
99
101
102#endif // QQUICKACTION_P_P_H
The QKeySequence class encapsulates a key sequence as used by shortcuts.
\inmodule QtCore
Definition qobject.h:103
void trigger(QObject *, bool doToggle)
bool handleShortcutEvent(QObject *object, QShortcutEvent *event)
void itemDestroyed(QQuickItem *item) override
void registerItem(QQuickItem *item)
static QQuickActionPrivate * get(QQuickAction *action)
bool watchItem(QQuickItem *item)
void setEnabled(bool enable)
Abstract user interface action.
void itemVisibilityChanged(QQuickItem *item) override
bool unwatchItem(QQuickItem *item)
void unregisterItem(QQuickItem *item)
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
Definition qquickitem.h:63
The QShortcutEvent class provides an event which is generated when the user presses a key combination...
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
\inmodule QtCore
Definition qvariant.h:65
Combined button and popup list for selecting options.
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLboolean GLuint group
GLenum target
GLboolean enable
struct _cl_event * event
QGraphicsItem * item
button setShortcut(tr("Alt+F7"))