summaryrefslogtreecommitdiff
path: root/client/widgets/textedit.cc
diff options
context:
space:
mode:
authorsenator <senator>2007-10-02 10:09:37 +0000
committersenator <senator>2007-10-02 10:09:37 +0000
commit8dadd3a9f18b6d4e8884862658fe8a1d042f631c (patch)
treee28c16aafcfdb9c76cdc34aeb5c9b1cbdd5d9bbe /client/widgets/textedit.cc
parent9910c8962ab813ab7d9a04609b689e1d9ae038e0 (diff)
misc minor changes for testing
Diffstat (limited to 'client/widgets/textedit.cc')
-rw-r--r--client/widgets/textedit.cc23
1 files changed, 18 insertions, 5 deletions
diff --git a/client/widgets/textedit.cc b/client/widgets/textedit.cc
index d1bd6e4..9334d8a 100644
--- a/client/widgets/textedit.cc
+++ b/client/widgets/textedit.cc
@@ -26,15 +26,24 @@
*/
#include "textedit.h"
#include <stdio.h>
+#include <QPalette>
TextEdit::TextEdit(QDomNode node)
: QTextEdit(), Widget(node)
{
- setAutoFillBackground(true); /* Default is false, which disables background
- color manipulation.*/
+ //setAutoFillBackground(true); /* Default is false, which disables background
+ // color manipulation.*/
QDomElement elem = node.toElement();
+ if(elem.hasAttribute("width")) {
+ resize(elem.attribute("width").toInt(), height());
+ }
+
+ if(elem.hasAttribute("height")) {
+ resize(width(), elem.attribute("height").toInt());
+ }
+
if(elem.hasAttribute("regexp")) {
rx = QRegExp(elem.attribute("regexp"));
connect(this, SIGNAL(textChanged()), this, SLOT(changed()));
@@ -53,11 +62,11 @@ void TextEdit::changed()
if(rx.exactMatch(QTextEdit::toPlainText())) {
// valid string
- palette.setBrush(backgroundRole(), QBrush(QColor(255, 255, 255)));
+ palette.setBrush(QPalette::Base, QBrush(QColor(255, 255, 255)));
valid = true;
} else {
// invalid string
- palette.setBrush(backgroundRole(), QBrush(QColor(230, 200, 200)));
+ palette.setBrush(QPalette::Base, QBrush(QColor(230, 200, 200)));
valid = false;
}
setPalette(palette);
@@ -66,7 +75,11 @@ void TextEdit::changed()
bool TextEdit::isValid()
{
- return valid;
+ if(rx.exactMatch(QTextEdit::toPlainText())) {
+ return true;
+ } else {
+ return false;
+ }
}
QString TextEdit::getValue()