ScrollViewProperties

Since: BlackBerry 10.0.0

#include <bb/cascades/ScrollViewProperties>

A set of behavioral properties that can be applied to a ScrollView.

The ScrollViewProperties class includes the following property:

  • scrollMode: The scroll mode for the scroll view

Here's how to use ScrollViewProperties in C++:

ScrollView* pMyScrollView = ScrollView::create(pMyContent);
pMyScrollView->setScrollMode(ScrollMode::Vertical);

And here's how to use them in QML:

ScrollView {
    Container {
       Button {}
    }
    scrollViewProperties {
        scrollMode: ScrollMode.Vertical
    }
}


Overview

Inheritance

bb::cascades::BaseObject
bb::cascades::UIObject
bb::cascades::ScrollViewProperties

QML properties

initialScalingMethod: bb::cascades::ScalingMethod::Type
maxContentScale: float
minContentScale: float
overScrollEffectMode: bb::cascades::OverScrollEffectMode::Type
pinchToZoomEnabled: bool
scrollMode: bb::cascades::ScrollMode::Type
scrollRailsPolicy: bb::cascades::ScrollRailsPolicy::Type
attachedObjects: QDeclarativeListProperty< QObject > [read-only]Inherited
objectName: QStringInherited
parent: QObject [read-only]Inherited

Public Functions Index

ScrollViewProperties ()
virtual ~ScrollViewProperties ()
bb::cascades::ScalingMethod::TypeinitialScalingMethod () const
floatmaxContentScale () const
floatminContentScale () const
bb::cascades::OverScrollEffectMode::TypeoverScrollEffectMode () const
boolpinchToZoomEnabled () const
Q_SLOT voidresetInitialScalingMethod ()
Q_SLOT voidresetOverScrollEffectMode ()
Q_SLOT voidresetScrollMode ()
Q_SLOT voidresetScrollRailsPolicy ()
bb::cascades::ScrollMode::TypescrollMode () const
bb::cascades::ScrollRailsPolicy::TypescrollRailsPolicy () const
Q_SLOT voidsetInitialScalingMethod (bb::cascades::ScalingMethod::Type scalingMethod)
Q_SLOT voidsetMaxContentScale (float scale)
Q_SLOT voidsetMinContentScale (float scale)
Q_SLOT voidsetOverScrollEffectMode (bb::cascades::OverScrollEffectMode::Type overScrollEffectMode)
Q_SLOT voidsetPinchToZoomEnabled (bool enabled)
Q_SLOT voidsetScrollMode (bb::cascades::ScrollMode::Type scrollMode)
Q_SLOT voidsetScrollRailsPolicy (bb::cascades::ScrollRailsPolicy::Type scrollRailsPolicy)
virtual boolevent (QEvent *event)Inherited
voidsetObjectName (const QString &name)Inherited
virtual Q_INVOKABLE QStringtoDebugString () const Inherited

Protected Functions Index

Only has inherited protected functions

BaseObject (QObject *parent=0)Inherited
virtual voidconnectNotify (const char *signal)Inherited
virtual voiddisconnectNotify (const char *signal)Inherited

Signals Index

voidinitialScalingMethodChanged (bb::cascades::ScalingMethod::Type newInitialScalingMethod)
voidmaxContentScaleChanged (float scale)
voidminContentScaleChanged (float scale)
voidoverScrollEffectModeChanged (bb::cascades::OverScrollEffectMode::Type newOverScrollEffectMode)
voidpinchToZoomEnabledChanged (bool enabled)
voidscrollModeChanged (bb::cascades::ScrollMode::Type newScrollMode)
voidscrollRailsPolicyChanged (bb::cascades::ScrollRailsPolicy::Type newScrollRailsPolicy)
voidcreationCompleted ()Inherited
voidobjectNameChanged (const QString &objectName)Inherited

Properties

bb::cascades::ScalingMethod::Type initialScalingMethod

The scaling method for the content.

Specifies how the viewableArea is mapped to the viewport when the scrollview is initialized or when content is zoomed out to minimum zoom level (when content is shown in its entirety).

Allowed values for this property are: AspectFit - content is shown in the viewport in its entirety, centered vertically/horizontally if aspect ratio doesn't match, viewableArea set to content dimensions, scale is set accordingly AspectFill - viewport is filled, visible area and scale depend on what fit in the viewport None - content is shown with scale of 1.0f and is either cropped if the content is larger than the viewport, or centered if it is smaller

Note:

method Fill doesn't make sense in this application, the control always scales the content preserving content's aspect ratio.

