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>
62 while (
obj && !
obj->isWindowType()) {
86 if (!ctxMatcher.isDestroyed())
94 if (
value.userType() == QMetaType::Int) {
99 u
"Shortcut: Only binding to one of multiple key bindings associated with %1. "
100 u
"Use 'sequences: [ <key> ]' to bind to all of them.");
112 if (
value.userType() == QMetaType::Int) {
122 m_enabled(true), m_completed(
false), m_autorepeat(true), m_context(
Qt::WindowShortcut)
210 if (m_shortcuts.size() == requestedShortcuts.
size()) {
211 bool changed =
false;
212 for (
int i = 0;
i < requestedShortcuts.
size(); ++
i) {
213 const Shortcut &requestedShortcut = requestedShortcuts[
i];
228 m_shortcuts = requestedShortcuts;
232 emit sequencesChanged();
305 if (repeat == m_autorepeat)
312 m_autorepeat = repeat;
347 for (
auto &
s : m_shortcuts)
353 for (
auto &
s : m_shortcuts)
377 while (!
match &&
i < m_shortcuts.size())
378 match |= m_shortcuts.at(
i++).matches(se);
380 if (se->isAmbiguous())
392 return event->shortcutId() ==
id &&
event->key() ==
keySequence;
409 if (m_completed && !
shortcut.keySequence.isEmpty()) {
413 pApp->shortcutMap.setShortcutEnabled(
false,
shortcut.id,
this);
415 pApp->shortcutMap.setShortcutAutoRepeat(
false,
shortcut.id,
this);
429#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
qsizetype size() const noexcept
void push_back(parameter_type t)
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)
qsizetype size() const
Returns the number of characters in this string.
QString arg(qlonglong a, int fieldwidth=0, int base=10, QChar fillChar=u' ') const
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)
QQuickItem * qobject_cast< QQuickItem * >(QObject *o)
Q_QUICK_PRIVATE_EXPORT void qt_quick_set_shortcut_context_matcher(ContextMatcher matcher)
Q_QUICK_PRIVATE_EXPORT ContextMatcher qt_quick_shortcut_context_matcher()
bool(* ContextMatcher)(QObject *, Qt::ShortcutContext)
static bool qQuickShortcutContextMatcher(QObject *obj, Qt::ShortcutContext context)
\qmltype Shortcut \instantiates QQuickShortcut \inqmlmodule QtQuick
static QT_BEGIN_NAMESPACE QKeySequence valueToKeySequence(const QVariant &value, const QQuickShortcut *const shortcut)
static QList< QKeySequence > valueToKeySequences(const QVariant &value)
static bool match(const uchar *found, uint foundLen, const char *target, uint targetLen)
static const auto matcher
[0]
bool matches(QShortcutEvent *event) const
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent