qt: Clear finishing key combinations for hot key entry on Qt 6.5+ (#6509)

This commit is contained in:
Steveice10 2023-05-09 02:30:06 -07:00 committed by GitHub
parent b9d644b777
commit 3a27603e3d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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) {