The default value is ScalingMethod::None.

When changing scaling method the scalingMethodChanged() signal will be emitted.

Since:

BlackBerry 10.0.0

float maxContentScale

Specifies the maximum amount of scale the user can zoom content to using pinch gesture.

If the user reaches this scale factor when pinching the content won't zoom any more and will bounce back to zoom level allowed by the maxContentScale.

This property only has effect if pinchToZoomEnabled property is set to true, meaning the user can scale the content using pinch gesture.

When this property changes a maxContentScaleChanged() signal is emitted.

The default value of this property is MAX_FLOAT meaning there's no scale limit.

Since:

BlackBerry 10.0.0

float minContentScale

Specifies the minimum amount of scale the user can zoom content to using pinch gesture.

If the user reaches this scale factor when pinching the content won't zoom any more and will bounce back to zoom level allowed by the minContentScale.

This property only has effect if pinchToZoomEnabled property is set to true, meaning the user can scale the content using pinch gesture.

When this property changes a minContentScaleChanged() signal is emitted.

The default value of this property is 0 meaning there's no scale limit.

Since:

BlackBerry 10.0.0

bb::cascades::OverScrollEffectMode::Type overScrollEffectMode

Specifies how overscroll effects are applied.

This property only affects the effect when the user interact with the ScrollView. An overscroll effect is never applied to an axis that is not scrollable

Possible values for this property are OverScrollEffectMode::None, OverScrollEffectMode::OnScroll, OverScrollEffectMode::OnPinch, and OverScrollEffectMode::OnPinchAndScroll.

When this property changes, a overScrollEffectModeChanged() signal is emitted.

The default value of this property is ScrollMode::OnPinchAndScroll meaning that the effect is applied to both scroll and scale if scrollMode and pinchToZoomEnabled allows them to be applied.

Since:

BlackBerry 10.0.0

bool pinchToZoomEnabled

Specifies whether the user can use pinch gesture to scale the content in the viewport.

This property only affects the ability of the user to use pinch gesture to scale content up or down. It does not limit the use of the APIs such as zoomToPoint().

When this property is true the user can use the pinch gesture to scale the content up or down. The ScrollView::contentScale and ScrollView::viewableArea properties of the ScrollView will be updated continuously as the user applies the gesture as well as when the ends the gesture.

When this property changes a pinchToZoomEnabledChanged() signals is emited.

The default value of this property is false.

Since:

BlackBerry 10.0.0

bb::cascades::ScrollMode::Type scrollMode

Specifies whether the user can scroll content in a particular direction.

This property only affects the ability of the user to scroll the content using dragging or swiping. The application can scroll using the scrollToPoint() method regardless of the value of this property.

Possible values for this property are ScrollMode::None, ScrollMode::Vertical, ScrollMode::Horizontal, and ScrollMode::Both. If the scroll mode is disabled (scrollMode is set to None), the user will not be able to scroll the content. When the scrolling is enabled, users are able to scroll in the specified direction(s) up to the bounding edge of the container.

Changing the scrollMode doesn't affect the viewableArea.

When this property changes, a scrollModeChanged() signals is emitted.

The default value of this property is ScrollMode::Vertical meaning that the user can only scroll content vertically.

Since:

BlackBerry 10.0.0

bb::cascades::ScrollRailsPolicy::Type scrollRailsPolicy

Specifies the rails policy for scrolling.

The rails policy determines how scrolling behaves in response to a user's dragging gestures. If scrolling is not locked to an axis, the scrolling behavior emulates the user's dragging gestures in all directions. Otherwise, scrolling can become locked along a particular axis if the user's dragging gesture is roughly aligned with that axis.

Rails policies do not affect programmatic scrolling (for example, calling scroll APIs like scrollToPoint()).

Rails policies do affect the scrolling behavior of a parent ScrollView. So, if a child ScrollView has scrolling locked along a particular axis, the same will apply for the parent.

Since:

BlackBerry 10.2.0

QDeclarativeListProperty< QObject > attachedObjectsInherited[read-only]

A hierarchical list of the UIObject's attached objects.

This QDeclarativeListProperty can contain any QObject. When a QObject is added to property, the UIObject takes ownership of the attached object.

This feature is typically used from QML to specify business logic object or any other shared objects for the subnodes of this UIObject. In C++ the same functionality can be achived by setting a parent of a QObject to be attached to the QObject which is going to own it.

QML usage example (MyObject is a custom class registered for QML using the qmlRegisterType() function):

