summaryrefslogtreecommitdiffstats
path: root/editor/editor_sectioned_inspector.cpp
diff options
context:
space:
mode:
authorHaoyu Qiu <timothyqiu32@gmail.com>2024-09-21 21:11:58 +0800
committerHaoyu Qiu <timothyqiu32@gmail.com>2024-09-21 21:15:46 +0800
commit267bb982319c5dbd0c5341bd85f6319b873db6d2 (patch)
tree388883338c03381c528a79bbc1e06cbecc0e4600 /editor/editor_sectioned_inspector.cpp
parente4e024ab88efe74677769395886bc1b09eccbac7 (diff)
downloadredot-engine-267bb982319c5dbd0c5341bd85f6319b873db6d2.tar.gz
Keep advanced toggle on when searching for settings
Diffstat (limited to 'editor/editor_sectioned_inspector.cpp')
-rw-r--r--editor/editor_sectioned_inspector.cpp33
1 files changed, 26 insertions, 7 deletions
diff --git a/editor/editor_sectioned_inspector.cpp b/editor/editor_sectioned_inspector.cpp
index bc7bfcfa58..27cbb9810c 100644
--- a/editor/editor_sectioned_inspector.cpp
+++ b/editor/editor_sectioned_inspector.cpp
@@ -30,10 +30,12 @@
#include "editor_sectioned_inspector.h"
+#include "editor/editor_inspector.h"
#include "editor/editor_property_name_processor.h"
-#include "editor/editor_settings.h"
#include "editor/editor_string_names.h"
#include "editor/themes/editor_scale.h"
+#include "scene/gui/check_button.h"
+#include "scene/gui/tree.h"
static bool _property_path_matches(const String &p_property_path, const String &p_filter, EditorPropertyNameProcessor::Style p_style) {
if (p_property_path.containsn(p_filter)) {
@@ -307,18 +309,35 @@ void SectionedInspector::register_search_box(LineEdit *p_box) {
search_box->connect(SceneStringName(text_changed), callable_mp(this, &SectionedInspector::_search_changed));
}
+void SectionedInspector::register_advanced_toggle(CheckButton *p_toggle) {
+ advanced_toggle = p_toggle;
+ advanced_toggle->connect(SceneStringName(toggled), callable_mp(this, &SectionedInspector::_advanced_toggled));
+ _advanced_toggled(advanced_toggle->is_pressed());
+}
+
void SectionedInspector::_search_changed(const String &p_what) {
+ if (advanced_toggle) {
+ if (p_what.is_empty()) {
+ advanced_toggle->set_pressed_no_signal(!restrict_to_basic);
+ advanced_toggle->set_disabled(false);
+ advanced_toggle->set_tooltip_text(String());
+ } else {
+ advanced_toggle->set_pressed_no_signal(true);
+ advanced_toggle->set_disabled(true);
+ advanced_toggle->set_tooltip_text(TTR("Advanced settings are always shown when searching."));
+ }
+ }
update_category_list();
}
-EditorInspector *SectionedInspector::get_inspector() {
- return inspector;
+void SectionedInspector::_advanced_toggled(bool p_toggled_on) {
+ restrict_to_basic = !p_toggled_on;
+ update_category_list();
+ inspector->set_restrict_to_basic_settings(restrict_to_basic);
}
-void SectionedInspector::set_restrict_to_basic_settings(bool p_restrict) {
- restrict_to_basic = p_restrict;
- update_category_list();
- inspector->set_restrict_to_basic_settings(p_restrict);
+EditorInspector *SectionedInspector::get_inspector() {
+ return inspector;
}
SectionedInspector::SectionedInspector() :