diff options
author | Joona Petrell <joona.t.petrell@nokia.com> | 2010-12-14 01:22:50 (GMT) |
---|---|---|
committer | Joona Petrell <joona.t.petrell@nokia.com> | 2010-12-14 01:46:45 (GMT) |
commit | 2eee49127b80b5b56c605f76ccea004b03d89577 (patch) | |
tree | 196c58e22d3e21872c5656d9789a7d1330d581d6 /src/declarative/graphicsitems/qdeclarativetextedit.cpp | |
parent | 896cd4bd08181ad16ad9cee6d2aaa1844a4f06d3 (diff) | |
download | Qt-2eee49127b80b5b56c605f76ccea004b03d89577.zip Qt-2eee49127b80b5b56c605f76ccea004b03d89577.tar.gz Qt-2eee49127b80b5b56c605f76ccea004b03d89577.tar.bz2 |
Remove active selection when TextEdit loses focus
Task-number: QTBUG-15341
Reviewed-by: Yann Bodson
Diffstat (limited to 'src/declarative/graphicsitems/qdeclarativetextedit.cpp')
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativetextedit.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp index e05f4e4..1042cf1 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp @@ -994,6 +994,20 @@ void QDeclarativeTextEditPrivate::focusChanged(bool hasFocus) QDeclarativeItemPrivate::focusChanged(hasFocus); } +void QDeclarativeTextEdit::focusOutEvent(QFocusEvent *event) +{ + Q_D(QDeclarativeTextEdit); + if (event->reason() != Qt::ActiveWindowFocusReason + && event->reason() != Qt::PopupFocusReason) { + QTextCursor cursor = d->control->textCursor(); + if (cursor.hasSelection()) { + cursor.clearSelection(); + d->control->setTextCursor(cursor); + } + } + QDeclarativePaintedItem::focusOutEvent(event); +} + /*! \qmlmethod void TextEdit::selectAll() |