From 42625c76eca0e62c589e2f67373cefaaff14227a Mon Sep 17 00:00:00 2001 From: senator Date: Thu, 19 Jul 2007 09:42:18 +0000 Subject: changed the validation method to only use qregexp --- client/widgets/lineedit.cc | 7 +++---- client/widgets/lineedit.h | 1 + 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/client/widgets/lineedit.cc b/client/widgets/lineedit.cc index 992c0b2..0a16947 100644 --- a/client/widgets/lineedit.cc +++ b/client/widgets/lineedit.cc @@ -31,8 +31,8 @@ LineEdit::LineEdit(QWidget *parent, QString reg_exp) : QLineEdit(parent) { widget_name = "widget_name"; - QRegExp rx(reg_exp); - validator = new QRegExpValidator(rx, this); + rx = QRegExp(reg_exp); + //validator = new QRegExpValidator(rx, this); //setValidator(validator); changed(""); @@ -42,9 +42,8 @@ LineEdit::LineEdit(QWidget *parent, QString reg_exp) : QLineEdit(parent) void LineEdit::changed(QString text) { QPalette palette; - int res = 0; - if(validator->validate(text, res) == QValidator::Acceptable) { + if(rx.exactMatch(text)) { // valid string palette.setBrush(backgroundRole(), QBrush(QColor(255, 255, 255))); valid = true; diff --git a/client/widgets/lineedit.h b/client/widgets/lineedit.h index 551f08b..45af6f3 100644 --- a/client/widgets/lineedit.h +++ b/client/widgets/lineedit.h @@ -47,6 +47,7 @@ public slots: private: QValidator *validator; + QRegExp rx; bool valid; }; -- cgit v1.2.3