summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2016-11-18 09:07:07 +0100
committerShawn Rutledge <shawn.rutledge@qt.io>2016-11-24 11:56:50 +0000
commit705e3f68df83dca165e3cddb914d3816155323f8 (patch)
tree05ac5c3e3a4bd658643cb8b0de0f6c0927b8539b /src
parent85f868e73e4cf9dffe27b737f8dc3f5bb626ed04 (diff)
add TouchDoubleTapDistance platform theme hint
Double-tapping on a touchscreen typically requires a higher threshold than double-clicking with a mouse, because it's harder to hit the same point twice with your finger. This is intended for use in QtQuick's new TapHandler. [ChangeLog][QtGui] environment variable QT_DBL_TAP_DIST customizes the amount of movement allowed when detecting a double tap via touch. Change-Id: I83a9be363f22c1086fd39580aa95055f2b3ff5c7 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/gui/kernel/qplatformtheme.cpp13
-rw-r--r--src/gui/kernel/qplatformtheme.h3
2 files changed, 15 insertions, 1 deletions
diff --git a/src/gui/kernel/qplatformtheme.cpp b/src/gui/kernel/qplatformtheme.cpp
index 9c140f1d68..eef8b817fd 100644
--- a/src/gui/kernel/qplatformtheme.cpp
+++ b/src/gui/kernel/qplatformtheme.cpp
@@ -149,6 +149,11 @@ QT_BEGIN_NAMESPACE
\value ContextMenuOnMouseRelease (bool) Whether the context menu should be shown on mouse release.
+ \value TouchDoubleTapDistance (int) The maximum distance in logical pixels which a touchpoint can travel
+ between taps in order for the tap sequence to be handled as a double tap.
+ The default value is double the MouseDoubleClickDistance, or 10 logical pixels
+ if that is not specified.
+
\sa themeHint(), QStyle::pixelMetric()
*/
@@ -533,6 +538,14 @@ QVariant QPlatformTheme::defaultThemeHint(ThemeHint hint)
}
case WheelScrollLines:
return QVariant(3);
+ case TouchDoubleTapDistance:
+ {
+ bool ok = false;
+ int dist = qEnvironmentVariableIntValue("QT_DBL_TAP_DIST", &ok);
+ if (!ok)
+ dist = defaultThemeHint(MouseDoubleClickDistance).toInt(&ok) * 2;
+ return QVariant(ok ? dist : 10);
+ }
}
return QVariant();
}
diff --git a/src/gui/kernel/qplatformtheme.h b/src/gui/kernel/qplatformtheme.h
index 686dbed4b1..4135e31517 100644
--- a/src/gui/kernel/qplatformtheme.h
+++ b/src/gui/kernel/qplatformtheme.h
@@ -114,7 +114,8 @@ public:
ContextMenuOnMouseRelease,
MousePressAndHoldInterval,
MouseDoubleClickDistance,
- WheelScrollLines
+ WheelScrollLines,
+ TouchDoubleTapDistance
};
enum DialogType {