From 8dadd3a9f18b6d4e8884862658fe8a1d042f631c Mon Sep 17 00:00:00 2001 From: senator Date: Tue, 2 Oct 2007 10:09:37 +0000 Subject: misc minor changes for testing --- client/widgets/textedit.cc | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'client/widgets/textedit.cc') 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 +#include 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() -- cgit v1.2.3