summaryrefslogtreecommitdiff
path: root/client/widgets/textedit.cc
diff options
context:
space:
mode:
Diffstat (limited to 'client/widgets/textedit.cc')
-rw-r--r--client/widgets/textedit.cc98
1 files changed, 36 insertions, 62 deletions
diff --git a/client/widgets/textedit.cc b/client/widgets/textedit.cc
index 83ef62a..0b7ddde 100644
--- a/client/widgets/textedit.cc
+++ b/client/widgets/textedit.cc
@@ -25,62 +25,59 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
#include "textedit.h"
-#include <QPalette>
+#include <QPalette>
+#include <QTextEdit>
#include <stdio.h>
#include "common.h"
TextEdit::TextEdit(QDomNode &node, MacroWindow *macrowindow)
- : QTextEdit(), Widget(node, macrowindow)
+ : Widget(node, macrowindow)
{
- setCommonAttributes(this, node);
+ textedit = new QTextEdit();
+ widget = textedit;
+
+ setCommonAttributes(textedit, node);
QDomElement elem = node.toElement();
if(elem.hasAttribute("readonly")) {
- if(elem.attribute("readonly") == "true" || elem.attribute("readonly") == "1") {
- setReadOnly(true);
- } else if(elem.attribute("readonly") == "false" || elem.attribute("readonly") == "0") {
- setReadOnly(false);
+ if(elem.attribute("readonly") == "true" ||
+ elem.attribute("readonly") == "1") {
+ textedit->setReadOnly(true);
+ } else if(elem.attribute("readonly") == "false" ||
+ elem.attribute("readonly") == "0") {
+ textedit->setReadOnly(false);
} else {
- printf("Unknown value of readonly: %s\n", elem.attribute("readonly").toStdString().c_str());
+ printf("Unknown value of readonly: %s\n",
+ elem.attribute("readonly").toStdString().c_str());
}
}
- connect(this, SIGNAL(textChanged()), this, SLOT(changed()));
- installEventFilter(this); // Detect keyboard input.
+ connect(textedit, SIGNAL(textChanged()), this, SLOT(changed()));
+ textedit->installEventFilter(this); // Detect keyboard input.
}
-void TextEdit::changed()
+TextEdit::~TextEdit()
{
- QPalette palette;
-
- if(regexpValidator()) {
- 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)));
- }
+ //delete textedit;
+}
- setPalette(palette);
+void TextEdit::changed()
+{
+ eventOnChange();
}
-QString TextEdit::getValue()
+QString TextEdit::value()
{
- return QTextEdit::toPlainText();
+ return textedit->toPlainText();
}
void TextEdit::setValue(QString value, QString source)
{
if(isUserSource(source)) emit wasChanged();
- setText(value);
+ textedit->setText(value);
setInitialValue(value);
}
@@ -93,40 +90,17 @@ bool TextEdit::eventFilter(QObject *, QEvent *event)
return false;
}
-void TextEdit::connectFrom(const char *signal,
- const QObject *receiver, const char *method)
-{
- connect(this, signal, receiver, method);
-}
-
-void TextEdit::connectTo(const QObject *sender, const char *signal,
- const char *method)
+void TextEdit::setWdgValid(bool valid)
{
- connect(sender, signal, this, method);
-}
-
-bool TextEdit::setKeyboardFocus()
-{
- setFocus();
- return true;
-}
-
-void TextEdit::setVisibility(bool visible)
-{
- setVisible(visible);
-}
-
-void TextEdit::enable()
-{
- setEnabled(true);
-}
+ QPalette palette;
-void TextEdit::disable()
-{
- setEnabled(false);
-}
+ if(valid) {
+ // valid string
+ palette.setBrush(QPalette::Base, QBrush(QColor(255, 255, 255)));
+ } else {
+ // invalid string
+ palette.setBrush(QPalette::Base, QBrush(QColor(230, 200, 200)));
+ }
-bool TextEdit::isDisabled()
-{
- return isEnabled() == false;
+ textedit->setPalette(palette);
}