summaryrefslogtreecommitdiff
path: root/scripts/kconfig/qconf.cc
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab+huawei@kernel.org>2020-06-30 08:26:38 +0200
committerMasahiro Yamada <masahiroy@kernel.org>2020-07-01 23:59:30 +0900
commitb06c3ec3bd184e8bbd3e37d53a3d27c4ab9ccd09 (patch)
tree45c8dd4c51def6ef7293a043fa45b4448d3fa4cf /scripts/kconfig/qconf.cc
parentc4f7398bee9c49bd79930d4a856fb6291d20cde3 (diff)
kconfig: qconf: re-implement setSelected()
The default implementation for setSelected() at QTreeWidgetItem allows multiple items to be selected. Well, this should never be possible for the configItem lists. So, implement a function that will automatically clean any previous selection. This simplifies the logic somewhat, while making the selection logic to be applied atomically, avoiding future issues on that. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Diffstat (limited to 'scripts/kconfig/qconf.cc')
-rw-r--r--scripts/kconfig/qconf.cc15
1 files changed, 4 insertions, 11 deletions
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index 1fddbdfa58b4..29ca4823cfb9 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -537,7 +537,7 @@ void ConfigList::setRootMenu(struct menu *menu)
rootEntry = menu;
updateListAll();
if (currentItem()) {
- currentItem()->setSelected(hasFocus());
+ setSelected(currentItem(), hasFocus());
scrollToItem(currentItem());
}
}
@@ -865,7 +865,7 @@ void ConfigList::focusInEvent(QFocusEvent *e)
ConfigItem* item = (ConfigItem *)currentItem();
if (item) {
- item->setSelected(true);
+ setSelected(item, true);
menu = item->menu;
}
emit gotFocus(menu);
@@ -1711,17 +1711,10 @@ void ConfigMainWindow::setMenuLink(struct menu *menu)
if (!parent)
return;
- /* Clear an already-selected item */
- if (!configList->selectedItems().isEmpty()) {
- item = (ConfigItem*)configList->selectedItems().first();
- if (item)
- item->setSelected(false);
- }
-
/* Select the config view */
item = configList->findConfigItem(parent);
if (item) {
- item->setSelected(true);
+ configList->setSelected(item, true);
configList->scrollToItem(item);
}
@@ -1740,7 +1733,7 @@ void ConfigMainWindow::setMenuLink(struct menu *menu)
if (list) {
item = list->findConfigItem(menu);
if (item) {
- item->setSelected(true);
+ list->setSelected(item, true);
list->scrollToItem(item);
list->setFocus();
}