Expand LineEdit from code

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By ejnij

LineEdit has an expand_to_text_length property, but it doesn’t work if the text was changed dynamically from code. I wasn’t able to replicate that functionality in code no matter what I did, so I’m asking for help!