diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2011-09-22 09:20:52 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-09-22 09:42:43 +0200 |
commit | 33c3525e38580a8333d86316ad79952359d4ac31 (patch) | |
tree | 997aa0d78bc9d74845e2c037a1375cdc5cf1fc69 /src | |
parent | defa339b371204788504d41bea737d05a5d53285 (diff) |
Fix extra selection in QML TextEdit
QSGTextEdit::selectionEnd() interprets the selection end as the
first character after the selection, while QSGTextNode expects it
to be the end of the selection.
Task-number: QTBUG-21533
Change-Id: Ia928602f8a2f845f3990a443e62f640ea72aa1d4
Reviewed-on: http://codereview.qt-project.org/5363
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Jiang Jiang <jiang.jiang@nokia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/declarative/items/qsgtextedit.cpp | 2 | ||||
-rw-r--r-- | src/declarative/items/qsgtextnode.cpp | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/declarative/items/qsgtextedit.cpp b/src/declarative/items/qsgtextedit.cpp index 885fdaf395..af018aef8c 100644 --- a/src/declarative/items/qsgtextedit.cpp +++ b/src/declarative/items/qsgtextedit.cpp @@ -1530,7 +1530,7 @@ QSGNode *QSGTextEdit::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *upd QColor selectedTextColor = d->control->palette().color(QPalette::HighlightedText); node->addTextDocument(bounds.topLeft(), d->document, d->color, QSGText::Normal, QColor(), selectionColor, selectedTextColor, selectionStart(), - selectionEnd()); + selectionEnd() - 1); #if defined(Q_WS_MAC) // We also need to make sure the document layout is redone when diff --git a/src/declarative/items/qsgtextnode.cpp b/src/declarative/items/qsgtextnode.cpp index 5ff8395022..3af7e54b2f 100644 --- a/src/declarative/items/qsgtextnode.cpp +++ b/src/declarative/items/qsgtextnode.cpp @@ -663,7 +663,7 @@ namespace { bool hasSelection = selectionStart >= 0 && selectionEnd >= 0 - && selectionStart != selectionEnd; + && selectionStart <= selectionEnd; QTextLine &line = m_currentLine; int rangeEnd = rangeStart + rangeLength; |