qt: Clear finishing key combinations for hot key entry on Qt 6.5+ (#6509)
This commit is contained in:
parent
b9d644b777
commit
3a27603e3d
1 changed files with 8 additions and 0 deletions
|
@ -11,6 +11,10 @@ SequenceDialog::SequenceDialog(QWidget* parent) : QDialog(parent) {
|
||||||
setWindowTitle(tr("Enter a hotkey"));
|
setWindowTitle(tr("Enter a hotkey"));
|
||||||
|
|
||||||
key_sequence = new QKeySequenceEdit;
|
key_sequence = new QKeySequenceEdit;
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
|
||||||
|
key_sequence->setMaximumSequenceLength(1);
|
||||||
|
key_sequence->setFinishingKeyCombinations({});
|
||||||
|
#endif
|
||||||
|
|
||||||
auto* const buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
auto* const buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
||||||
buttons->setCenterButtons(true);
|
buttons->setCenterButtons(true);
|
||||||
|
@ -26,8 +30,12 @@ SequenceDialog::SequenceDialog(QWidget* parent) : QDialog(parent) {
|
||||||
SequenceDialog::~SequenceDialog() = default;
|
SequenceDialog::~SequenceDialog() = default;
|
||||||
|
|
||||||
QKeySequence SequenceDialog::GetSequence() {
|
QKeySequence SequenceDialog::GetSequence() {
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
|
||||||
|
return key_sequence->keySequence();
|
||||||
|
#else
|
||||||
// Only the first key is returned. The other 3, if present, are ignored.
|
// Only the first key is returned. The other 3, if present, are ignored.
|
||||||
return QKeySequence(key_sequence->keySequence()[0]);
|
return QKeySequence(key_sequence->keySequence()[0]);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SequenceDialog::focusNextPrevChild(bool next) {
|
bool SequenceDialog::focusNextPrevChild(bool next) {
|
||||||
|
|
Loading…
Reference in a new issue