diff options
author | Andrew den Exter <andrew.den-exter@nokia.com> | 2011-09-08 02:28:49 (GMT) |
---|---|---|
committer | Andrew den Exter <andrew.den-exter@nokia.com> | 2011-09-08 03:00:51 (GMT) |
commit | 852abfca6f4c349dce9b895956922f96d82df579 (patch) | |
tree | 99c31dfab2441a4af87a5948580c0699564ed8bb /src/gui | |
parent | a1b2be3c8a64aee832c648c6dcdff003f22318a3 (diff) | |
download | Qt-852abfca6f4c349dce9b895956922f96d82df579.zip Qt-852abfca6f4c349dce9b895956922f96d82df579.tar.gz Qt-852abfca6f4c349dce9b895956922f96d82df579.tar.bz2 |
Fix double click and drag not extending word selection.
mousePressed isn't set on the second press of a double click and so
can't be used to determine if all selections should be skipped. Instead
skip only the single click and drag selections if mousePressed is false.
Change-Id: I5e7ba033f38b0f9b98fdca5c61a8548f92991601
Task-number: QTBUG-20925
Reviewed-by: Martin Jones
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/text/qtextcontrol.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp index aacac04..996d488 100644 --- a/src/gui/text/qtextcontrol.cpp +++ b/src/gui/text/qtextcontrol.cpp @@ -1628,16 +1628,13 @@ void QTextControlPrivate::mouseMoveEvent(QEvent *e, Qt::MouseButton button, cons return; } - if (!mousePressed) - return; - const qreal mouseX = qreal(mousePos.x()); int newCursorPos = q->hitTest(mousePos, Qt::FuzzyHit); if (newCursorPos == -1) return; - if (wordSelectionEnabled && !selectedWordOnDoubleClick.hasSelection()) { + if (mousePressed && wordSelectionEnabled && !selectedWordOnDoubleClick.hasSelection()) { selectedWordOnDoubleClick = cursor; selectedWordOnDoubleClick.select(QTextCursor::WordUnderCursor); } @@ -1646,7 +1643,7 @@ void QTextControlPrivate::mouseMoveEvent(QEvent *e, Qt::MouseButton button, cons extendBlockwiseSelection(newCursorPos); else if (selectedWordOnDoubleClick.hasSelection()) extendWordwiseSelection(newCursorPos, mouseX); - else + else if (mousePressed) setCursorPosition(newCursorPos, QTextCursor::KeepAnchor); if (interactionFlags & Qt::TextEditable) { |