diff options
author | senator <senator> | 2007-07-18 07:52:47 +0000 |
---|---|---|
committer | senator <senator> | 2007-07-18 07:52:47 +0000 |
commit | 37be3663a7bcd8c689a63ad5b2c4b40df2d9e73b (patch) | |
tree | 5784494e0b38b36f0c8ec3756913b16b5ae184f8 /client/widgets/lineedit.cc | |
parent | dd630367a769784e24a41afbf9b36e8ec45512d5 (diff) |
added more dummy widgets and a general widget for use with vector
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(); +} |