![]() |
Qt 6.x
The Qt SDK
|
The QScrollerProperties class stores the settings for a QScroller. More...
#include <qscrollerproperties.h>
Public Types | |
enum | OvershootPolicy { OvershootWhenScrollable , OvershootAlwaysOff , OvershootAlwaysOn } |
This enum describes the various modes of overshooting. More... | |
enum | FrameRates { Standard , Fps60 , Fps30 , Fps20 } |
This enum describes the available frame rates used while dragging or scrolling. More... | |
enum | ScrollMetric { MousePressEventDelay , DragStartDistance , DragVelocitySmoothingFactor , AxisLockThreshold , ScrollingCurve , DecelerationFactor , MinimumVelocity , MaximumVelocity , MaximumClickThroughVelocity , AcceleratingFlickMaximumTime , AcceleratingFlickSpeedupFactor , SnapPositionRatio , SnapTime , OvershootDragResistanceFactor , OvershootDragDistanceFactor , OvershootScrollDistanceFactor , OvershootScrollTime , HorizontalOvershootPolicy , VerticalOvershootPolicy , FrameRate , ScrollMetricCount } |
This enum contains the different scroll metric types. More... | |
Public Member Functions | |
QScrollerProperties () | |
Constructs new scroller properties. | |
QScrollerProperties (const QScrollerProperties &sp) | |
Constructs a copy of sp. | |
QScrollerProperties & | operator= (const QScrollerProperties &sp) |
Assigns sp to these scroller properties and returns a reference to these scroller properties. | |
virtual | ~QScrollerProperties () |
Destroys the scroller properties. | |
bool | operator== (const QScrollerProperties &sp) const |
Returns true if these scroller properties are equal to sp; otherwise returns false . | |
bool | operator!= (const QScrollerProperties &sp) const |
Returns true if these scroller properties are different from sp; otherwise returns false . | |
QVariant | scrollMetric (ScrollMetric metric) const |
Query the metric value of the scroller properties. | |
void | setScrollMetric (ScrollMetric metric, const QVariant &value) |
Set a specific value of the metric ScrollerMetric to value. | |
Static Public Member Functions | |
static void | setDefaultScrollerProperties (const QScrollerProperties &sp) |
Sets the scroller properties for all new QScrollerProperties objects to sp. | |
static void | unsetDefaultScrollerProperties () |
Sets the scroller properties returned by the default constructor back to the platform default properties. | |
Protected Attributes | |
QScopedPointer< QScrollerPropertiesPrivate > | d |
Friends | |
class | QScrollerPropertiesPrivate |
class | QScroller |
class | QScrollerPrivate |
The QScrollerProperties class stores the settings for a QScroller.
\inmodule QtWidgets
The QScrollerProperties class stores the parameters used by QScroller.
The default settings are platform dependent so that Qt emulates the platform behaviour for kinetic scrolling.
As a convention the QScrollerProperties are in physical units (meter, seconds) and are converted by QScroller using the current DPI.
Definition at line 21 of file qscrollerproperties.h.
This enum describes the available frame rates used while dragging or scrolling.
\value Fps60 60 frames per second \value Fps30 30 frames per second \value Fps20 20 frames per second \value Standard the default value is 60 frames per second (which corresponds to QAbstractAnimation).
Enumerator | |
---|---|
Standard | |
Fps60 | |
Fps30 | |
Fps20 |
Definition at line 42 of file qscrollerproperties.h.
This enum describes the various modes of overshooting.
\value OvershootWhenScrollable Overshooting is possible when the content is scrollable. This is the default.
\value OvershootAlwaysOff Overshooting is never enabled, even when the content is scrollable.
\value OvershootAlwaysOn Overshooting is always enabled, even when the content is not scrollable.
Enumerator | |
---|---|
OvershootWhenScrollable | |
OvershootAlwaysOff | |
OvershootAlwaysOn |
Definition at line 35 of file qscrollerproperties.h.
This enum contains the different scroll metric types.
When not indicated otherwise the setScrollMetric function expects a QVariant of type qreal.
See the QScroller documentation for further details of the concepts behind the different values.
\value MousePressEventDelay This is the time a mouse press event is delayed when starting a flick gesture in {[s]}. If the gesture is triggered within that time, no mouse press or release is sent to the scrolled object. If it triggers after that delay the delayed mouse press plus a faked release event at global position
{QPoint(-QWIDGETSIZE_MAX, -QWIDGETSIZE_MAX)} is sent. If the gesture is canceled, then both the delayed mouse press plus the real release event are delivered.
\value DragStartDistance This is the minimum distance the touch or mouse point needs to be moved before the flick gesture is triggered in m
.
\value DragVelocitySmoothingFactor A value that describes to which extent new drag velocities are included in the final scrolling velocity. This value should be in the range between 0
and 1
. The lower the value, the more smoothing is applied to the dragging velocity.
\value AxisLockThreshold Restricts the movement to one axis if the movement is inside an angle around the axis. The threshold must be in the range 0
to 1
.
\value ScrollingCurve The QEasingCurve used when decelerating the scrolling velocity after an user initiated flick. Please note that this is the easing curve for the positions, {not} the velocity: the default is QEasingCurve::OutQuad, which results in a linear decrease in velocity (1st derivative) and a constant deceleration (2nd derivative).
\value DecelerationFactor This factor influences how long it takes the scroller to decelerate to 0 velocity. The actual value depends on the chosen ScrollingCurve. For most types the value should be in the range from 0.1
to 2.0
\value MinimumVelocity The minimum velocity that is needed after ending the touch or releasing the mouse to start scrolling in {m/s}.
\value MaximumVelocity This is the maximum velocity that can be reached in {m/s}.
\value MaximumClickThroughVelocity This is the maximum allowed scroll speed for a click-through in {m/s}. This means that a click on a currently (slowly) scrolling object will not only stop the scrolling but the click event will also be delivered to the UI control. This is useful when using exponential-type scrolling curves.
\value AcceleratingFlickMaximumTime This is the maximum time in seconds
that a flick gesture can take to be recognized as an accelerating flick. If set to zero no such gesture is detected. An "accelerating flick" is a flick gesture executed on an already scrolling object. In such cases the scrolling speed is multiplied by AcceleratingFlickSpeedupFactor in order to accelerate it.
\value AcceleratingFlickSpeedupFactor The current speed is multiplied by this number if an accelerating flick is detected. Should be {>= 1}.
\value SnapPositionRatio This is the distance that the user must drag the area between two snap points in order to snap it to the next position. {0.33} means that the scroll must only reach one third of the distance between two snap points to snap to the next one. The ratio must be between
0
and 1
.
\value SnapTime This is the time factor for the scrolling curve. A lower value means that the scrolling will take longer. The scrolling distance is independent of this value.
\value OvershootDragResistanceFactor This value is the factor between the mouse dragging and the actual scroll area movement (during overshoot). The factor must be between 0
and 1
.
\value OvershootDragDistanceFactor This is the maximum distance for overshoot movements while dragging. The actual overshoot distance is calculated by multiplying this value with the viewport size of the scrolled object. The factor must be between 0
and 1
.
\value OvershootScrollDistanceFactor This is the maximum distance for overshoot movements while scrolling. The actual overshoot distance is calculated by multiplying this value with the viewport size of the scrolled object. The factor must be between 0
and 1
.
\value OvershootScrollTime This is the time in seconds
that is used to play the complete overshoot animation.
\value HorizontalOvershootPolicy This is the horizontal overshooting policy (see OvershootPolicy).
\value VerticalOvershootPolicy This is the horizontal overshooting policy (see OvershootPolicy).
\value FrameRate This is the frame rate which should be used while dragging or scrolling. QScroller uses a QAbstractAnimation timer internally to sync all scrolling operations to other animations that might be active at the same time. If the standard value of 60 frames per second is too fast, it can be lowered with this setting, while still being in-sync with QAbstractAnimation. Please note that only the values of the FrameRates enum are allowed here.
\value ScrollMetricCount This is always the last entry.
Definition at line 49 of file qscrollerproperties.h.
QScrollerProperties::QScrollerProperties | ( | ) |
Constructs new scroller properties.
Definition at line 72 of file qscrollerproperties.cpp.
QScrollerProperties::QScrollerProperties | ( | const QScrollerProperties & | sp | ) |
Constructs a copy of sp.
Definition at line 80 of file qscrollerproperties.cpp.
|
virtual |
Destroys the scroller properties.
Definition at line 97 of file qscrollerproperties.cpp.
bool QScrollerProperties::operator!= | ( | const QScrollerProperties & | sp | ) | const |
Returns true
if these scroller properties are different from sp; otherwise returns false
.
Definition at line 112 of file qscrollerproperties.cpp.
References d, QScopedPointer< T, Cleanup >::data(), and sp.
QScrollerProperties & QScrollerProperties::operator= | ( | const QScrollerProperties & | sp | ) |
Assigns sp to these scroller properties and returns a reference to these scroller properties.
Definition at line 88 of file qscrollerproperties.cpp.
References d, QScopedPointer< T, Cleanup >::data(), and sp.
bool QScrollerProperties::operator== | ( | const QScrollerProperties & | sp | ) | const |
Returns true
if these scroller properties are equal to sp; otherwise returns false
.
Definition at line 104 of file qscrollerproperties.cpp.
References d, QScopedPointer< T, Cleanup >::data(), and sp.
QVariant QScrollerProperties::scrollMetric | ( | ScrollMetric | metric | ) | const |
Query the metric value of the scroller properties.
Definition at line 180 of file qscrollerproperties.cpp.
References AcceleratingFlickMaximumTime, QScrollerPropertiesPrivate::acceleratingFlickMaximumTime, AcceleratingFlickSpeedupFactor, QScrollerPropertiesPrivate::acceleratingFlickSpeedupFactor, AxisLockThreshold, QScrollerPropertiesPrivate::axisLockThreshold, d, DecelerationFactor, QScrollerPropertiesPrivate::decelerationFactor, DragStartDistance, QScrollerPropertiesPrivate::dragStartDistance, DragVelocitySmoothingFactor, QScrollerPropertiesPrivate::dragVelocitySmoothingFactor, FrameRate, QScrollerPropertiesPrivate::frameRate, QVariant::fromValue(), HorizontalOvershootPolicy, QScrollerPropertiesPrivate::hOvershootPolicy, MaximumClickThroughVelocity, QScrollerPropertiesPrivate::maximumClickThroughVelocity, MaximumVelocity, QScrollerPropertiesPrivate::maximumVelocity, MinimumVelocity, QScrollerPropertiesPrivate::minimumVelocity, MousePressEventDelay, QScrollerPropertiesPrivate::mousePressEventDelay, OvershootDragDistanceFactor, QScrollerPropertiesPrivate::overshootDragDistanceFactor, OvershootDragResistanceFactor, QScrollerPropertiesPrivate::overshootDragResistanceFactor, OvershootScrollDistanceFactor, QScrollerPropertiesPrivate::overshootScrollDistanceFactor, OvershootScrollTime, QScrollerPropertiesPrivate::overshootScrollTime, ScrollingCurve, QScrollerPropertiesPrivate::scrollingCurve, ScrollMetricCount, SnapPositionRatio, QScrollerPropertiesPrivate::snapPositionRatio, SnapTime, QScrollerPropertiesPrivate::snapTime, VerticalOvershootPolicy, and QScrollerPropertiesPrivate::vOvershootPolicy.
Referenced by QFlickGestureRecognizer::recognize().
|
static |
Sets the scroller properties for all new QScrollerProperties objects to sp.
Use this function to override the platform default properties returned by the default constructor. If you only want to change the scroller properties of a single scroller, use QScroller::setScrollerProperties()
Definition at line 155 of file qscrollerproperties.cpp.
References QScrollerPropertiesPrivate, and sp.
void QScrollerProperties::setScrollMetric | ( | ScrollMetric | metric, |
const QVariant & | value | ||
) |
Set a specific value of the metric ScrollerMetric to value.
Definition at line 213 of file qscrollerproperties.cpp.
References AcceleratingFlickMaximumTime, QScrollerPropertiesPrivate::acceleratingFlickMaximumTime, AcceleratingFlickSpeedupFactor, QScrollerPropertiesPrivate::acceleratingFlickSpeedupFactor, AxisLockThreshold, QScrollerPropertiesPrivate::axisLockThreshold, d, DecelerationFactor, QScrollerPropertiesPrivate::decelerationFactor, DragStartDistance, QScrollerPropertiesPrivate::dragStartDistance, DragVelocitySmoothingFactor, QScrollerPropertiesPrivate::dragVelocitySmoothingFactor, FrameRate, QScrollerPropertiesPrivate::frameRate, HorizontalOvershootPolicy, QScrollerPropertiesPrivate::hOvershootPolicy, MaximumClickThroughVelocity, QScrollerPropertiesPrivate::maximumClickThroughVelocity, MaximumVelocity, QScrollerPropertiesPrivate::maximumVelocity, MinimumVelocity, QScrollerPropertiesPrivate::minimumVelocity, MousePressEventDelay, QScrollerPropertiesPrivate::mousePressEventDelay, OvershootDragDistanceFactor, QScrollerPropertiesPrivate::overshootDragDistanceFactor, OvershootDragResistanceFactor, QScrollerPropertiesPrivate::overshootDragResistanceFactor, OvershootScrollDistanceFactor, QScrollerPropertiesPrivate::overshootScrollDistanceFactor, OvershootScrollTime, QScrollerPropertiesPrivate::overshootScrollTime, qBound(), ScrollingCurve, QScrollerPropertiesPrivate::scrollingCurve, ScrollMetricCount, SnapPositionRatio, QScrollerPropertiesPrivate::snapPositionRatio, SnapTime, QScrollerPropertiesPrivate::snapTime, VerticalOvershootPolicy, and QScrollerPropertiesPrivate::vOvershootPolicy.
|
static |
Sets the scroller properties returned by the default constructor back to the platform default properties.
Definition at line 169 of file qscrollerproperties.cpp.
|
friend |
Definition at line 91 of file qscrollerproperties.h.
|
friend |
Definition at line 92 of file qscrollerproperties.h.
|
friend |
Definition at line 90 of file qscrollerproperties.h.
Referenced by setDefaultScrollerProperties().
|
protected |
Definition at line 85 of file qscrollerproperties.h.
Referenced by QScrollerPrivate::createScrollingSegments(), QScrollerPrivate::createScrollingSegments(), QScrollerPrivate::createScrollToSegments(), QScrollerPrivate::frameRateSkip(), QScrollerPrivate::handleDrag(), QScrollerPrivate::moveWhilePressed(), operator!=(), operator=(), operator==(), QScrollerPrivate::pressWhileInactive(), QScrollerPrivate::pressWhileScrolling(), QScrollerPrivate::releaseWhileDragging(), scrollMetric(), QScrollerPrivate::setContentPositionHelperDragging(), setScrollMetric(), and QScrollerPrivate::updateVelocity().