Make TextEdit word selection more natural.
authorAndrew den Exter <andrew.den-exter@nokia.com>
Fri, 13 May 2011 03:49:20 +0000 (13:49 +1000)
committerQt Continuous Integration System <qt-info@nokia.com>
Wed, 1 Jun 2011 07:36:15 +0000 (09:36 +0200)
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>
src/gui/text/qtextcontrol.cpp

index e1f42a5..aacac04 100644 (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