Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
の入力を制限したかったQLineEdit: 先頭のスペースはありません。それは可能ですか?
QLineEdit
textEdited()たとえば、信号を使用するべきではありませんよね?
textEdited()
そのための信号を使用できますeditingFinished()。テキスト入力がフォーカスを失ったとき、またはユーザーがEnterキーを押したときにトリガーされます。
editingFinished()
必要に応じて、バリデーターも検討してください。そのようにして、先頭のスペースの入力をまったく拒否できます。