summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI/QtTextEdit.cpp')
-rw-r--r--Swift/QtUI/QtTextEdit.cpp23
1 files changed, 22 insertions, 1 deletions
diff --git a/Swift/QtUI/QtTextEdit.cpp b/Swift/QtUI/QtTextEdit.cpp
index 4ffd32a..60dac9b 100644
--- a/Swift/QtUI/QtTextEdit.cpp
+++ b/Swift/QtUI/QtTextEdit.cpp
@@ -17,7 +17,6 @@
#include <QTextDocument>
#include <Swiften/Base/Log.h>
-#include <Swiften/Base/foreach.h>
#include <Swift/Controllers/SettingConstants.h>
@@ -81,14 +80,36 @@ void QtTextEdit::keyPressEvent(QKeyEvent* event) {
}
}
+void QtTextEdit::setEmphasiseFocus(bool emphasise) {
+ emphasiseFocus_ = emphasise;
+ updateEmphasisedFocus();
+}
+
+void QtTextEdit::updateEmphasisedFocus() {
+ if (emphasiseFocus_) {
+ if (hasFocus()) {
+ setStyleSheet("border: 2px solid palette(highlight);");
+ }
+ else {
+ setStyleSheet("");
+ }
+ }
+ else {
+ setStyleSheet("");
+ }
+ handleTextChanged();
+}
+
void QtTextEdit::focusInEvent(QFocusEvent* event) {
receivedFocus();
QTextEdit::focusInEvent(event);
+ updateEmphasisedFocus();
}
void QtTextEdit::focusOutEvent(QFocusEvent* event) {
lostFocus();
QTextEdit::focusOutEvent(event);
+ updateEmphasisedFocus();
}
void QtTextEdit::handleTextChanged() {