From 2dde56d8c0e01cc5d7d2f4185f8cf6a706b549ff Mon Sep 17 00:00:00 2001 From: Tsu Jan Date: Sun, 1 Nov 2020 00:17:46 +0330 Subject: [PATCH] Fixed shortcut setting when the Key column is sorted The bug was very old. I noticed it by chance. Fixes https://github.com/lxqt/qterminal/issues/729 --- src/propertiesdialog.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/propertiesdialog.cpp b/src/propertiesdialog.cpp index f4337dc4..4bd31f5b 100644 --- a/src/propertiesdialog.cpp +++ b/src/propertiesdialog.cpp @@ -391,7 +391,12 @@ void PropertiesDialog::saveShortcuts() const QString& keyValue = shortcutKeys.at(x); QAction *keyAction = actions[keyValue]; - QTableWidgetItem *item = shortcutsWidget->item(x, 1); + QTableWidgetItem *item = nullptr; + auto items = shortcutsWidget->findItems(tr(keyValue.toStdString().c_str()), Qt::MatchExactly); + if (!items.isEmpty()) + item = shortcutsWidget->item(shortcutsWidget->row(items.at(0)), 1); + if (item == nullptr) + continue; QList shortcuts; const auto sequences = item->text().split(QLatin1Char('|'));