summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qgesture.cpp
diff options
context:
space:
mode:
authorThomas Zander <t.zander@nokia.com>2010-07-07 09:46:33 (GMT)
committerThomas Zander <t.zander@nokia.com>2010-07-08 11:17:12 (GMT)
commit8b212b5f36ef7479bb902c6f8c8c1f4335f7f39f (patch)
tree9cfe87d49f384af482469bef20fc12203289bba9 /src/gui/kernel/qgesture.cpp
parent062ceb0ec312e54670362c76aefdcac5353d64cd (diff)
downloadQt-8b212b5f36ef7479bb902c6f8c8c1f4335f7f39f.zip
Qt-8b212b5f36ef7479bb902c6f8c8c1f4335f7f39f.tar.gz
Qt-8b212b5f36ef7479bb902c6f8c8c1f4335f7f39f.tar.bz2
Change default TapAndHold timeout and make configurable
The new default timeout is 700ms and is what Nokia Research found through usability studies. Nevertheless lets provide public API to set this through a platform plugin or similar. Reviewed-By: Denis
Diffstat (limited to 'src/gui/kernel/qgesture.cpp')
-rw-r--r--src/gui/kernel/qgesture.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/gui/kernel/qgesture.cpp b/src/gui/kernel/qgesture.cpp
index f5688f4..6359ecf 100644
--- a/src/gui/kernel/qgesture.cpp
+++ b/src/gui/kernel/qgesture.cpp
@@ -41,6 +41,7 @@
#include "qgesture.h"
#include "private/qgesture_p.h"
+#include "private/qstandardgestures_p.h"
#ifndef QT_NO_GESTURES
@@ -726,6 +727,34 @@ void QTapAndHoldGesture::setPosition(const QPointF &value)
d_func()->position = value;
}
+/*!
+ Set the timeout, in milliseconds, before the gesture triggers.
+
+ The recognizer will detect a touch down and and if \a msecs
+ later the touch is still down, it will trigger the QTapAndHoldGesture.
+ The default value is 700 milliseconds.
+*/
+// static
+void QTapAndHoldGesture::setTimeout(int msecs)
+{
+ QTapAndHoldGesturePrivate::Timeout = msecs;
+}
+
+/*!
+ Gets the timeout, in milliseconds, before the gesture triggers.
+
+ The recognizer will detect a touch down and and if timeout()
+ later the touch is still down, it will trigger the QTapAndHoldGesture.
+ The default value is 700 milliseconds.
+*/
+// static
+int QTapAndHoldGesture::timeout()
+{
+ return QTapAndHoldGesturePrivate::Timeout;
+}
+
+int QTapAndHoldGesturePrivate::Timeout = 700; // in ms
+
QT_END_NAMESPACE
#endif // QT_NO_GESTURES