summaryrefslogtreecommitdiff
path: root/client/widgets/lineedit.cc
diff options
context:
space:
mode:
authorsenator <senator>2007-07-23 07:40:05 +0000
committersenator <senator>2007-07-23 07:40:05 +0000
commit22de7bf19fb6fcce8d11c0e01afdfafa2a8c00d6 (patch)
treeb841931e88a673e04a26f2709066c018d9df4f68 /client/widgets/lineedit.cc
parentd614b0436f0ce1f060fc80b987ca4209f17c221e (diff)
porting widgets to use QDomNodes
Diffstat (limited to 'client/widgets/lineedit.cc')
-rw-r--r--client/widgets/lineedit.cc19
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);