Trim a QLineEdit automatically: possible?
Question
I wanted to limit the input of QLineEdit
: no leading space. Is that possible ?
I shouldn't be using, e.g. the textEdited()
signal, right ?
Solution
You can use the editingFinished()
signal for that, it will be triggered when the text input loses focus or the user presses the enter key.
OTHER TIPS
Depending on your needs, also consider a validator - you can reject leading spaces from being entered at all, that way.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow