summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gui/widgets/qlabel.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/gui/widgets/qlabel.cpp b/src/gui/widgets/qlabel.cpp
index 5ff323a..5ba0571 100644
--- a/src/gui/widgets/qlabel.cpp
+++ b/src/gui/widgets/qlabel.cpp
@@ -886,7 +886,18 @@ void QLabel::focusInEvent(QFocusEvent *ev)
void QLabel::focusOutEvent(QFocusEvent *ev)
{
Q_D(QLabel);
- d->sendControlEvent(ev);
+ if (d->control) {
+ d->sendControlEvent(ev);
+ QTextCursor cursor = d->control->textCursor();
+ Qt::FocusReason reason = ev->reason();
+ if (reason != Qt::ActiveWindowFocusReason
+ && reason != Qt::PopupFocusReason
+ && cursor.hasSelection()) {
+ cursor.clearSelection();
+ d->control->setTextCursor(cursor);
+ }
+ }
+
QFrame::focusOutEvent(ev);
}