diff options
Diffstat (limited to 'client/widgets/lineedit.cc')
-rw-r--r-- | client/widgets/lineedit.cc | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/client/widgets/lineedit.cc b/client/widgets/lineedit.cc index c7c04fa..992c0b2 100644 --- a/client/widgets/lineedit.cc +++ b/client/widgets/lineedit.cc @@ -29,9 +29,11 @@ LineEdit::LineEdit(QWidget *parent, QString reg_exp) : QLineEdit(parent) { + widget_name = "widget_name"; + QRegExp rx(reg_exp); validator = new QRegExpValidator(rx, this); - + //setValidator(validator); changed(""); connect(this, SIGNAL(textChanged(QString)), this, SLOT(changed(QString))); @@ -40,15 +42,15 @@ LineEdit::LineEdit(QWidget *parent, QString reg_exp) : QLineEdit(parent) void LineEdit::changed(QString text) { QPalette palette; - int res; + int res = 0; if(validator->validate(text, res) == QValidator::Acceptable) { // valid string - palette.setBrush(backgroundRole(), QBrush(QColor(0, 150, 0))); + palette.setBrush(backgroundRole(), QBrush(QColor(255, 255, 255))); valid = true; } else { // invalid string - palette.setBrush(backgroundRole(), QBrush(QColor(150, 0, 0))); + palette.setBrush(backgroundRole(), QBrush(QColor(220, 150, 150))); valid = false; } setPalette(palette); @@ -59,3 +61,8 @@ bool LineEdit::isValid() { return valid; } + +QString LineEdit::getValue() +{ + return text(); +} |