summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorAndrew den Exter <andrew.den-exter@nokia.com>2011-04-27 03:57:04 (GMT)
committerAndrew den Exter <andrew.den-exter@nokia.com>2011-04-27 04:51:22 (GMT)
commit47712d1f330e4b22ce6dd30e7557288ef7f7fca0 (patch)
tree40c179802054fa5ee9139dfd04c9269b03664c29 /src/gui
parent8878e2c53a0c9408d4b468e2dad485743c32f58b (diff)
downloadQt-47712d1f330e4b22ce6dd30e7557288ef7f7fca0.zip
Qt-47712d1f330e4b22ce6dd30e7557288ef7f7fca0.tar.gz
Qt-47712d1f330e4b22ce6dd30e7557288ef7f7fca0.tar.bz2
Ignore changes to selectByMouse during a selection.
Use the value of selectByMouse at the time of a mouse press event in all subsequent mouse events in a sequence. This is the same as ignoring the intial mouse press except mouse events for other actions are still accepted. Change-Id: I59b50bf95d26c6320e6e74eeb679b4153e0edf4d Task-number: QTBUG-18887 Reviewed-by: Martin Jones
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/text/qtextcontrol.cpp16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp
index bee4d95..3fd3ab5 100644
--- a/src/gui/text/qtextcontrol.cpp
+++ b/src/gui/text/qtextcontrol.cpp
@@ -1518,7 +1518,7 @@ void QTextControlPrivate::mousePressEvent(QEvent *e, Qt::MouseButton button, con
const QTextCursor oldSelection = cursor;
const int oldCursorPos = cursor.position();
- mousePressed = true;
+ mousePressed = (interactionFlags & Qt::TextSelectableByMouse);
#ifndef QT_NO_DRAGANDDROP
mightStartDrag = false;
#endif
@@ -1607,13 +1607,11 @@ void QTextControlPrivate::mouseMoveEvent(QEvent *e, Qt::MouseButton button, cons
if (!(buttons & Qt::LeftButton))
return;
- const bool selectable = interactionFlags & Qt::TextSelectableByMouse;
const bool editable = interactionFlags & Qt::TextEditable;
- if (!selectable && !editable)
- return;
-
if (!(mousePressed
+ || editable
+ || mightStartDrag
|| selectedWordOnDoubleClick.hasSelection()
|| selectedBlockOnTrippleClick.hasSelection()))
return;
@@ -1627,7 +1625,7 @@ void QTextControlPrivate::mouseMoveEvent(QEvent *e, Qt::MouseButton button, cons
return;
}
- if (!selectable)
+ if (!mousePressed)
return;
const qreal mouseX = qreal(mousePos.x());
@@ -1695,10 +1693,8 @@ void QTextControlPrivate::mouseReleaseEvent(QEvent *e, Qt::MouseButton button, c
if (mousePressed) {
mousePressed = false;
#ifndef QT_NO_CLIPBOARD
- if (interactionFlags & Qt::TextSelectableByMouse) {
- setClipboardSelection();
- selectionChanged(true);
- }
+ setClipboardSelection();
+ selectionChanged(true);
} else if (button == Qt::MidButton
&& (interactionFlags & Qt::TextEditable)
&& QApplication::clipboard()->supportsSelection()) {