LineEdit add member keep_editing_on_text_submit.

Allow users to exit edit mode when Enter is pressed.
This commit is contained in:
Mounir Tohami
2025-01-02 23:41:27 +02:00
parent aa8d9b83f6
commit e89c196a80
4 changed files with 21 additions and 5 deletions

View File

@@ -6,7 +6,7 @@
<description>
[LineEdit] provides an input field for editing a single line of text.
- When the [LineEdit] control is focused using the keyboard arrow keys, it will only gain focus and not enter edit mode.
- To enter edit mode, click on the control with the mouse or press the [code]ui_text_submit[/code] action (by default [kbd]Enter[/kbd] or [kbd]Kp Enter[/kbd]).
- To enter edit mode, click on the control with the mouse, see also [member keep_editing_on_text_submit].
- To exit edit mode, press [code]ui_text_submit[/code] or [code]ui_cancel[/code] (by default [kbd]Escape[/kbd]) actions.
- Check [method edit], [method unedit], [method is_editing], and [signal editing_toggled] for more information.
[b]Important:[/b]
@@ -80,7 +80,7 @@
<return type="void" />
<description>
Allows entering edit mode whether the [LineEdit] is focused or not.
Use [method Callable.call_deferred] if you want to enter edit mode on [signal text_submitted].
See also [member keep_editing_on_text_submit].
</description>
</method>
<method name="get_menu" qualifiers="const">
@@ -283,6 +283,9 @@
If [code]true[/code], the [LineEdit] doesn't display decoration.
</member>
<member name="focus_mode" type="int" setter="set_focus_mode" getter="get_focus_mode" overrides="Control" enum="Control.FocusMode" default="2" />
<member name="keep_editing_on_text_submit" type="bool" setter="set_keep_editing_on_text_submit" getter="is_editing_kept_on_text_submit" default="false">
If [code]true[/code], the [LineEdit] will not exit edit mode when text is submitted by pressing [code]ui_text_submit[/code] action (by default: [kbd]Enter[/kbd] or [kbd]Kp Enter[/kbd]).
</member>
<member name="language" type="String" setter="set_language" getter="get_language" default="&quot;&quot;">
Language code used for line-breaking and text shaping algorithms. If left empty, current locale is used instead.
</member>