Fix LineEdit center and right alignment

(cherry picked from commit 64fcf7ee77)
This commit is contained in:
Haoyu Qiu 2022-01-16 20:24:25 +08:00 committed by Rémi Verschelde
parent cd016ea0b1
commit fa709e7169
No known key found for this signature in database
GPG Key ID: C3336907360768E1

View File

@ -684,8 +684,8 @@ bool LineEdit::_is_over_clear_button(const Point2 &p_pos) const {
void LineEdit::_notification(int p_what) { void LineEdit::_notification(int p_what) {
switch (p_what) { switch (p_what) {
#ifdef TOOLS_ENABLED
case NOTIFICATION_ENTER_TREE: { case NOTIFICATION_ENTER_TREE: {
#ifdef TOOLS_ENABLED
if (Engine::get_singleton()->is_editor_hint() && !get_tree()->is_node_being_edited(this)) { if (Engine::get_singleton()->is_editor_hint() && !get_tree()->is_node_being_edited(this)) {
cursor_set_blink_enabled(EDITOR_DEF("text_editor/cursor/caret_blink", false)); cursor_set_blink_enabled(EDITOR_DEF("text_editor/cursor/caret_blink", false));
cursor_set_blink_speed(EDITOR_DEF("text_editor/cursor/caret_blink_speed", 0.65)); cursor_set_blink_speed(EDITOR_DEF("text_editor/cursor/caret_blink_speed", 0.65));
@ -694,8 +694,15 @@ void LineEdit::_notification(int p_what) {
EditorSettings::get_singleton()->connect("settings_changed", this, "_editor_settings_changed"); EditorSettings::get_singleton()->connect("settings_changed", this, "_editor_settings_changed");
} }
} }
} break;
#endif #endif
update_cached_width();
update_placeholder_width();
} break;
case NOTIFICATION_THEME_CHANGED: {
update_cached_width();
update_placeholder_width();
update();
} break;
case NOTIFICATION_RESIZED: { case NOTIFICATION_RESIZED: {
scroll_offset = 0; scroll_offset = 0;
set_cursor_position(get_cursor_position()); set_cursor_position(get_cursor_position());