6#include <QtQuick/qquickitem.h>
7#include <QtQuick/qquickwindow.h>
8#include <QtQuick/qquickrendercontrol.h>
9#include <QtQuick/private/qtquickglobal_p.h>
10#include <QtGui/private/qguiapplication_p.h>
11#include <QtQml/qqmlinfo.h>
63 while (
obj && !
obj->isWindowType()) {
87 if (!ctxMatcher.isDestroyed())
95 if (
value.userType() == QMetaType::Int) {
96 const QVector<QKeySequence>
s =
100 u
"Shortcut: Only binding to one of multiple key bindings associated with %1. "
101 u
"Use 'sequences: [ <key> ]' to bind to all of them.");
113 if (
value.userType() == QMetaType::Int) {
116 QList<QKeySequence>
result;
123 m_enabled(true), m_completed(
false), m_autorepeat(true), m_context(
Qt::WindowShortcut)
203 QVector<Shortcut> requestedShortcuts;
210 requestedShortcuts.push_back(sc);
215 if (m_shortcuts.size() == requestedShortcuts.size()) {
216 bool changed =
false;
217 for (
int i = 0;
i < requestedShortcuts.size(); ++
i) {
218 const Shortcut &requestedShortcut = requestedShortcuts[
i];
220 if (!(requestedShortcut.userValue ==
shortcut.userValue
221 && requestedShortcut.keySequence ==
shortcut.keySequence)) {
233 m_shortcuts = requestedShortcuts;
237 emit sequencesChanged();
310 if (repeat == m_autorepeat)
317 m_autorepeat = repeat;
352 for (
auto &
s : m_shortcuts)
358 for (
auto &
s : m_shortcuts)
382 while (!
match &&
i < m_shortcuts.size())
383 match |= m_shortcuts.at(
i++).matches(se);
385 if (se->isAmbiguous())
397 return event->shortcutId() ==
id &&
event->key() ==
keySequence;
414 if (m_completed && !
shortcut.keySequence.isEmpty()) {
418 pApp->shortcutMap.setShortcutEnabled(
false,
shortcut.id,
this);
420 pApp->shortcutMap.setShortcutAutoRepeat(
false,
shortcut.id,
this);
434#include "moc_qquickshortcut_p.cpp"
QGraphicsWidget * window() const
static QGuiApplicationPrivate * instance()
static QWindow * focusWindow()
Returns the QWindow that receives events tied to focus, such as key events.
The QKeySequence class encapsulates a key sequence as used by shortcuts.
static QKeySequence fromString(const QString &str, SequenceFormat format=PortableText)
static QList< QKeySequence > keyBindings(StandardKey key)
QString toString(SequenceFormat format=PortableText) const
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
static QWindow * renderWindowFor(QQuickWindow *win, QPoint *offset=nullptr)
Returns the real window that win is being rendered to, if any.
void setSequence(const QVariant &sequence)
void setAutoRepeat(bool repeat)
void setEnabled(bool enabled)
void ungrabShortcut(Shortcut &shortcut)
void classBegin() override
Invoked after class creation, but before any properties have been set.
void componentComplete() override
Invoked after the root component that caused this instantiation has completed construction.
void setContext(Qt::ShortcutContext context)
bool event(QEvent *event) override
This virtual function receives events to an object and should return true if the event e was recogniz...
void setSequences(const QVariantList &sequences)
void grabShortcut(Shortcut &shortcut, Qt::ShortcutContext context)
bool isEnabled() const
\qmlproperty bool QtQuick::Shortcut::enabled
Qt::ShortcutContext context
QQuickShortcut(QObject *parent=nullptr)
void activatedAmbiguously()
The QShortcutEvent class provides an event which is generated when the user presses a key combination...
\macro QT_RESTRICTED_CAST_FROM_ASCII
static QString fromUtf16(const char16_t *, qsizetype size=-1)
Combined button and popup list for selecting options.
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
#define Q_GLOBAL_STATIC_WITH_ARGS(TYPE, NAME, ARGS)
GLenum GLsizei GLsizei GLint * values
[15]
GLsizei const GLfloat * v
[13]
GLenum GLenum GLsizei const GLuint GLboolean enabled
Q_QML_EXPORT QQmlInfo qmlWarning(const QObject *me)
bool(* ContextMatcher)(QObject *, Qt::ShortcutContext)
static bool qQuickShortcutContextMatcher(QObject *obj, Qt::ShortcutContext context)
\qmltype Shortcut \instantiates QQuickShortcut \inqmlmodule QtQuick
Q_QUICK_EXPORT ContextMatcher qt_quick_shortcut_context_matcher()
static QT_BEGIN_NAMESPACE QKeySequence valueToKeySequence(const QVariant &value, const QQuickShortcut *const shortcut)
static QList< QKeySequence > valueToKeySequences(const QVariant &value)
Q_QUICK_EXPORT void qt_quick_set_shortcut_context_matcher(ContextMatcher matcher)
static bool match(const uchar *found, uint foundLen, const char *target, uint targetLen)
static const auto matcher
[0]
bool matches(QShortcutEvent *event) const