QShortcutEvent Class

QShortcutEvent 类提供了当用户按下组合键时生成的事件。更多

头文件: #include <QShortcutEvent>
CMake.QShortcutEvent 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

详细说明

通常情况下,您不需要直接使用该类;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 中引入。

bool QShortcutEvent::isAmbiguous() const

如果触发事件的按键序列不明确,则返回true

另请参阅 QShortcut::activatedAmbiguously()。

const QKeySequence &QShortcutEvent::key() const

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

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