Skip to content

Commit 7cf218e

Browse files
committed
Merge pull request #112299 from YeldhamDev/inspector_theme_signal_fix
Make `EditorInspectorCategory`'s theme update happen via signal
2 parents c95a2e3 + 8e94bfe commit 7cf218e

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

editor/inspector/editor_inspector.cpp

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1695,6 +1695,10 @@ void EditorInspectorCategory::_bind_methods() {
16951695

16961696
void EditorInspectorCategory::_notification(int p_what) {
16971697
switch (p_what) {
1698+
case NOTIFICATION_POSTINITIALIZE: {
1699+
connect(SceneStringName(theme_changed), callable_mp(this, &EditorInspectorCategory::_theme_changed));
1700+
} break;
1701+
16981702
case NOTIFICATION_ACCESSIBILITY_UPDATE: {
16991703
RID ae = get_accessibility_element();
17001704
ERR_FAIL_COND(ae.is_null());
@@ -1708,13 +1712,6 @@ void EditorInspectorCategory::_notification(int p_what) {
17081712
DisplayServer::get_singleton()->accessibility_update_add_action(ae, DisplayServer::AccessibilityAction::ACTION_SHOW_CONTEXT_MENU, callable_mp(this, &EditorInspectorCategory::_accessibility_action_menu));
17091713
} break;
17101714

1711-
case NOTIFICATION_THEME_CHANGED: {
1712-
EditorInspector::initialize_category_theme(theme_cache, this);
1713-
menu_icon_dirty = true;
1714-
_update_icon();
1715-
update_minimum_size();
1716-
} break;
1717-
17181715
case NOTIFICATION_TRANSLATION_CHANGED: {
17191716
if (is_favorite) {
17201717
label = TTR("Favorites");
@@ -1897,6 +1894,13 @@ void EditorInspectorCategory::_update_icon() {
18971894
}
18981895
}
18991896

1897+
void EditorInspectorCategory::_theme_changed() {
1898+
// This needs to be done via the signal, as it's fired before the minimum since is updated.
1899+
EditorInspector::initialize_category_theme(theme_cache, this);
1900+
menu_icon_dirty = true;
1901+
_update_icon();
1902+
}
1903+
19001904
void EditorInspectorCategory::gui_input(const Ref<InputEvent> &p_event) {
19011905
const Ref<InputEventMouseButton> &mb = p_event;
19021906
if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MouseButton::RIGHT) {

editor/inspector/editor_inspector.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,7 @@ class EditorInspectorCategory : public Control {
412412
void _handle_menu_option(int p_option);
413413
void _popup_context_menu(const Point2i &p_position);
414414
void _update_icon();
415+
void _theme_changed();
415416

416417
protected:
417418
static void _bind_methods();

0 commit comments

Comments
 (0)