diff options
Diffstat (limited to 'client/widgets/lineedit.cc')
-rw-r--r-- | client/widgets/lineedit.cc | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/client/widgets/lineedit.cc b/client/widgets/lineedit.cc index 0a16947..686791d 100644 --- a/client/widgets/lineedit.cc +++ b/client/widgets/lineedit.cc @@ -27,16 +27,17 @@ #include "lineedit.h" #include <stdio.h> -LineEdit::LineEdit(QWidget *parent, QString reg_exp) : QLineEdit(parent) +LineEdit::LineEdit(QDomNode node) : QLineEdit() { - widget_name = "widget_name"; - - rx = QRegExp(reg_exp); - //validator = new QRegExpValidator(rx, this); - //setValidator(validator); - changed(""); - + QDomElement elem = node.toElement(); + rx = QRegExp(elem.attribute("regexp")); connect(this, SIGNAL(textChanged(QString)), this, SLOT(changed(QString))); + + if(elem.hasAttribute("value")) { + setText(elem.attribute("value")); + } else { + setText(""); + } } void LineEdit::changed(QString text) @@ -49,7 +50,7 @@ void LineEdit::changed(QString text) valid = true; } else { // invalid string - palette.setBrush(backgroundRole(), QBrush(QColor(220, 150, 150))); + palette.setBrush(backgroundRole(), QBrush(QColor(230, 200, 200))); valid = false; } setPalette(palette); |