I use validators to filter user input. Normally I have my validators working like this:
my_reg_ex = QRegExp("[1-9]\d{0,5}")
my_validator = QRegExpValidator(my_reg_ex, self.ui.lineEdit_test)
self.ui.lineEdit_test.setValidator(my_validator)
I wrote this after looking at some examples online. But I just noticed that if I remove the last part on the second line:
, self.ui.lineEdit_test
The code works exactly the same. I have a couple of these validators all around. I was wondering if it's okay to just use it without the part I mentioned. For example:
my_reg_ex = QRegExp("[1-9]\d{0,5}")
my_validator = QRegExpValidator(my_reg_ex)
self.ui.lineEdit_test.setValidator(my_validator)
Is there any difference between these? If there is please explain and tell me which one is the better way to go.