diff options
Diffstat (limited to 'client')
-rw-r--r-- | client/widgets/textedit.cc | 23 | ||||
-rw-r--r-- | 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__*/ |