kconfig qconf: Add grey background for hidden options
PATCH 1/1 kconfig qconf: Add grey background for hidden options
This is useful to see which configuration parameters can be edited or not when "Show All Options" is enabled.
--- scripts/kconfig/qconf.cc | 7 +++++++ scripts/kconfig/qconf.h | 4 ++++ 2 files changed, 11 insertions(+)
scripts/kconfig/qconf.cc +7 -0
@@ -208,6 +208,13 @@ void ConfigItem::updateMenu(void) } if (!sym_has_value(sym) && visible) prompt += " (NEW)"; + + if(!visible) { + setBackground(promptColIdx, QBrush(QColor("#E0E0E0"))); + } else { + setBackground(promptColIdx, QBrush()); + } + set_prompt: setText(promptColIdx, prompt); }
scripts/kconfig/qconf.h +4 -0
@@ -174,6 +174,10 @@ class ConfigItem : public QTreeWidgetItem { { return Parent::text(idx); } + void setBackground(colIdx idx, const QBrush& brush) + { + Parent::setBackground(idx, brush); + } void setPixmap(colIdx idx, const QIcon &icon) { Parent::setIcon(idx, icon);
Signature · 1 line
2.27.0
Quoted 9 lines · Maxime Chretien
This is useful to see which configuration parameters can be edited or not when "Show All Options" is enabled.
Signed-off-by Maxime Chretien <[email protected]>--- scripts/kconfig/qconf.cc | 7 +++++++ scripts/kconfig/qconf.h | 4 ++++ 2 files changed, 11 insertions(+)
I like the idea, but
maybe this patch could be improved?
For example, in the following test code, BAR is correctly painted grey when CONFIG_FOO=n, but "my menu" is always white despite of "depends on FOO"
----(test code)------
config FOO
bool "foo"
config BAR
bool "bar"
depends on FOO
menu "my menu"
depends on FOO
endmenu
-------(test code end)----
Quoted 5 lines
scripts/kconfig/qconf.cc +0
-0
scripts/kconfig/qconf.cc void ConfigItem::updateMenu(void) · line 217
Quoted 10 lines
scripts/kconfig/qconf.cc +7
-0@@ -208,6 +208,13 @@ void ConfigItem::updateMenu(void) } if (!sym_has_value(sym) && visible) prompt += " (NEW)"; + + if(!visible) { + setBackground(promptColIdx, QBrush(QColor("#E0E0E0"))); + } else { + setBackground(promptColIdx, QBrush()); + } +
I think all the columns should be grey-grounded. Please note you can click other columns to toggle y/m/n.
How about something like this?
QBrush brush;
if (visible)
brush = QBrush()
else
brush = QBrush(QColor("#E0E0E0"));setBackground(promptColIdx, brush);setBackground(nameColIdx, brush);setBackground(noColIdx, brush);setBackground(modColIdx, brush);setBackground(yesColIdx, brush);setBackground(dataColIdx, brush);
Quoted 8 lines
scripts/kconfig/qconf.cc +0
-0set_prompt: setText(promptColIdx, prompt); }scripts/kconfig/qconf.h +0
-0
scripts/kconfig/qconf.h class ConfigItem : public QTreeWidgetItem { · line 180
Quoted 7 lines
scripts/kconfig/qconf.h +4
-0@@ -174,6 +174,10 @@ class ConfigItem : public QTreeWidgetItem { { return Parent::text(idx); } + void setBackground(colIdx idx, const QBrush& brush) + { + Parent::setBackground(idx, brush); + }
I do not understand why this wrapper is useful...
Quoted 6 lines
scripts/kconfig/qconf.h +0
-1void setPixmap(colIdx idx, const QIcon &icon) { Parent::setIcon(idx, icon); --2.27.0
Signature · 2 lines
Best Regards Masahiro Yamada
Quoted 27 lines · Masahiro Yamada
Quoted 8 lines · Maxime Chretien
This is useful to see which configuration parameters can be edited or not when "Show All Options" is enabled.
Signed-off-by Maxime Chretien<[email protected]>--- scripts/kconfig/qconf.cc | 7 +++++++ scripts/kconfig/qconf.h | 4 ++++ 2 files changed, 11 insertions(+)I like the idea, but
maybe this patch could be improved?For example, in the following test code, BAR is correctly painted grey when
CONFIG_FOO=n, but "my menu" is always white despite of "depends on FOO"----(test code)------
config FOO
bool "foo"config BAR
bool "bar"
depends on FOO
Quoted 6 lines
menu "my menu"
depends on FOOendmenu
-------(test code end)----
It could probably be improved.
Maybe the "visible" state of the menu can be changed or maybe we should use another element in the test to grey out menus that needs to be greyed out.
Quoted 29 lines
Quoted 5 lines
scripts/kconfig/qconf.cc +0
-0scripts/kconfig/qconf.cc void ConfigItem::updateMenu(void) · line 217
Quoted 10 lines
scripts/kconfig/qconf.cc +7
-0@@ -208,6 +208,13 @@ void ConfigItem::updateMenu(void) } if (!sym_has_value(sym) && visible) prompt += " (NEW)"; + + if(!visible) { + setBackground(promptColIdx, QBrush(QColor("#E0E0E0"))); + } else { + setBackground(promptColIdx, QBrush()); + } +I think all the columns should be grey-grounded. Please note you can click other columns to toggle y/m/n.
How about something like this?
QBrush brush;
if (visible)
brush =QBrush()
else
Quoted 8 lines
brush = QBrush(QColor("#E0E0E0"));
setBackground(promptColIdx, brush);setBackground(nameColIdx, brush);setBackground(noColIdx, brush);setBackground(modColIdx, brush);setBackground(yesColIdx, brush);setBackground(dataColIdx, brush);
Yes I agree should be better like that so that we can see what's grey or not even if we have scrolled far from the first column.
Quoted 19 lines
Quoted 10 lines
scripts/kconfig/qconf.cc +0
-0set_prompt: setText(promptColIdx, prompt); }scripts/kconfig/qconf.h +0
-0scripts/kconfig/qconf.h class ConfigItem : public QTreeWidgetItem { · line 180
Quoted 7 lines
scripts/kconfig/qconf.h +4
-0@@ -174,6 +174,10 @@ class ConfigItem : public QTreeWidgetItem { { return Parent::text(idx); } + void setBackground(colIdx idx, const QBrush& brush) + { + Parent::setBackground(idx, brush); + }I do not understand why this wrapper is useful...
Well we need to use "Parent" to have access to the "setBackground" function and I thought it was the way to use it has it's done with "setPixmap" just under it.
Maybe there is a better way to do that, I'm a beginner in linux development so I'm not totally aware of all the rules and ways to add new things.
Quoted 6 lines
Quoted 6 lines
scripts/kconfig/qconf.h +0
-1void setPixmap(colIdx idx, const QIcon &icon) { Parent::setIcon(idx, icon); --2.27.0
Thanks for reviewing this.
Best regards
Maxime Chretien