CopperSpice API  1.9.1
QScrollerProperties Class Reference

Stores the settings for a QScroller. More...

Public Types

enum  FrameRates
 
enum  OvershootPolicy
 
enum  ScrollMetric
 

Public Methods

 QScrollerProperties ()
 
 QScrollerProperties (const QScrollerProperties &sp)
 
virtual ~QScrollerProperties ()
 
bool operator!= (const QScrollerProperties &other) const
 
QScrollerProperties & operator= (const QScrollerProperties &other)
 
bool operator== (const QScrollerProperties &other) const
 
QVariant scrollMetric (ScrollMetric metric) const
 
void setScrollMetric (ScrollMetric metric, const QVariant &value)
 

Static Public Methods

static void setDefaultScrollerProperties (const QScrollerProperties &sp)
 
static void unsetDefaultScrollerProperties ()
 

Friends

class QScroller
 

Detailed Description

The QScrollerProperties class stores the parameters used by QScroller. The default settings are platform dependent so CopperSpice emulates the platform behavior for kinetic scrolling. As a convention the QScrollerProperties are in physical units (meter, seconds) and are converted by QScroller using the current DPI.

See also
QScroller

Member Enumeration Documentation

This enum describes the available frame rates used while dragging or scrolling.

Constant Value Description
QScrollerProperties::Standard 0 Default value is 60 frames per second
QScrollerProperties::Fps60 1 60 frames per second
QScrollerProperties::Fps30 2 30 frames per second
QScrollerProperties::Fps20 3 20 frames per second

This enum describes the various modes of overshooting.

Constant Value Description
QScrollerProperties::OvershootWhenScrollable 0 Overshooting is possible when the content is scrollable. This is the default.
QScrollerProperties::OvershootAlwaysOff 1 Overshooting is never enabled, even when the content is scrollable.
QScrollerProperties::OvershootAlwaysOn 2 Overshooting is always enabled, even when the content is not scrollable.

This enum contains the different scroll metric types. When not indicated otherwise the setScrollMetric() method expects a QVariant of type double. Refer to the QScroller documentation for further details of the concepts behind the different values.

Constant Value Description
QScrollerProperties::MousePressEventDelay 0 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.
QScrollerProperties::DragStartDistance 1 The minimum distance the touch or mouse point needs to be moved before the flick gesture is triggered in m.
QScrollerProperties::DragVelocitySmoothingFactor 2 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.
QScrollerProperties::AxisLockThreshold 3 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.
QScrollerProperties::ScrollingCurve 4 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).
QScrollerProperties::DecelerationFactor 5 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
QScrollerProperties::MinimumVelocity 6 The minimum velocity that is needed after ending the touch or releasing the mouse to start scrolling in m/s.
QScrollerProperties::MaximumVelocity 7 This is the maximum velocity that can be reached in m/s.
QScrollerProperties::MaximumClickThroughVelocity 8 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.
QScrollerProperties::AcceleratingFlickMaximumTime 9 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.
QScrollerProperties::AcceleratingFlickSpeedupFactor 10 The current speed is multiplied by this number if an accelerating flick is detected. Should be >= 1.
QScrollerProperties::SnapPositionRatio 11 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.
QScrollerProperties::SnapTime 12 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.
QScrollerProperties::OvershootDragResistanceFactor 13 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.
QScrollerProperties::OvershootDragDistanceFactor 14 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.
QScrollerProperties::OvershootScrollDistanceFactor 15 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.
QScrollerProperties::OvershootScrollTime 16 This is the time in seconds that is used to play the complete overshoot animation.
QScrollerProperties::HorizontalOvershootPolicy 17 This is the horizontal overshooting policy (refer to OvershootPolicy).
QScrollerProperties::VerticalOvershootPolicy 18 This is the horizontal overshooting policy (refer to OvershootPolicy).
QScrollerProperties::FrameRate 19 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. Oonly the values of the FrameRates enum are allowed.
QScrollerProperties::ScrollMetricCount 20 This is always the last entry.

Constructor & Destructor Documentation

QScrollerProperties::QScrollerProperties ( )

Constructs new scroller properties.

QScrollerProperties::QScrollerProperties ( const QScrollerProperties &  sp)

Constructs a copy of sp.

QScrollerProperties::~QScrollerProperties ( )
virtual

Destroys the scroller properties.

Method Documentation

bool QScrollerProperties::operator!= ( const QScrollerProperties &  other) const

Returns true if these scroller properties are different from other otherwise returns false.

QScrollerProperties & QScrollerProperties::operator= ( const QScrollerProperties &  other)

Copy assigns from other and returns a reference to this object.

bool QScrollerProperties::operator== ( const QScrollerProperties &  other) const

Returns true if these scroller properties are equal to other otherwise returns false.

QVariant QScrollerProperties::scrollMetric ( QScrollerProperties::ScrollMetric  metric) const

Query the metric value of the scroller properties.

See also
setScrollMetric(), QScrollerProperties::ScrollMetric
void QScrollerProperties::setDefaultScrollerProperties ( const QScrollerProperties &  sp)
static

Sets the scroller properties for all new QScrollerProperties objects to sp. Use this method to override the platform default properties returned by the default constructor. If you only want to change the scroller properties of a single scroller then use QScroller::setScrollerProperties().

Calling this method will not change the content of any existing QScrollerProperties objects.

See also
unsetDefaultScrollerProperties()
void QScrollerProperties::setScrollMetric ( ScrollMetric  metric,
const QVariant value 
)

Set a specific value of the metric ScrollerMetric to value.

See also
scrollMetric(), QScrollerProperties::ScrollMetric
void QScrollerProperties::unsetDefaultScrollerProperties ( )
static

Sets the scroller properties returned by the default constructor back to the platform default properties.

See also
setDefaultScrollerProperties()