diff options
author | senator <senator> | 2007-07-19 09:42:18 +0000 |
---|---|---|
committer | senator <senator> | 2007-07-19 09:42:18 +0000 |
commit | 42625c76eca0e62c589e2f67373cefaaff14227a (patch) | |
tree | 17fbf52b4c8ced809e5b9b96571bc0b3f0ec69bb | |
parent | 97f91125b45996994efd4a9964c25202477cb530 (diff) |
changed the validation method to only use qregexp
-rw-r--r-- | client/widgets/lineedit.cc | 7 | ||||
-rw-r--r-- | 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; }; |