[PATCH v2 2/5] kconfig: qconf: ensure that only one item will be highlighted

From: Mauro Carvalho Chehab
Date: Mon Jun 29 2020 - 17:36:19 EST


The logic which is used by search to show a new link lacks
support for un-selecting a previously-selected item.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@xxxxxxxxxx>
---
scripts/kconfig/qconf.cc | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index 0e06afa08908..67dac2406a98 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -1662,6 +1662,13 @@ void ConfigMainWindow::setMenuLink(struct menu *menu)
}

if (list) {
+ /* Clear an already-selected item */
+ if (!list->selectedItems().isEmpty()) {
+ item = (ConfigItem*)list->selectedItems().first();
+ if (item)
+ item->setSelected(false);
+ }
+
item = list->findConfigItem(menu);
if (item) {
item->setSelected(true);
--
2.26.2