Skip to content

Commit

Permalink
fix: show the clear button of QKeySequenceEdit
Browse files Browse the repository at this point in the history
  • Loading branch information
ffiirree committed Nov 23, 2024
1 parent 231cbca commit 1981fb6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/setting/settingdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,11 @@ QWidget *SettingWindow::setupHotkeyWidget()
const auto updateHotkey = [=](const QString& name, QKeySequence& sequence) {
const auto edit = new QKeySequenceEdit(sequence);
edit->setMaximumSequenceLength(1);
edit->setClearButtonEnabled(true);
edit->findChildren<QAction *>()[0]->setIcon(QIcon::fromTheme("close-m"));
if (edit->findChild<QLineEdit *>())
edit->findChild<QLineEdit *>()->setContextMenuPolicy(Qt::NoContextMenu);
connect(edit, &QKeySequenceEdit::keySequenceChanged, [&](auto ks) {
connect(edit, &QKeySequenceEdit::keySequenceChanged, [&](auto& ks) {
sequence = ks;
App()->UpdateHotkeys();
});
Expand Down

0 comments on commit 1981fb6

Please sign in to comment.