summaryrefslogtreecommitdiff
path: root/client/widgets/textedit.cc
diff options
context:
space:
mode:
Diffstat (limited to 'client/widgets/textedit.cc')
-rw-r--r--client/widgets/textedit.cc24
1 files changed, 4 insertions, 20 deletions
diff --git a/client/widgets/textedit.cc b/client/widgets/textedit.cc
index 28ca010..e217cc6 100644
--- a/client/widgets/textedit.cc
+++ b/client/widgets/textedit.cc
@@ -28,7 +28,7 @@
#include <stdio.h>
#include <QPalette>
-TextEdit::TextEdit(QDomNode node)
+TextEdit::TextEdit(QDomNode &node)
: QTextEdit(), Widget(node)
{
//setAutoFillBackground(true); /* Default is false, which disables background
@@ -37,23 +37,19 @@ TextEdit::TextEdit(QDomNode 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()), this, SLOT(changed()));
- }
+ connect(this, SIGNAL(textChanged()), this, SLOT(changed()));
if(elem.hasAttribute("value")) {
setText(elem.attribute("value"));
} else {
+ setText(" ");
setText("");
}
}
@@ -62,26 +58,14 @@ void TextEdit::changed()
{
QPalette palette;
- if(rx.exactMatch(QTextEdit::toPlainText())) {
+ 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);
- //printf("%s\n", text.toStdString().c_str());
-}
-
-bool TextEdit::isValid()
-{
- if(rx.exactMatch(QTextEdit::toPlainText())) {
- return true;
- } else {
- return false;
- }
}
QString TextEdit::getValue()