abernat
18th February 2009, 00:13
I've set up a validator on a QLineEdit for entering a time interval:
QRegExp exp("\\d\\d:[0-5]\\d:[0-5]\\d");
lineEdit_->setValidator(new QRegExpValidator(exp, this));
This works just fine. The problem is when I try to add an input mask. I want the colons to show up automatically. I tried:
lineEdit_->setInputMask("99:99:99");
to no avail. It won't let me enter anything. Anyone have any insight as to the proper way to mix validators and masks?
Also, if I call lineEdit_->setValidator(0), will it automatically delete the validator object that was previously being used or is there a memory leak if I don't delete it myself?
Thanks.
QRegExp exp("\\d\\d:[0-5]\\d:[0-5]\\d");
lineEdit_->setValidator(new QRegExpValidator(exp, this));
This works just fine. The problem is when I try to add an input mask. I want the colons to show up automatically. I tried:
lineEdit_->setInputMask("99:99:99");
to no avail. It won't let me enter anything. Anyone have any insight as to the proper way to mix validators and masks?
Also, if I call lineEdit_->setValidator(0), will it automatically delete the validator object that was previously being used or is there a memory leak if I don't delete it myself?
Thanks.