Skip to content

Commit c3bf96e

Browse files
committed
Make EditorInspectorCategory's theme update happen via signal
1 parent 0fdbf05 commit c3bf96e

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

editor/inspector/editor_inspector.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1708,13 +1708,6 @@ void EditorInspectorCategory::_notification(int p_what) {
17081708
DisplayServer::get_singleton()->accessibility_update_add_action(ae, DisplayServer::AccessibilityAction::ACTION_SHOW_CONTEXT_MENU, callable_mp(this, &EditorInspectorCategory::_accessibility_action_menu));
17091709
} break;
17101710

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-
17181711
case NOTIFICATION_TRANSLATION_CHANGED: {
17191712
if (is_favorite) {
17201713
label = TTR("Favorites");
@@ -1897,6 +1890,13 @@ void EditorInspectorCategory::_update_icon() {
18971890
}
18981891
}
18991892

1893+
void EditorInspectorCategory::_theme_changed() {
1894+
// This needs to be done via the signal, as it's fired before the minimum since is updated.
1895+
EditorInspector::initialize_category_theme(theme_cache, this);
1896+
menu_icon_dirty = true;
1897+
_update_icon();
1898+
}
1899+
19001900
void EditorInspectorCategory::gui_input(const Ref<InputEvent> &p_event) {
19011901
const Ref<InputEventMouseButton> &mb = p_event;
19021902
if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MouseButton::RIGHT) {
@@ -1906,6 +1906,8 @@ void EditorInspectorCategory::gui_input(const Ref<InputEvent> &p_event) {
19061906

19071907
EditorInspectorCategory::EditorInspectorCategory() {
19081908
set_focus_mode(FOCUS_ACCESSIBILITY);
1909+
1910+
connect(SceneStringName(theme_changed), callable_mp(this, &EditorInspectorCategory::_theme_changed));
19091911
}
19101912

19111913
////////////////////////////////////////////////

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)