summaryrefslogtreecommitdiff
path: root/client/widgets/lineedit.cc
diff options
context:
space:
mode:
authordeva <deva>2008-06-02 13:03:33 +0000
committerdeva <deva>2008-06-02 13:03:33 +0000
commit322a83c48618b2f58e1014daff6f3956af8070ea (patch)
treeaa6124cd9f13ee2308e28d33175dc31eb1d34984 /client/widgets/lineedit.cc
parentf9f04013fca46fa256664bbf1f983c966f253400 (diff)
A large number of small changes in widgets, primarily validation oriented.
Diffstat (limited to 'client/widgets/lineedit.cc')
-rw-r--r--client/widgets/lineedit.cc25
1 files changed, 5 insertions, 20 deletions
diff --git a/client/widgets/lineedit.cc b/client/widgets/lineedit.cc
index 83f8d3e..26c2760 100644
--- a/client/widgets/lineedit.cc
+++ b/client/widgets/lineedit.cc
@@ -27,25 +27,20 @@
#include "lineedit.h"
#include <stdio.h>
-LineEdit::LineEdit(QDomNode node)
+LineEdit::LineEdit(QDomNode &node)
: QLineEdit(), Widget(node)
{
QDomElement elem = node.toElement();
if(elem.hasAttribute("width")) {
- //resize(elem.attribute("width").toInt(), height());
setMinimumWidth(elem.attribute("width").toInt());
}
if(elem.hasAttribute("height")) {
- //resize(width(), elem.attribute("height").toInt());
setMinimumHeight(elem.attribute("height").toInt());
}
- if(elem.hasAttribute("regexp")) {
- rx = QRegExp(elem.attribute("regexp"));
- connect(this, SIGNAL(textChanged(QString)), this, SLOT(changed(QString)));
- }
+ connect(this, SIGNAL(textChanged(QString)), this, SLOT(changed()));
if(elem.hasAttribute("value")) {
setText(elem.attribute("value"));
@@ -56,29 +51,19 @@ LineEdit::LineEdit(QDomNode node)
}
}
-void LineEdit::changed(QString new_text)
+void LineEdit::changed()
{
QPalette palette;
- if(rx.exactMatch(new_text)) {
+ if(regexpValidator()) {
// valid string
palette.setBrush(QPalette::Base, QBrush(QColor(255, 255, 255)));
- valid = true;
} else {
// invalid string
palette.setBrush(QPalette::Base, QBrush(QColor(230, 200, 200)));
- valid = false;
}
- setPalette(palette);
-}
-bool LineEdit::isValid()
-{
- if(rx.exactMatch(text())) {
- return true;
- } else {
- return false;
- }
+ setPalette(palette);
}
QString LineEdit::getValue()