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.cc37
1 files changed, 36 insertions, 1 deletions
diff --git a/client/widgets/textedit.cc b/client/widgets/textedit.cc
index cdbd8ad..ec7e3fc 100644
--- a/client/widgets/textedit.cc
+++ b/client/widgets/textedit.cc
@@ -49,6 +49,7 @@ TextEdit::TextEdit(QDomNode &node, MacroWindow *macrowindow)
}
connect(this, SIGNAL(textChanged()), this, SLOT(changed()));
+ installEventFilter(this); // Detect keyboard input.
}
void TextEdit::changed()
@@ -76,7 +77,41 @@ QString TextEdit::getValue()
return QTextEdit::toPlainText();
}
-void TextEdit::setValue(QString value)
+void TextEdit::setValue(QString value, QString source)
{
+ if(isUserSource(source)) emit wasChanged();
setText(value);
+ setInitialValue(value);
+}
+
+bool TextEdit::eventFilter(QObject *, QEvent *event)
+{
+ if (event->type() == QEvent::KeyPress) {
+ QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
+ if(keyEvent->text() != "") emit wasChanged();
+ }
+ 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)
+{
+ connect(sender, signal, this, method);
+}
+
+bool TextEdit::setKeyboardFocus()
+{
+ setFocus();
+ return true;
+}
+
+void TextEdit::setVisibility(bool visible)
+{
+ setVisible(visible);
}