QKeySequenceEdit 小部件允許輸入 QKeySequence . 更多...
| 頭: | #include <QKeySequenceEdit> |
| CMake: |
find_package(Qt6 REQUIRED COMPONENTS Widgets)
target_link_libraries(mytarget PRIVATE Qt6::Widgets) |
| qmake: | QT += widgets |
| 繼承: | QWidget |
| 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 |
This widget lets the user choose a QKeySequence , which is usually used as a shortcut. The recording is initiated when the widget receives the focus and ends one second after the user releases the last key.
另請參閱 QKeySequenceEdit::keySequence .
[since 6.4]
clearButtonEnabled
:
bool
This property holds whether the key sequence edit displays a clear button when it is not empty.
If enabled, the key sequence edit displays a trailing clear 按鈕 (當它包含一些文本時),否則,行編輯不展示清零按鈕 (默認)。
This property was introduced in Qt 6.4.
訪問函數:
| bool | isClearButtonEnabled () const |
| void | setClearButtonEnabled (bool enable ) |
[since 6.5]
finishingKeyCombinations
:
QList
<
QKeyCombination
>
This property holds the list of key combinations that finish editing the key sequences.
Any combination in the list will finish the editing of key sequences. All other key combinations can be recorded as part of a key sequence. By default, Qt::Key_Tab and Qt::Key_Backtab will finish recording the key sequence.
This property was introduced in Qt 6.5.
訪問函數:
| QList<QKeyCombination> | finishingKeyCombinations () const |
| void | setFinishingKeyCombinations (const QList<QKeyCombination> & finishingKeyCombinations ) |
This property contains the currently chosen key sequence.
The shortcut can be changed by the user or via setter function.
注意: 若 QKeySequence is longer than the maximumSequenceLength property, the key sequence is truncated.
訪問函數:
| QKeySequence | keySequence () const |
| void | setKeySequence (const QKeySequence & keySequence ) |
通知程序信號:
| void | keySequenceChanged (const QKeySequence & keySequence ) |
[since 6.5]
maximumSequenceLength
:
qsizetype
This property holds the maximum sequence length.
The maximum number of key sequences a user can enter. The value needs to be between 1 and 4, with 4 being the default.
This property was introduced in Qt 6.5.
訪問函數:
| qsizetype | maximumSequenceLength () const |
| void | setMaximumSequenceLength (qsizetype count ) |
[explicit]
QKeySequenceEdit::
QKeySequenceEdit
(
QWidget
*
parent
= nullptr)
Constructs a QKeySequenceEdit widget with the given parent .
[explicit]
QKeySequenceEdit::
QKeySequenceEdit
(const
QKeySequence
&
keySequence
,
QWidget
*
parent
= nullptr)
Constructs a QKeySequenceEdit widget with the given keySequence and parent .
[虛擬]
QKeySequenceEdit::
~QKeySequenceEdit
()
銷毀 QKeySequenceEdit 對象。
[slot]
void
QKeySequenceEdit::
clear
()
Clears the current key sequence.
[signal]
void
QKeySequenceEdit::
editingFinished
()
This signal is emitted when the user finishes entering the shortcut.
注意: there is a one second delay before releasing the last key and emitting this signal.
[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).