diff options
Diffstat (limited to 'client/widgets')
-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; }; |