Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qquickshortcut.cpp File Reference
#include "qquickshortcut_p.h"
#include <QtQuick/qquickitem.h>
#include <QtQuick/qquickwindow.h>
#include <QtQuick/qquickrendercontrol.h>
#include <QtQuick/private/qtquickglobal_p.h>
#include <QtGui/private/qguiapplication_p.h>
#include <QtQml/qqmlinfo.h>
#include "moc_qquickshortcut_p.cpp"
+ Include dependency graph for qquickshortcut.cpp:

Go to the source code of this file.

Typedefs

typedef bool(* ContextMatcher) (QObject *, Qt::ShortcutContext)
 

Functions

static bool qQuickShortcutContextMatcher (QObject *obj, Qt::ShortcutContext context)
 \qmltype Shortcut \instantiates QQuickShortcut \inqmlmodule QtQuick
 
Q_QUICK_PRIVATE_EXPORT ContextMatcher qt_quick_shortcut_context_matcher ()
 
Q_QUICK_PRIVATE_EXPORT void qt_quick_set_shortcut_context_matcher (ContextMatcher matcher)
 
static QT_BEGIN_NAMESPACE QKeySequence valueToKeySequence (const QVariant &value, const QQuickShortcut *const shortcut)
 
static QList< QKeySequencevalueToKeySequences (const QVariant &value)
 

Typedef Documentation

◆ ContextMatcher

typedef bool(* ContextMatcher) (QObject *, Qt::ShortcutContext)

Definition at line 75 of file qquickshortcut.cpp.

Function Documentation

◆ qQuickShortcutContextMatcher()

static bool qQuickShortcutContextMatcher ( QObject obj,
Qt::ShortcutContext  context 
)
static

\qmltype Shortcut \instantiates QQuickShortcut \inqmlmodule QtQuick

Since
5.5

Provides keyboard shortcuts.

The Shortcut type provides a way of handling keyboard shortcuts. The shortcut can be set to one of the \l{QKeySequence::StandardKey}{standard keyboard shortcuts}, or it can be described with a string containing a sequence of up to four key presses that are needed to \l{Shortcut::activated}{activate} the shortcut.

\qml Item { id: view

property int currentIndex

Shortcut { sequence: StandardKey.NextChild onActivated: view.currentIndex++ } } \endqml

It is also possible to set multiple shortcut \l sequences, so that the shortcut can be \l activated via several different sequences of key presses.

See also
Keys, {Keys::}{shortcutOverride()}

\qmlsignal QtQuick::Shortcut::activated()

This signal is emitted when the shortcut is activated.

\qmlsignal QtQuick::Shortcut::activatedAmbiguously()

This signal is emitted when the shortcut is activated ambigously, meaning that it matches the start of more than one shortcut.

Definition at line 56 of file qquickshortcut.cpp.

References Qt::ApplicationShortcut, context, QGuiApplication::focusWindow(), item, qobject_cast< QQuickItem * >(), QQuickRenderControl::renderWindowFor(), QGraphicsItem::window(), and Qt::WindowShortcut.

+ Here is the call graph for this function:

◆ qt_quick_set_shortcut_context_matcher()

Q_QUICK_PRIVATE_EXPORT void qt_quick_set_shortcut_context_matcher ( ContextMatcher  matcher)

Definition at line 84 of file qquickshortcut.cpp.

References matcher.

Referenced by QtQuickTemplates2Plugin::registerTypes(), and QtQuickTemplates2Plugin::unregisterTypes().

+ Here is the caller graph for this function:

◆ qt_quick_shortcut_context_matcher()

Q_QUICK_PRIVATE_EXPORT ContextMatcher qt_quick_shortcut_context_matcher ( )

Definition at line 79 of file qquickshortcut.cpp.

Referenced by QtQuickTemplates2Plugin::registerTypes().

+ Here is the caller graph for this function:

◆ valueToKeySequence()

static QT_BEGIN_NAMESPACE QKeySequence valueToKeySequence ( const QVariant value,
const QQuickShortcut *const  shortcut 
)
static

Definition at line 92 of file qquickshortcut.cpp.

References QString::arg(), QKeySequence::fromString(), QString::fromUtf16(), QKeySequence::keyBindings(), qmlWarning(), shortcut, and QString::size().

Referenced by QQuickShortcut::setSequence().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ valueToKeySequences()

static QList< QKeySequence > valueToKeySequences ( const QVariant value)
static

Definition at line 110 of file qquickshortcut.cpp.

References QKeySequence::fromString(), and QKeySequence::keyBindings().

Referenced by QQuickShortcut::setSequences().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: