I have a QLineEdit
where the user should input only numbers.
So is there a numbers-only setting for QLineEdit
?
You could also set an inputMask:
QLineEdit.setInputMask("9")
This allows the user to type only one digit ranging from 0
to 9
. Use multiple 9
's to allow the user to enter multiple numbers. See also the complete list of characters that can be used in an input mask.
(My answer is in Python, but it should not be hard to transform it to C++)