Add flicking behavior hints to platform integration and theme
These will be used in QtQuick Flickable. Flickable.flickDeceleration is a sort of friction, the rate at which a flick will decelerate when the user is flicking on a touchscreen or rolling a clicky mouse wheel, and then flicking stops. So far, the default has always been 1500 (defined in qtdeclarative), which (everyone seems to agree) prevents Flickable from slowing down reasonably fast when scrolling stops. So let's try 5000 logical pixels / sec² as a default, and each platform will be able to customize it. The docs already say "The default value is platform dependent"; now it can come from StyleHint::FlickDeceleration. FlickMaximumVelocity: the units are in logical pixels / sec. The default has always been 2500 in qtdeclarative, but there were some early complaints that Flickable was too slow on Android, for example (which were somewhat mitigated by DPI conversions). So now that also becomes adjustable on each platform (although really, it should be mainly the DPI that matters, because the user's perception is in actual distance moved per second). FlickStartDistance is how many logical pixels the Flickable must be dragged by a finger before it begins the animation to keep moving when the finger is lifted. (Analogous to StartDragDistance for mouse-drags) [ChangeLog][QPA] Added platform FlickStartDistance, FlickMaximumVelocity and FlickDeceleration hints for the benefit of QtQuick Flickable Task-number: QTBUG-35608 Task-number: QTBUG-35609 Task-number: QTBUG-52643 Task-number: QTBUG-97055 Change-Id: If50c1de895c127f4b0ab0634c865f469a38e08ba Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>bb10
parent
942abaae59
commit
bb1f616ff1
|
|
@ -410,6 +410,12 @@ QVariant QPlatformIntegration::styleHint(StyleHint hint) const
|
|||
return QPlatformTheme::defaultThemeHint(QPlatformTheme::MouseQuickSelectionThreshold);
|
||||
case MouseDoubleClickDistance:
|
||||
return QPlatformTheme::defaultThemeHint(QPlatformTheme::MouseDoubleClickDistance);
|
||||
case FlickStartDistance:
|
||||
return QPlatformTheme::defaultThemeHint(QPlatformTheme::FlickStartDistance);
|
||||
case FlickMaximumVelocity:
|
||||
return QPlatformTheme::defaultThemeHint(QPlatformTheme::FlickMaximumVelocity);
|
||||
case FlickDeceleration:
|
||||
return QPlatformTheme::defaultThemeHint(QPlatformTheme::FlickDeceleration);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -161,7 +161,10 @@ public:
|
|||
WheelScrollLines,
|
||||
ShowShortcutsInContextMenus,
|
||||
MouseQuickSelectionThreshold,
|
||||
MouseDoubleClickDistance
|
||||
MouseDoubleClickDistance,
|
||||
FlickStartDistance,
|
||||
FlickMaximumVelocity,
|
||||
FlickDeceleration
|
||||
};
|
||||
|
||||
virtual QVariant styleHint(StyleHint hint) const;
|
||||
|
|
|
|||
|
|
@ -513,6 +513,12 @@ QVariant QPlatformTheme::themeHint(ThemeHint hint) const
|
|||
return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::ShowShortcutsInContextMenus);
|
||||
case QPlatformTheme::SetFocusOnTouchRelease:
|
||||
return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::SetFocusOnTouchRelease);
|
||||
case QPlatformTheme::FlickStartDistance:
|
||||
return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::FlickStartDistance);
|
||||
case QPlatformTheme::FlickMaximumVelocity:
|
||||
return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::FlickMaximumVelocity);
|
||||
case QPlatformTheme::FlickDeceleration:
|
||||
return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::FlickDeceleration);
|
||||
default:
|
||||
return QPlatformTheme::defaultThemeHint(hint);
|
||||
}
|
||||
|
|
@ -613,6 +619,12 @@ QVariant QPlatformTheme::defaultThemeHint(ThemeHint hint)
|
|||
return QVariant::fromValue(QList<Qt::Key>({ Qt::Key_Space, Qt::Key_Select }));
|
||||
case SetFocusOnTouchRelease:
|
||||
return false;
|
||||
case FlickStartDistance:
|
||||
return QVariant(15);
|
||||
case FlickMaximumVelocity:
|
||||
return QVariant(2500);
|
||||
case FlickDeceleration:
|
||||
return QVariant(5000);
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -88,7 +88,10 @@ public:
|
|||
ShowDirectoriesFirst,
|
||||
PreselectFirstFileInDirectory,
|
||||
ButtonPressKeys,
|
||||
SetFocusOnTouchRelease
|
||||
SetFocusOnTouchRelease,
|
||||
FlickStartDistance,
|
||||
FlickMaximumVelocity,
|
||||
FlickDeceleration
|
||||
};
|
||||
Q_ENUM(ThemeHint)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue