Make TextEdit word selection more natural.

QTextControl will only extend the selection to a word if the cursor is
directly over it which prevents the selection being extended if the
mouse is dragged up or down a to a shorter line of text making it
difficult to select multiple lines of text.  Just disable that
limitation when the TextEdit word selection is enabled.

Change-Id: I3b9d1575c0141db8441197d740de94a90eacc077
Task-number: QTBUG-19230
Reviewed-by: Martin Jones
Reviewed-on: http://codereview.qt.nokia.com/292
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Andrew den Exter <andrew.den-exter@nokia.com>
This commit is contained in:
Andrew den Exter 2011-05-13 13:49:20 +10:00 committed by Qt Continuous Integration System
parent 16bd22b1bc
commit 50b77ef0b0

View File

@ -677,7 +677,7 @@ void QTextControlPrivate::extendWordwiseSelection(int suggestedNewPosition, qrea
const qreal wordEndX = line.cursorToX(curs.position() - blockPos) + blockCoordinates.x();
if (mouseXPosition < wordStartX || mouseXPosition > wordEndX)
if (!wordSelectionEnabled && (mouseXPosition < wordStartX || mouseXPosition > wordEndX))
return;
// keep the already selected word even when moving to the left