From 1ea592db93e2b6b23d96864690965f22c4d96a16 Mon Sep 17 00:00:00 2001 From: deva Date: Mon, 30 Jun 2008 12:00:38 +0000 Subject: Added setValue and cleaned up the code in general. --- client/widgets/textedit.cc | 23 +++++++++++++++++------ client/widgets/textedit.h | 4 +++- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/client/widgets/textedit.cc b/client/widgets/textedit.cc index a284967..0c1a0e0 100644 --- a/client/widgets/textedit.cc +++ b/client/widgets/textedit.cc @@ -47,10 +47,10 @@ TextEdit::TextEdit(QDomNode &node, MacroWindow *macrowindow) connect(this, SIGNAL(textChanged()), this, SLOT(changed())); if(elem.hasAttribute("value")) { - setText(elem.attribute("value")); + setValue(elem.attribute("value")); } else { - setText(" "); - setText(""); + setValue(" "); + setValue(""); } } @@ -59,16 +59,27 @@ void TextEdit::changed() QPalette palette; if(regexpValidator()) { - // valid string - palette.setBrush(QPalette::Base, QBrush(QColor(255, 255, 255))); + if(luaValidator()) { + // valid string + palette.setBrush(QPalette::Base, QBrush(QColor(255, 255, 255))); + } else { + // invalid string + palette.setBrush(QPalette::Base, QBrush(QColor(200, 230, 200))); + } } else { // invalid string palette.setBrush(QPalette::Base, QBrush(QColor(230, 200, 200))); } - setPalette(palette); + + setPalette(palette); } QString TextEdit::getValue() { return QTextEdit::toPlainText(); } + +void TextEdit::setValue(QString value) +{ + setText(value); +} diff --git a/client/widgets/textedit.h b/client/widgets/textedit.h index 946e7b9..c734f38 100644 --- a/client/widgets/textedit.h +++ b/client/widgets/textedit.h @@ -38,9 +38,11 @@ Q_OBJECT public: TextEdit(QDomNode &node, MacroWindow *macrowindow); + QString getValue(); + void setValue(QString value); + public slots: void changed(); - QString getValue(); }; #endif/*__PRACRO_TEXTEDIT_H__*/ -- cgit v1.2.3