Revert "QWidgetTextControl: Suppress drag selection for OS-synthesized mouse events."

This reverts commit cf0d96f4c8.

It broke text selection on iOS and was never tested on that platform.

Task-number: QTBUG-43101
Change-Id: I9f224a3838a1f741bc9a9c24f16923ef2018ddf3
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
This commit is contained in:
Tor Arne Vestbø 2014-12-04 11:31:01 +01:00
parent 8e9d78e43e
commit 20d10d90f2
3 changed files with 1 additions and 35 deletions

View File

@ -53,7 +53,6 @@
#include "qtranslator.h"
#include "qvariant.h"
#include "qwidget.h"
#include "qgraphicssceneevent.h"
#include "private/qdnd_p.h"
#include "private/qguiapplication_p.h"
#include "qcolormap.h"
@ -2287,31 +2286,6 @@ QWidget *QApplicationPrivate::focusNextPrevChild_helper(QWidget *toplevel, bool
return w;
}
Qt::MouseEventSource QApplicationPrivate::mouseEventSource(const QEvent *e)
{
switch (e->type()) {
case QEvent::NonClientAreaMouseButtonDblClick:
case QEvent::NonClientAreaMouseButtonPress:
case QEvent::NonClientAreaMouseButtonRelease:
case QEvent::NonClientAreaMouseMove:
case QEvent::MouseButtonDblClick:
case QEvent::MouseButtonPress:
case QEvent::MouseButtonRelease:
case QEvent::MouseMove:
return static_cast<const QMouseEvent *>(e)->source();
#ifndef QT_NO_GRAPHICSVIEW
case QEvent::GraphicsSceneMouseDoubleClick:
case QEvent::GraphicsSceneMousePress:
case QEvent::GraphicsSceneMouseRelease:
case QEvent::GraphicsSceneMouseMove:
return static_cast<const QGraphicsSceneMouseEvent *>(e)->source();
#endif // !QT_NO_GRAPHICSVIEW
default:
break;
}
return Qt::MouseEventNotSynthesized;
}
/*!
\fn void QApplicationPrivate::dispatchEnterLeave(QWidget* enter, QWidget* leave, const QPointF &globalPosF)
\internal

View File

@ -168,7 +168,6 @@ public:
static void setFocusWidget(QWidget *focus, Qt::FocusReason reason);
static QWidget *focusNextPrevChild_helper(QWidget *toplevel, bool next,
bool *wrappingOccurred = 0);
static Qt::MouseEventSource mouseEventSource(const QEvent *e);
#ifndef QT_NO_GRAPHICSVIEW
// Maintain a list of all scenes to ensure font and palette propagation to

View File

@ -1580,10 +1580,8 @@ void QWidgetTextControlPrivate::mousePressEvent(QEvent *e, Qt::MouseButton butto
cursor.clearSelection();
}
}
// Do not start selection on a mouse event synthesized from a touch event.
if (!(button & Qt::LeftButton) ||
!((interactionFlags & Qt::TextSelectableByMouse) || (interactionFlags & Qt::TextEditable))
|| QApplicationPrivate::mouseEventSource(e) != Qt::MouseEventNotSynthesized) {
!((interactionFlags & Qt::TextSelectableByMouse) || (interactionFlags & Qt::TextEditable))) {
e->ignore();
return;
}
@ -1754,11 +1752,6 @@ void QWidgetTextControlPrivate::mouseReleaseEvent(QEvent *e, Qt::MouseButton but
{
Q_Q(QWidgetTextControl);
if (QApplicationPrivate::mouseEventSource(e) != Qt::MouseEventNotSynthesized) {
setCursorPosition(pos); // Emulate Tap to set cursor for events synthesized from touch.
return;
}
const QTextCursor oldSelection = cursor;
if (sendMouseEventToInputContext(
e, QEvent::MouseButtonRelease, button, pos, modifiers, buttons, globalPos)) {