Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
QShortcutMap Class Reference

#include <qshortcutmap_p.h>

Collaboration diagram for QShortcutMap:

Public Types

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

Public Member Functions

 QShortcutMap ()
 ~QShortcutMap ()
int addShortcut (QObject *owner, const QKeySequence &key, Qt::ShortcutContext context, ContextMatcher matcher)
int removeShortcut (int id, QObject *owner, const QKeySequence &key=QKeySequence())
int setShortcutEnabled (bool enable, int id, QObject *owner, const QKeySequence &key=QKeySequence())
int setShortcutAutoRepeat (bool on, int id, QObject *owner, const QKeySequence &key=QKeySequence())
QKeySequence::SequenceMatch state ()
bool tryShortcut (QKeyEvent *e)
bool hasShortcutForKeySequence (const QKeySequence &seq) const
QList< QKeySequencekeySequences (bool getAll=false) const

Detailed Description

Definition at line 36 of file qshortcutmap_p.h.

Member Typedef Documentation

◆ ContextMatcher

typedef bool(* QShortcutMap::ContextMatcher) (QObject *object, Qt::ShortcutContext context)

Definition at line 43 of file qshortcutmap_p.h.

Constructor & Destructor Documentation

◆ QShortcutMap()

QShortcutMap::QShortcutMap ( )

QShortcutMap constructor.

Definition at line 107 of file qshortcutmap.cpp.

◆ ~QShortcutMap()

QShortcutMap::~QShortcutMap ( )

QShortcutMap destructor.

Definition at line 116 of file qshortcutmap.cpp.

Member Function Documentation

◆ addShortcut()

int QShortcutMap::addShortcut ( QObject * owner,
const QKeySequence & keySequence,
Qt::ShortcutContext context,
ContextMatcher matcher )

Adds a shortcut to the global map. Returns the id of the newly added shortcut.

Definition at line 124 of file qshortcutmap.cpp.

◆ hasShortcutForKeySequence()

bool QShortcutMap::hasShortcutForKeySequence ( const QKeySequence & seq) const

Determines if an enabled shortcut has a matching key sequence.

Definition at line 365 of file qshortcutmap.cpp.

◆ keySequences()

QList< QKeySequence > QShortcutMap::keySequences ( bool getAll = false) const

Definition at line 610 of file qshortcutmap.cpp.

◆ removeShortcut()

int QShortcutMap::removeShortcut ( int id,
QObject * owner,
const QKeySequence & keySequence = QKeySequence() )

Removes a shortcut from the global map. If owner is \nullptr, all entries in the map with the key sequence specified is removed. If key is null, all sequences for owner is removed from the map. If id is 0, any identical key sequences owned by owner are removed. Returns the number of sequences removed from the map.

Definition at line 148 of file qshortcutmap.cpp.

◆ setShortcutAutoRepeat()

int QShortcutMap::setShortcutAutoRepeat ( bool on,
int id,
QObject * owner,
const QKeySequence & keySequence = QKeySequence() )

Changes the auto repeat state of a shortcut to enable. If owner is \nullptr, all entries in the map with the key sequence specified is removed. If key is null, all sequences for owner is removed from the map. If id is 0, any identical key sequences owned by owner are changed. Returns the number of sequences which are matched in the map.

Definition at line 231 of file qshortcutmap.cpp.

◆ setShortcutEnabled()

int QShortcutMap::setShortcutEnabled ( bool enable,
int id,
QObject * owner,
const QKeySequence & keySequence = QKeySequence() )

Changes the enable state of a shortcut to enable. If owner is \nullptr, all entries in the map with the key sequence specified is removed. If key is null, all sequences for owner is removed from the map. If id is 0, any identical key sequences owned by owner are changed. Returns the number of sequences which are matched in the map.

Definition at line 195 of file qshortcutmap.cpp.

◆ state()

QKeySequence::SequenceMatch QShortcutMap::state ( )

Returns the current state of the statemachine

Definition at line 272 of file qshortcutmap.cpp.

◆ tryShortcut()

bool QShortcutMap::tryShortcut ( QKeyEvent * e)

Uses nextState(QKeyEvent) to check for a grabbed shortcut.

If so, it is dispatched using dispatchEvent().

Returns true if a shortcut handled the event.

See also
nextState, dispatchEvent

Definition at line 287 of file qshortcutmap.cpp.


The documentation for this class was generated from the following files: