QShortcutEvent Class

The QShortcutEvent class provides an event which is generated when the user presses a key combination. More...

Header: #include <QShortcutEvent>
CMake: find_package(Qt6 REQUIRED COMPONENTS Gui)
target_link_libraries(mytarget PRIVATE Qt6::Gui)
qmake: QT += gui
Inherits: QEvent

Public Functions

QShortcutEvent(const QKeySequence &key, int id, bool ambiguous = false)
virtual ~QShortcutEvent() override
bool isAmbiguous() const
const QKeySequence &key() const
int shortcutId() const

Reimplemented Public Functions

virtual QShortcutEvent *clone() const override

Protected Functions

QShortcutEvent(QShortcutEvent &&)
QShortcutEvent(const QShortcutEvent &)
QShortcutEvent &operator=(QShortcutEvent &&)
QShortcutEvent &operator=(const QShortcutEvent &other)

Protected Variables

bool m_ambiguous
QKeySequence m_sequence
int m_shortcutId

Detailed Description

Normally you do not need to use this class directly; QShortcut provides a higher-level interface to handle shortcut keys.

See also QShortcut.

Member Function Documentation

QShortcutEvent::QShortcutEvent(const QKeySequence &key, int id, bool ambiguous = false)

Constructs a shortcut event for the given key press, associated with the QShortcut ID id.

ambiguous specifies whether there is more than one QShortcut for the same key sequence.

[protected] QShortcutEvent::QShortcutEvent(QShortcutEvent &&)

Move-copy constructor.

[protected] QShortcutEvent::QShortcutEvent(const QShortcutEvent &)

Default constructs an instance of QShortcutEvent.

[protected] QShortcutEvent &QShortcutEvent::operator=(QShortcutEvent &&)

Move-assignment operator.

[protected] QShortcutEvent &QShortcutEvent::operator=(const QShortcutEvent &other)

Copy-assignment operator.

[override virtual] QShortcutEvent::~QShortcutEvent()

Destroys the instance of QShortcutEvent. The destructor is virtual.

[override virtual] QShortcutEvent *QShortcutEvent::clone() const

bool QShortcutEvent::isAmbiguous() const

Returns true if the key sequence that triggered the event is ambiguous.

See also QShortcut::activatedAmbiguously().

const QKeySequence &QShortcutEvent::key() const

Returns the key sequence that triggered the event.

int QShortcutEvent::shortcutId() const

Returns the ID of the QShortcut object for which this event was generated.

See also QShortcut::id().

Member Variable Documentation

bool QShortcutEvent::m_ambiguous

QKeySequence QShortcutEvent::m_sequence

int QShortcutEvent::m_shortcutId

© 2022 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.