diff options
author | deva <deva> | 2008-06-30 12:00:38 +0000 |
---|---|---|
committer | deva <deva> | 2008-06-30 12:00:38 +0000 |
commit | 1ea592db93e2b6b23d96864690965f22c4d96a16 (patch) | |
tree | d441ba997f9c365b99e4b3447a8384b65ad610c5 /client/widgets/textedit.cc | |
parent | a04fb898ee09ebab7a955196f9cc60739d9ef2c2 (diff) |
Added setValue and cleaned up the code in general.
Diffstat (limited to 'client/widgets/textedit.cc')
-rw-r--r-- | client/widgets/textedit.cc | 23 |
1 files changed, 17 insertions, 6 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); +} |