I have a QLineEdit
and i want to restrict QLineEdit
to accept only integers. It should work like inputmask. But I dont want to use inputmask
, because if user clicks on QLineEdit
cursor will be at the position where mouse was clicked. and user need to navigate to 0 position and type what eve he wants.
Is there any alternate for this.
you can use QValidator it works like:
#To allow only int
self.onlyInt = QIntValidator()
self.LineEdit.setValidator(self.onlyInt)