I have a QLineEdit for Date in mm/dd/yyyy format. I am getting input using the keyboard and not using QDateEdit because of the requirement. And when the lineEdit comes to view, it has to show to the user the current date. I need the following for the lineEdit.
- I need the two slashes always to be displayed and the cursor has to skip while entering or deleting.
- I should not allow the user to enter an invalid date i.e while entering itself the
lineEditshould not get invalid numbers. - I have to set the current date as the default text when the
lineEditcomes to view.
For the first point, I tried using setInputMask("99/99/9999") but with this I can't set the current date using setText(). And how to use QRegExp to not to allow lineEdit get an invalid number while employing setInputMask()?