Container {
    Label { text: "Title: " + myObject.title } 
    Label { text: "Subject: " + myObject.subject }
    attachedObjects: [
        MyObject { id: myObject
            title: "Hello World"
            subject: "Nice Day"
        }
    ]
}

Since:

BlackBerry 10.0.0

QString objectNameInherited

This property is overridden from QObject.

As the objectName property is overridden from the QObject class, this signal will not be emitted if setObjectName() function is called directly on QObject.

The default value of this property is QString::null.

See also:

QObject::objectName().

Since:

BlackBerry 10.0.0

QObject parentInherited[read-only]

A read-only property that represents this object's parent.

The parent of an object is specified using QObject::setParent(QObject*). The purpose of the property is to expose the object's parent to QML.

This property is read-only to prevent modifications from QML, where typically the parent is declaratively set. In C++ code, the parent can be explicitly set using QObject::setParent(QObject*), or implicitly set by adding it to a visual container.

The default value of this property is 0.

Since:

BlackBerry 10.0.0

Public Functions

ScrollViewProperties ()

Constructs a ScrollViewProperties.

Since:

BlackBerry 10.0.0

virtual~ScrollViewProperties ()

Destructor.

Since:

BlackBerry 10.0.0

bb::cascades::ScalingMethod::Type initialScalingMethod ()

Returns the current scale method for the content of the ScrollView.

The default method is ScalingMethod::None.

Return:

The scale method for the content of the ScrollView.

Since:

BlackBerry 10.0.0

float maxContentScale ()

Get the maximum allowed content scale factor for pinch zoom.

Return:

Maximum scale factor allowed

Since:

BlackBerry 10.0.0

float minContentScale ()

Get the minimum allowed content scale factor for pinch zoom.

Return:

Minimum scale factor allowed

Since:

BlackBerry 10.0.0

bb::cascades::OverScrollEffectMode::Type overScrollEffectMode ()

Returns the overscroll effect mode of the ScrollView.

The default mode is OverScrollEffectMode::OnPinchAndScroll.

Return:

The overscroll effect mode of the ScrollView.

Since:

BlackBerry 10.0.0

bool pinchToZoomEnabled ()

Get whether pinch to zoom is enabled or not.

Return:

Whether pinch to zoom is enabled or not

Since:

BlackBerry 10.0.0

Q_SLOT void resetInitialScalingMethod ()

Resets the current scaling method to the default mode ScalingMethod::None.

Since:

BlackBerry 10.0.0

Q_SLOT void resetOverScrollEffectMode ()

Resets the current overscroll effect mode to the default mode ScrollMode::OnPinchAndScroll.

Since:

BlackBerry 10.0.0

Q_SLOT void resetScrollMode ()

Resets the current scroll mode to the default mode ScrollMode::Both.

Since:

BlackBerry 10.0.0

Q_SLOT void resetScrollRailsPolicy ()

Resets the current rails policy to the default.

Since:

BlackBerry 10.2.0

bb::cascades::ScrollMode::Type scrollMode ()

Returns the current scroll mode of the ScrollView.

The default mode is ScrollMode::Both.

Return:

The scroll mode of the ScrollView.

Since:

BlackBerry 10.0.0

bb::cascades::ScrollRailsPolicy::Type scrollRailsPolicy ()

Returns the current rails policy of the ScrollView.

Return:

The rails policy of the ScrollView.

Since:

BlackBerry 10.2.0

