diff options
author | Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com> | 2014-12-04 11:31:01 +0100 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com> | 2014-12-04 18:51:38 +0100 |
commit | 20d10d90f2715e6cee46be63c1314eb62f06bc5f (patch) | |
tree | 6cd8ee89257b9ee0342889ad2704d87905b191e1 | |
parent | 8e9d78e43ef6dd7a6fc3be8874fc518db8537c91 (diff) |
Revert "QWidgetTextControl: Suppress drag selection for OS-synthesized mouse events."
This reverts commit cf0d96f4c8584a7eb9eeca304932f6ea88894b27.
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>
-rw-r--r-- | src/widgets/kernel/qapplication.cpp | 26 | ||||
-rw-r--r-- | src/widgets/kernel/qapplication_p.h | 1 | ||||
-rw-r--r-- | src/widgets/widgets/qwidgettextcontrol.cpp | 9 |
3 files changed, 1 insertions, 35 deletions
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 82b9fec37f..269fe452c1 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -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 diff --git a/src/widgets/kernel/qapplication_p.h b/src/widgets/kernel/qapplication_p.h index b24b592fbe..7d97235c66 100644 --- a/src/widgets/kernel/qapplication_p.h +++ b/src/widgets/kernel/qapplication_p.h @@ -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 diff --git a/src/widgets/widgets/qwidgettextcontrol.cpp b/src/widgets/widgets/qwidgettextcontrol.cpp index 8f017b7b87..dfec6a14d4 100644 --- a/src/widgets/widgets/qwidgettextcontrol.cpp +++ b/src/widgets/widgets/qwidgettextcontrol.cpp @@ -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)) { |