Fix all categories unfold when one key binding is changed

(cherry picked from commit eda1e266c8)
This commit is contained in:
Alessandro 2018-03-23 23:02:38 +01:00 committed by Hein-Pieter van Braam
parent de66976ff0
commit 038c4d3a83
1 changed files with 15 additions and 1 deletions

View File

@ -199,6 +199,14 @@ void EditorSettingsDialog::_update_icons() {
void EditorSettingsDialog::_update_shortcuts() { void EditorSettingsDialog::_update_shortcuts() {
Map<String, bool> collapsed;
if (shortcuts->get_root() && shortcuts->get_root()->get_children()) {
for (TreeItem *item = shortcuts->get_root()->get_children(); item; item = item->get_next()) {
collapsed[item->get_text(0)] = item->is_collapsed();
}
}
shortcuts->clear(); shortcuts->clear();
List<String> slist; List<String> slist;
@ -223,7 +231,13 @@ void EditorSettingsDialog::_update_shortcuts() {
section = sections[section_name]; section = sections[section_name];
} else { } else {
section = shortcuts->create_item(root); section = shortcuts->create_item(root);
section->set_text(0, section_name.capitalize());
String item_name = section_name.capitalize();
section->set_text(0, item_name);
if (collapsed.has(item_name)) {
section->set_collapsed(collapsed[item_name]);
}
sections[section_name] = section; sections[section_name] = section;
section->set_custom_bg_color(0, get_color("prop_subsection", "Editor")); section->set_custom_bg_color(0, get_color("prop_subsection", "Editor"));