Q_SLOT void setInitialScalingMethod (

Sets the scaling method for the content of the ScrollView.

The scalingMethodChanged() signal will be emitted if operation was successful.

Parameters
scalingMethod

The scaling method for the content of the ScrollView. Note that method Fill doesn't make sense in this application, the control always scales the content preserving content's aspect ratio.

Since:

BlackBerry 10.0.0

Q_SLOT void setMaxContentScale (
  • floatscale)

Set the maximum allowed content scale factor for pinch zoom.

Parameters
scale

Maximum scale factor allowed

Since:

BlackBerry 10.0.0

Q_SLOT void setMinContentScale (
  • floatscale)

Set the minimum allowed content scale factor for pinch zoom.

Parameters
scale

Minimum scale allowed

Since:

BlackBerry 10.0.0

Q_SLOT void setOverScrollEffectMode (

Sets the overscroll effect mode of the ScrollView.

The overScrollEffectMode() signal will be emitted if operation was successful.

Parameters
overScrollEffectMode

The overscroll effect mode of the ScrollView.

Since:

BlackBerry 10.0.0

Q_SLOT void setPinchToZoomEnabled (
  • boolenabled)

Set whether pinch to zoom is enabled or not.

Parameters
enabled

Whether pinch to zoom is enabled or not

Since:

BlackBerry 10.0.0

Q_SLOT void setScrollMode (

Sets the scroll mode of the ScrollView.

The scrollModeChanged() signal will be emitted if operation was successful.

Parameters
scrollMode

The scroll mode of the ScrollView.

Since:

BlackBerry 10.0.0

Q_SLOT void setScrollRailsPolicy (

Sets the rails policy of the ScrollView.

The scrollRailsPolicyChanged() signal will be emitted if operation was successful.

Parameters
scrollRailsPolicy

The rails policy of the ScrollView.

Since:

BlackBerry 10.2.0

virtual bool event (Inherited

Overloaded to implement the event mechanism in Cascades.

Warning!

If this function is overridden, it must be called by the derived class for events to work properly in Cascades.

Parameters
event

The received event.

Return:

True if the received event was recognized and processed, false otherwise.

Since:

BlackBerry 10.0.0

void setObjectName (Inherited

Sets the objectName property.

Parameters
name

The new name for the object.

Since:

BlackBerry 10.0.0

virtual Q_INVOKABLE QString toDebugString ()Inherited

Returns a debug string representing this object.

Return:

A debug string for the object.

Since:

BlackBerry 10.0.0

Protected Functions

(Only has inherited protected functions)

BaseObject (Inherited

Constructs an instance of BaseObject's subclass.

Parameters
parent

An optional parent, defaults to 0.

Since:

BlackBerry 10.0.0

virtual void connectNotify (
  • const char *signal)
Inherited

Overloaded to implement the event mechanism in Cascades.

If this function is overridden, it must be called by the derived class for events to work properly in Cascades.

Parameters
signal

The connected signal.

Since:

BlackBerry 10.0.0

virtual void disconnectNotify (
  • const char *signal)
Inherited

Overloaded to implement the event mechanism in Cascades.

If this function is overridden, it must be called by the derived class for events to work properly in Cascades.

Parameters
signal

The disconnected signal.

Since:

BlackBerry 10.0.0

Signals

void initialScalingMethodChanged (

Emitted when the initial scaling method has changed.

Parameters
newInitialScalingMethod

The new initial scaling method

Since:

BlackBerry 10.0.0

void maxContentScaleChanged (
  • floatscale)

Emitted when the maximum allowed scale factor has changed.

Parameters
scale

The new maximum content scale factor

Since:

BlackBerry 10.0.0

void minContentScaleChanged (
  • floatscale)

Emitted when the minimum allowed scale factor has changed.

Parameters
scale

The new minimum content scale factor

Since:

BlackBerry 10.0.0

void overScrollEffectModeChanged (

Emitted when the overscroll effect mode has changed.

Parameters
newOverScrollEffectMode

The new overscroll effect mode

Since:

BlackBerry 10.0.0

void pinchToZoomEnabledChanged (
  • boolenabled)

Emitted when pinchToZoomEnabled has changed.

Parameters
enabled

Whether pinch to zoom is enabled or not.

Since:

BlackBerry 10.0.0

void scrollModeChanged (

Emitted when the scroll mode has changed.

Parameters
newScrollMode

The new scroll mode

Since:

BlackBerry 10.0.0

void scrollRailsPolicyChanged (

Emitted when the rails policy has changed.

Parameters
newScrollRailsPolicy

The new rails policy.

Since:

BlackBerry 10.2.0

void creationCompleted ()Inherited

This signal is emitted only when this object is instantiated as a result of loading a QML document and creating the root node, or when an object is being constructed using its builder class.

This signal is emitted only when this object is instantiated as a result of loading a QML document and creating the root node (only after the root component that caused this instantiation has completed construction), or when the object is being constructed from its builder class. This signal is emitted to indicate that the construction and initialization of the object has been completed, the properties are initialized, and any QML binding values have been assigned to the object.

This signal is not emitted when the object is constructed from C++ using the constructor. If the object is constructed using its builder class, the signal is emitted when the the builder class returns the fully constructed object.

This signal can be used when there is an activity that needs to be performed, such as a property state integrity verification after the object is instantiated from a QML document or a builder, but before control is returned to the application.

See also:

QmlDocument

Since:

BlackBerry 10.0.0

void objectNameChanged (Inherited

This signal is emitted when the objectName property is changed.

Since:

BlackBerry 10.0.0

Last modified: 2014-03-13

comments powered by Disqus