本页内容

QShortcutEvent Class

QShortcutEvent 类提供了一个事件,该事件在用户按下组合键时触发。更多内容...

头文件: #include <QShortcutEvent>
CMake: find_package(Qt6 REQUIRED COMPONENTS Gui)
target_link_libraries(mytarget PRIVATE Qt6::Gui)
qmake: QT += gui
继承自: QEvent

公共函数

(since 6.5) QShortcutEvent(const QKeySequence &key, const QShortcut *shortcut = nullptr, bool ambiguous = false)
bool isAmbiguous() const
const QKeySequence &key() const

受保护函数

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

详细说明

通常情况下,您无需直接使用此类;QShortcut 提供了一个用于处理快捷键的高级接口。

另请参阅 QShortcut 。

成员函数文档

[since 6.5] QShortcutEvent::QShortcutEvent(const QKeySequence &key, const QShortcut *shortcut = nullptr, bool ambiguous = false)

为给定的key 按键组合构建一个快捷键事件,并将其关联到QShortcut shortcut 。

ambiguous 指定同一键序列是否存在多个QShortcut 。

该函数在 Qt 6.5 中引入。

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

通过Move构造一个QShortcutEvent 的实例。该函数已被删除。

bool QShortcutEvent::isAmbiguous() const

如果触发该事件的键序列存在歧义,则返回true 。

另请参阅 QShortcut::activatedAmbiguously()。

const QKeySequence &QShortcutEvent::key() const

返回触发该事件的键序列。

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

将other 按移动赋值方式赋值给此QShortcutEvent 实例。该函数已被删除。

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

将other 复制并赋值给此QShortcutEvent 实例。

© 2026 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.