QKeySequenceEdit Class
QKeySequenceEdit 小工具允许输入QKeySequence... 更多...
头文件: | #include <QKeySequenceEdit> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS Widgets) target_link_libraries(mytarget PRIVATE Qt6::Widgets) |
qmake: | QT += widgets |
继承: | QWidget |
属性
(since 6.4)
clearButtonEnabled : bool(since 6.5)
finishingKeyCombinations : QList<QKeyCombination>- keySequence : QKeySequence
(since 6.5)
maximumSequenceLength : qsizetype
公共功能
QKeySequenceEdit(QWidget *parent = nullptr) | |
QKeySequenceEdit(const QKeySequence &keySequence, QWidget *parent = nullptr) | |
virtual | ~QKeySequenceEdit() |
QList<QKeyCombination> | finishingKeyCombinations() const |
bool | isClearButtonEnabled() const |
QKeySequence | keySequence() const |
qsizetype | maximumSequenceLength() const |
void | setClearButtonEnabled(bool enable) |
void | setFinishingKeyCombinations(const QList<QKeyCombination> &finishingKeyCombinations) |
公共插槽
void | clear() |
void | setKeySequence(const QKeySequence &keySequence) |
void | setMaximumSequenceLength(qsizetype count) |
信号
void | editingFinished() |
void | keySequenceChanged(const QKeySequence &keySequence) |
重新实现的受保护函数
virtual bool | event(QEvent *e) override |
virtual void | focusOutEvent(QFocusEvent *e) override |
virtual void | keyPressEvent(QKeyEvent *e) override |
virtual void | keyReleaseEvent(QKeyEvent *e) override |
virtual void | timerEvent(QTimerEvent *e) override |
详细说明
该窗口小部件可让用户选择QKeySequence ,通常用作快捷键。当窗口小部件收到焦点时开始录音,并在用户松开最后一个键一秒后结束。
另请参阅 QKeySequenceEdit::keySequence 。
属性文档
[since 6.4]
clearButtonEnabled : bool
此属性表示键序编辑器在不为空时是否显示清除按钮。
如果启用,键序编辑器在包含某些文本时会显示尾部的清除按钮,否则行编辑器不会显示清除按钮(默认)。
此属性在 Qt 6.4 中引入。
访问函数:
bool | isClearButtonEnabled() const |
void | setClearButtonEnabled(bool enable) |
[since 6.5]
finishingKeyCombinations : QList<QKeyCombination>
该属性包含完成按键序列编辑的按键组合列表。
列表中的任何组合键都将完成按键序列的编辑。所有其他组合键都可以作为按键序列的一部分进行记录。默认情况下,Qt::Key_Tab 和Qt::Key_Backtab 将完成按键序列的记录。
此属性在 Qt 6.5 中引入。
访问功能:
QList<QKeyCombination> | finishingKeyCombinations() const |
void | setFinishingKeyCombinations(const QList<QKeyCombination> &finishingKeyCombinations) |
keySequence : QKeySequence
该属性包含当前选择的按键序列。
快捷键可由用户或通过设置函数更改。
注意: 如果QKeySequence 比maximumSequenceLength 属性长,按键序列将被截断。
访问功能:
QKeySequence | keySequence() const |
void | setKeySequence(const QKeySequence &keySequence) |
通知信号:
void | keySequenceChanged(const QKeySequence &keySequence) |
[since 6.5]
maximumSequenceLength : qsizetype
该属性包含最大序列长度。
用户可输入的最大按键序列数。该值应介于 1 和 4 之间,默认值为 4。
此属性在 Qt 6.5 中引入。
访问函数:
qsizetype | maximumSequenceLength() const |
void | setMaximumSequenceLength(qsizetype count) |
成员函数文档
[explicit]
QKeySequenceEdit::QKeySequenceEdit(QWidget *parent = nullptr)
用给定的parent 构建一个 QKeySequenceEdit widget。
[explicit]
QKeySequenceEdit::QKeySequenceEdit(const QKeySequence &keySequence, QWidget *parent = nullptr)
用给定的keySequence 和parent 构建一个 QKeySequenceEdit widget。
[virtual noexcept]
QKeySequenceEdit::~QKeySequenceEdit()
销毁QKeySequenceEdit 对象。
[slot]
void QKeySequenceEdit::clear()
清除当前按键序列。
[signal]
void QKeySequenceEdit::editingFinished()
当用户输入完快捷键时会发出该信号。
注意: 在释放最后一个按键和发出此信号之前会有一秒钟的延迟。
[override virtual protected]
bool QKeySequenceEdit::event(QEvent *e)
重实现:QWidget::event(QEvent *event).
[override virtual protected]
void QKeySequenceEdit::focusOutEvent(QFocusEvent *e)
重实现:QWidget::focusOutEvent(QFocusEvent *event).
[override virtual protected]
void QKeySequenceEdit::keyPressEvent(QKeyEvent *e)
重实现:QWidget::keyPressEvent(QKeyEvent *event).
[override virtual protected]
void QKeySequenceEdit::keyReleaseEvent(QKeyEvent *e)
重实现:QWidget::keyReleaseEvent(QKeyEvent *event).
[override virtual protected]
void QKeySequenceEdit::timerEvent(QTimerEvent *e)
重实现:QObject::timerEvent(QTimerEvent *event).
© 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.