diff options
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); +} |