Qt 正则表达式匹配 时分秒 00:00:00

来源:互联网 发布:条码采集器软件 编辑:程序博客网 时间:2024/05/29 06:31

由于小时可以是0-99,而分秒最大只能为59

 QLineEdit *editor = new QLineEdit (parent);

QRegExp ipRegExp = QRegExp("([0-9][0-9])\\:([0-5][0-9])\\:([0-5][0-9])");
QRegExpValidator *ipRegExpValidator = new QRegExpValidator(ipRegExp, parent);
editor->setValidator(ipRegExpValidator);
editor->setInputMask("00:00:00:00;");
0 0
原创粉丝点击