Add max length to name

This commit is contained in:
Sofia 2026-07-24 04:27:09 +03:00
parent a29273bced
commit e78c300ba6
6 changed files with 7 additions and 5 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -53,6 +53,7 @@ text = "Name:"
[node name="text_edit" type="LineEdit" parent="v_box_container/h_box_container" unique_id=284528736]
custom_minimum_size = Vector2(150, 0)
layout_mode = 2
max_length = 20
[node name="players_label" type="Label" parent="v_box_container" unique_id=1537542117]
layout_mode = 2

View File

@ -103,19 +103,20 @@ impl IPanel for SettingsPanel {
slider.upcast::<Control>()
}
SettingValue::String(value) => {
let mut text_edit = LineEdit::new_alloc();
text_edit.set_custom_minimum_size(Vector2::new(100., -1.));
text_edit.set_text(value);
let mut line_edit = LineEdit::new_alloc();
line_edit.set_custom_minimum_size(Vector2::new(100., -1.));
line_edit.set_text(value);
line_edit.set_max_length(20);
let setting_clone = setting.clone();
text_edit
line_edit
.signals()
.text_changed()
.connect_other(self, move |s, v| {
s.on_change(setting_clone, SettingValue::String(v.to_string()));
});
text_edit.upcast()
line_edit.upcast()
}
};