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
qquickshortcut_p.h
Go to the documentation of this file.
1// Copyright (C) 2020 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 QQUICKSHORTCUT_P_H
5#define QQUICKSHORTCUT_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/qobject.h>
19#include <QtCore/qvector.h>
20#include <QtCore/qvariant.h>
21#include <QtGui/qkeysequence.h>
22#include <QtQml/qqmlparserstatus.h>
23#include <QtQml/qqml.h>
24#include <QtCore/private/qglobal_p.h>
25#include <QtQuick/private/qtquickglobal_p.h>
26
28
29class QShortcutEvent;
30
31class Q_QUICK_EXPORT QQuickShortcut : public QObject, public QQmlParserStatus
32{
35 Q_PROPERTY(QVariant sequence READ sequence WRITE setSequence NOTIFY sequenceChanged FINAL)
36 Q_PROPERTY(QVariantList sequences READ sequences WRITE setSequences NOTIFY sequencesChanged FINAL REVISION(2, 9))
37 Q_PROPERTY(QString nativeText READ nativeText NOTIFY sequenceChanged FINAL REVISION(2, 6))
38 Q_PROPERTY(QString portableText READ portableText NOTIFY sequenceChanged FINAL REVISION(2, 6))
39 Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged FINAL)
40 Q_PROPERTY(bool autoRepeat READ autoRepeat WRITE setAutoRepeat NOTIFY autoRepeatChanged FINAL)
41 Q_PROPERTY(Qt::ShortcutContext context READ context WRITE setContext NOTIFY contextChanged FINAL)
44
45public:
46 explicit QQuickShortcut(QObject *parent = nullptr);
48
49 QVariant sequence() const;
50 void setSequence(const QVariant &sequence);
51
52 QVariantList sequences() const;
53 void setSequences(const QVariantList &sequences);
54
55 QString nativeText() const;
56 QString portableText() const;
57
58 bool isEnabled() const;
59 void setEnabled(bool enabled);
60
61 bool autoRepeat() const;
62 void setAutoRepeat(bool repeat);
63
64 Qt::ShortcutContext context() const;
65 void setContext(Qt::ShortcutContext context);
66
68 void sequenceChanged();
69 Q_REVISION(2, 9) void sequencesChanged();
70 void enabledChanged();
71 void autoRepeatChanged();
72 void contextChanged();
73
74 void activated();
75 void activatedAmbiguously();
76
77protected:
78 void classBegin() override;
79 void componentComplete() override;
80 bool event(QEvent *event) override;
81
89
90 void setEnabled(Shortcut &shortcut, bool enabled);
91 void setAutoRepeat(Shortcut &shortcut, bool repeat);
92
93 void grabShortcut(Shortcut &shortcut, Qt::ShortcutContext context);
94 void ungrabShortcut(Shortcut &shortcut);
95
96private:
97 bool m_enabled;
98 bool m_completed;
99 bool m_autorepeat;
100 Qt::ShortcutContext m_context;
101 Shortcut m_shortcut;
102 QVector<Shortcut> m_shortcuts;
103};
104
106
107#endif // QQUICKSHORTCUT_P_H
\inmodule QtCore
Definition qcoreevent.h:45
The QKeySequence class encapsulates a key sequence as used by shortcuts.
\inmodule QtCore
Definition qobject.h:103
The QQmlParserStatus class provides updates on the QML parser state.
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.
Definition qcompare.h:63
ShortcutContext
static void * context
static bool matches(const QJsonObject &object, const QString &osName, const QVersionNumber &kernelVersion, const QString &osRelease, const QOpenGLConfig::Gpu &gpu)
Definition qopengl.cpp:270
GLenum GLuint id
[7]
GLenum GLenum GLsizei const GLuint GLboolean enabled
struct _cl_event * event
#define QML_NAMED_ELEMENT(NAME)
#define QML_ADDED_IN_VERSION(MAJOR, MINOR)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_REVISION(...)
#define Q_INTERFACES(x)
#define Q_SIGNALS
#define explicit