Fix failing qtdeclarativetextedit auto-test

After commit c3baa7c1dc8c29bfe60e8e5c676c606d4f699005 the qtdeclarativetextedit
tests in the qtquick1 module started failing. This was due to commit
852abfca6f4c349dce9b895956922f96d82df579 from 4.8 not being forward-ported from
Qt 4 to Qt 5, hence the comment in c3baa7c1dc8c29bfe60e8e5c676c606d4f699005
about the missing mousePressEvent line. It was intentionally removed and
instead used further down, which is what this patch adds and therefore acts as
forward-port of 852abfca6f4c349dce9b895956922f96d82df579.

Change-Id: I55978c961002382c1f228bf796c469c10686ba9f
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
This commit is contained in:
Simon Hausmann 2014-06-10 11:42:23 +02:00 committed by The Qt Project
parent 1a3d149174
commit e3d32bce79

View File

@ -1712,7 +1712,7 @@ void QWidgetTextControlPrivate::mouseMoveEvent(QEvent *e, Qt::MouseButton button
if (newCursorPos == -1)
return;
if (wordSelectionEnabled && !selectedWordOnDoubleClick.hasSelection()) {
if (mousePressed && wordSelectionEnabled && !selectedWordOnDoubleClick.hasSelection()) {
selectedWordOnDoubleClick = cursor;
selectedWordOnDoubleClick.select(QTextCursor::WordUnderCursor);
}
@ -1721,7 +1721,7 @@ void QWidgetTextControlPrivate::mouseMoveEvent(QEvent *e, Qt::MouseButton button
extendBlockwiseSelection(newCursorPos);
else if (selectedWordOnDoubleClick.hasSelection())
extendWordwiseSelection(newCursorPos, mouseX);
else if (!isPreediting())
else if (mousePressed && !isPreediting())
setCursorPosition(newCursorPos, QTextCursor::KeepAnchor);
if (interactionFlags & Qt::TextEditable) {