diff options
author | Mauro Carvalho Chehab <mchehab+huawei@kernel.org> | 2020-06-30 08:26:38 +0200 |
---|---|---|
committer | Masahiro Yamada <masahiroy@kernel.org> | 2020-07-01 23:59:30 +0900 |
commit | b06c3ec3bd184e8bbd3e37d53a3d27c4ab9ccd09 (patch) | |
tree | 45c8dd4c51def6ef7293a043fa45b4448d3fa4cf /scripts/kconfig/qconf.h | |
parent | c4f7398bee9c49bd79930d4a856fb6291d20cde3 (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.h')
-rw-r--r-- | scripts/kconfig/qconf.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h index a193137f2314..fb9e9729266f 100644 --- a/scripts/kconfig/qconf.h +++ b/scripts/kconfig/qconf.h @@ -45,11 +45,17 @@ class ConfigList : public QTreeWidget { public: ConfigList(ConfigView* p, const char *name = 0); void reinit(void); + ConfigItem* findConfigItem(struct menu *); ConfigView* parent(void) const { return (ConfigView*)Parent::parent(); } - ConfigItem* findConfigItem(struct menu *); + void setSelected(QTreeWidgetItem *item, bool enable) { + for (int i = 0; i < selectedItems().size(); i++) + selectedItems().at(i)->setSelected(false); + + item->setSelected(enable); + } protected: void keyPressEvent(QKeyEvent *e); |