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>
bb10
Shawn Rutledge 2016-11-18 09:07:07 +01:00
parent 85f868e73e
commit 705e3f68df
2 changed files with 15 additions and 1 deletions

View File

@ -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();
}

View File

@ -114,7 +114,8 @@ public:
ContextMenuOnMouseRelease,
MousePressAndHoldInterval,
MouseDoubleClickDistance,
WheelScrollLines
WheelScrollLines,
TouchDoubleTapDistance
};
enum DialogType {