mirror of
https://github.com/godotengine/godot.git
synced 2025-12-08 06:09:55 +00:00
Make EditorInspectorCategory's theme update happen via signal
This commit is contained in:
parent
0fdbf050e0
commit
8e94bfef53
2 changed files with 12 additions and 7 deletions
|
|
@ -1695,6 +1695,10 @@ void EditorInspectorCategory::_bind_methods() {
|
|||
|
||||
void EditorInspectorCategory::_notification(int p_what) {
|
||||
switch (p_what) {
|
||||
case NOTIFICATION_POSTINITIALIZE: {
|
||||
connect(SceneStringName(theme_changed), callable_mp(this, &EditorInspectorCategory::_theme_changed));
|
||||
} break;
|
||||
|
||||
case NOTIFICATION_ACCESSIBILITY_UPDATE: {
|
||||
RID ae = get_accessibility_element();
|
||||
ERR_FAIL_COND(ae.is_null());
|
||||
|
|
@ -1708,13 +1712,6 @@ void EditorInspectorCategory::_notification(int p_what) {
|
|||
DisplayServer::get_singleton()->accessibility_update_add_action(ae, DisplayServer::AccessibilityAction::ACTION_SHOW_CONTEXT_MENU, callable_mp(this, &EditorInspectorCategory::_accessibility_action_menu));
|
||||
} break;
|
||||
|
||||
case NOTIFICATION_THEME_CHANGED: {
|
||||
EditorInspector::initialize_category_theme(theme_cache, this);
|
||||
menu_icon_dirty = true;
|
||||
_update_icon();
|
||||
update_minimum_size();
|
||||
} break;
|
||||
|
||||
case NOTIFICATION_TRANSLATION_CHANGED: {
|
||||
if (is_favorite) {
|
||||
label = TTR("Favorites");
|
||||
|
|
@ -1897,6 +1894,13 @@ void EditorInspectorCategory::_update_icon() {
|
|||
}
|
||||
}
|
||||
|
||||
void EditorInspectorCategory::_theme_changed() {
|
||||
// This needs to be done via the signal, as it's fired before the minimum since is updated.
|
||||
EditorInspector::initialize_category_theme(theme_cache, this);
|
||||
menu_icon_dirty = true;
|
||||
_update_icon();
|
||||
}
|
||||
|
||||
void EditorInspectorCategory::gui_input(const Ref<InputEvent> &p_event) {
|
||||
const Ref<InputEventMouseButton> &mb = p_event;
|
||||
if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MouseButton::RIGHT) {
|
||||
|
|
|
|||
|
|
@ -412,6 +412,7 @@ class EditorInspectorCategory : public Control {
|
|||
void _handle_menu_option(int p_option);
|
||||
void _popup_context_menu(const Point2i &p_position);
|
||||
void _update_icon();
|
||||
void _theme_changed();
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue