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()信号,当文本输入失去焦点或用户按下回车键时,它将被触发。
editingFinished()
根据您的需要,还可以考虑使用验证器 - 您可以完全拒绝输入前导空格。