aboutsummaryrefslogtreecommitdiffstats
path: root/src/controls/qquickpressandholdhelper_p.h
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>2015-09-15 11:40:43 +0200
committerGabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>2015-09-15 13:25:52 +0000
commitb47ac20e368dce3bbf89bc724600703cd33cb168 (patch)
treeb8b3ef1eb6afe4f9c78ccfcaa5925db2a1536fb6 /src/controls/qquickpressandholdhelper_p.h
parent175dc7d516740a8964a859e4d7b5daaf41ef98d0 (diff)
Ensure press-and-hold event keeps selection
This concerns TextField and TextArea. It is an almost universal UX pattern on touch platforms where the user long presses to pop the context menu up. In many cases the context menu is used for copy and cut operations, which means that poping it up should keep the selection. The implementation works by not forwarding the initial mouse press event to the parent class until we're sure it's not going to be a long press. If the long press timer is cancelled for any reason, we will then send the delayed mouse press event to the parent class followed by whichever event triggered the cancellation. Auto-tests refactored and updated. Change-Id: If3aa8075f07a80929f4bd723895d9599bf8d169e Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
Diffstat (limited to 'src/controls/qquickpressandholdhelper_p.h')
-rw-r--r--src/controls/qquickpressandholdhelper_p.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/controls/qquickpressandholdhelper_p.h b/src/controls/qquickpressandholdhelper_p.h
index 6c0dc5ae..0ac84494 100644
--- a/src/controls/qquickpressandholdhelper_p.h
+++ b/src/controls/qquickpressandholdhelper_p.h
@@ -55,11 +55,15 @@ struct QQuickPressAndHoldHelper
void mouseReleaseEvent(QMouseEvent *event);
void timerEvent(QTimerEvent *event);
+ void clearDelayedMouseEvent();
+ bool isActive();
+
QQuickItem *control;
QBasicTimer timer;
QPointF pressPos;
bool longPress;
int pressAndHoldSignalIndex;
+ QMouseEvent *delayedMousePressEvent;
};
QT_END_NAMESPACE