Add veryShortDuration

This adds an veryShortDuration for UI elements that should animate near instantly, but should have a hint of smoothness.
This commit is contained in:
Carson Black 2020-12-12 01:39:47 -05:00 committed by Jan Blackquill
parent ddac70f40c
commit aecf9237cc
4 changed files with 29 additions and 0 deletions

View File

@ -261,6 +261,11 @@ int Units::shortDuration() const
return qMax(1, qRound(m_longDuration * 0.6));
}
int Units::veryShortDuration() const
{
return qRound(m_longDuration * 0.3);
}
int Units::veryLongDuration() const
{
return m_longDuration * 2;

View File

@ -119,6 +119,12 @@ class Units : public QObject
*/
Q_PROPERTY(int shortDuration READ shortDuration NOTIFY durationChanged)
/**
* units.veryShortDuration should be used for elements that should animate near instantly,
* but should have a hint of smoothness
*/
Q_PROPERTY(int veryShortDuration READ veryShortDuration NOTIFY durationChanged)
/**
* units.veryLongDuration should be used for specialty animations that benefit
* from being even longer than longDuration.
@ -186,6 +192,12 @@ public:
* @since 5.69
*/
int veryLongDuration() const;
/**
* @return Duration for instantaneous animations, in milliseconds.
* @since 5.78
*/
int veryShortDuration() const;
/// @endcond
/**

View File

@ -96,6 +96,12 @@ QtObject {
*/
property int veryLongDuration: units.veryLongDuration
/**
* units.veryShortDuration should be used for elements that should have a hint of smoothness,
* but otherwise animate near instantly.
*/
property int veryShortDuration: units.veryShortDuration
readonly property QtObject __styleItem: QtQuickControlsPrivate.StyleItem {elementType: "frame" }
/**

View File

@ -84,6 +84,12 @@ QtObject {
*/
property int shortDuration: units.shortDuration
/**
* units.veryShortDuration should be used for elements that should have a hint of smoothness,
* but otherwise animate near instantly.
*/
property int veryShortDuration: units.veryShortDuration
/**
* units.veryLongDuration should be used for specialty animations that benefit
* from being even longer than longDuration.