10#include <private/qguiapplication_p.h> 
   11#include <qpa/qplatformmenu.h> 
   15#define QAPP_CHECK(functionName) \ 
   16    if (Q_UNLIKELY(!qApp)) {                                            \ 
   17        qWarning("QShortcut: Initialize QGuiApplication before calling '" functionName "'."); \
 
  101    auto guiShortcut = qobject_cast<QShortcut *>(
object);
 
  112    if (focusWindow == 
window && focusWindow->isTopLevel())
 
  114    return focusWindow->isAncestorOf(
window, QWindow::ExcludeTransients);
 
  126        qWarning(
"QShortcut: No window parent defined");
 
  130    for (
int id : std::as_const(
sc_ids))
 
  131        map.removeShortcut(
id, 
q);
 
  137    for (
const auto &keySequence : std::as_const(
sc_sequences)) {
 
  138        if (keySequence.isEmpty())
 
  143            map.setShortcutEnabled(
false, 
id, 
q);
 
  145            map.setShortcutAutoRepeat(
false, 
id, 
q);
 
  179                           const char *member, 
const char *ambiguousMember,
 
  185    if (!
key.isEmpty()) {
 
  186        d->sc_sequences = { 
key };
 
  206                     const char *member, 
const char *ambiguousMember,
 
  340         for (
int id : std::as_const(
d->sc_ids))
 
  367    if (
d->sc_sequences.isEmpty())
 
  369    return d->sc_sequences.first();
 
  383    if (
d->sc_sequences == 
keys)
 
  386    d->sc_sequences = 
keys;
 
  412    return d->sc_sequences;
 
  437    for (
int id : 
d->sc_ids)
 
  444    return d->sc_enabled;
 
  472    return d->sc_context;
 
  487    if (
d->sc_autorepeat == on)
 
  490    d->sc_autorepeat = on;
 
  491    for (
int id : 
d->sc_ids)
 
  498    return d->sc_autorepeat;
 
  521    d->sc_whatsthis = 
text;
 
  532    return d->sc_whatsthis;
 
  535#if QT_DEPRECATED_SINCE(6,0) 
  543int QShortcut::id()
 const 
  546    if (
d->sc_ids.isEmpty())
 
  548    return d->sc_ids.first();
 
  566        if (!
d->handleWhatsThis()) {
 
  567            Q_ASSERT_X(
d->sc_ids.contains(se->shortcutId()), 
"QShortcut::event", 
"Received shortcut event from wrong shortcut");
 
  568            if (se->isAmbiguous())
 
  580#include "moc_qshortcut.cpp" 
static QGuiApplicationPrivate * instance()
virtual QShortcutPrivate * createShortcutPrivate() const
static Qt::ApplicationState applicationState()
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 QList< QKeySequence > keyBindings(StandardKey key)
qsizetype size() const noexcept
bool isEmpty() const noexcept
void reserve(qsizetype size)
void append(parameter_type t)
QObject * parent() const
Returns a pointer to the parent object.
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
virtual bool event(QEvent *event)
This virtual function receives events to an object and should return true if the event e was recogniz...
The QShortcutEvent class provides an event which is generated when the user presses a key combination...
bool(* ContextMatcher)(QObject *object, Qt::ShortcutContext context)
QList< QKeySequence > sc_sequences
Qt::ShortcutContext sc_context
void redoGrab(QShortcutMap &map)
virtual QShortcutMap::ContextMatcher contextMatcher() const
The QShortcut class is used to create keyboard shortcuts.
bool autoRepeat
whether the shortcut can auto repeat
void setKey(const QKeySequence &key)
Qt::ShortcutContext context
the context in which the shortcut is valid
QKeySequence key
the shortcut's primary key sequence
void setKeys(QKeySequence::StandardKey key)
Sets the triggers to those matching the standard key key.
void activatedAmbiguously()
When a key sequence is being typed at the keyboard, it is said to be ambiguous as long as it matches ...
void setWhatsThis(const QString &text)
Sets the shortcut's "What's This?" help text.
void setAutoRepeat(bool on)
QString whatsThis() const
Returns the shortcut's "What's This?" help text.
QList< QKeySequence > keys() const
Returns the list of key sequences which trigger this shortcut.
~QShortcut()
Destroys the shortcut.
void activated()
This signal is emitted when the user types the shortcut's key sequence.
bool event(QEvent *e) override
QShortcut(QObject *parent)
Constructs a QShortcut object for the parent, which should be a QWindow or a QWidget.
void setContext(Qt::ShortcutContext context)
void setEnabled(bool enable)
\macro QT_RESTRICTED_CAST_FROM_ASCII
QMap< QString, QString > map
[6]
Combined button and popup list for selecting options.
@ WidgetWithChildrenShortcut
#define QAPP_CHECK(functionName)
GLdouble GLdouble GLdouble GLdouble q
#define Q_ASSERT_X(cond, x, msg)
static bool simpleContextMatcher(QObject *object, Qt::ShortcutContext context)
const QWindow * qobject_cast< const QWindow * >(const QObject *o)
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent