ScrollViewProperties
#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
}
}
BlackBerry 10.0.0
Inheritance
| bb::cascades::BaseObject | |||
| bb::cascades::UIObject | |||
| bb::cascades::ScrollViewProperties | |||
QML properties
| overScrollEffectMode | : bb::cascades::OverScrollEffectMode::Type |
| initialScalingMethod | : bb::cascades::ScalingMethod::Type |
| scrollMode | : bb::cascades::ScrollMode::Type |
| pinchToZoomEnabled | : bool |
| maxContentScale | : float |
| minContentScale | : float |
| attachedObjects | : QDeclarativeListProperty< QObject > [read-only] |
| objectName | : QString |
| parent | : QObject [read-only] |
QML signals
Properties Index
| bb::cascades::OverScrollEffectMode::Type | overScrollEffectMode |
| bb::cascades::ScalingMethod::Type | initialScalingMethod |
| bb::cascades::ScrollMode::Type | scrollMode |
| bool | pinchToZoomEnabled |
| float | maxContentScale |
| float | minContentScale |
| QDeclarativeListProperty< QObject > | attachedObjects [read-only] |
| QString | objectName |
| QObject | parent [read-only] |
Public Functions Index
| ScrollViewProperties () | |
| virtual | ~ScrollViewProperties () |
| Q_SLOT void | setOverScrollEffectMode (bb::cascades::OverScrollEffectMode::Type overScrollEffectMode) |
| bb::cascades::OverScrollEffectMode::Type | overScrollEffectMode () const |
| Q_SLOT void | resetOverScrollEffectMode () |
| Q_SLOT void | setScrollMode (bb::cascades::ScrollMode::Type scrollMode) |
| bb::cascades::ScrollMode::Type | scrollMode () const |
| Q_SLOT void | resetScrollMode () |
| Q_SLOT void | setInitialScalingMethod (bb::cascades::ScalingMethod::Type scalingMethod) |
| bb::cascades::ScalingMethod::Type | initialScalingMethod () const |
| Q_SLOT void | resetInitialScalingMethod () |
| Q_SLOT void | setPinchToZoomEnabled (bool enabled) |
| bool | pinchToZoomEnabled () const |
| Q_SLOT void | setMaxContentScale (float scale) |
| float | maxContentScale () const |
| float | minContentScale () const |
| Q_SLOT void | setMinContentScale (float scale) |
| virtual bool | event (QEvent *event) |
| void | setObjectName (const QString &name) |
| virtual Q_INVOKABLE QString | toDebugString () const |
Protected Functions Index
Only has inherited protected functions
| BaseObject (QObject *parent=0) | |
| virtual void | connectNotify (const char *signal) |
| virtual void | disconnectNotify (const char *signal) |
Signals Index
| void | overScrollEffectModeChanged (bb::cascades::OverScrollEffectMode::Type newOverScrollEffectMode) |
| void | scrollModeChanged (bb::cascades::ScrollMode::Type newScrollMode) |
| void | initialScalingMethodChanged (bb::cascades::ScalingMethod::Type newInitialScalingMethod) |
| void | pinchToZoomEnabledChanged (bool enabled) |
| void | minContentScaleChanged (float scale) |
| void | maxContentScaleChanged (float scale) |
| void | creationCompleted () |
| void | objectNameChanged (const QString &objectName) |
Properties
bb::cascades::OverScrollEffectMode::Type
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.
BlackBerry 10.0.0
bb::cascades::ScalingMethod::Type
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
method Fill doesn't make sense in this application, the control always scales the content preserving content's aspect ratio.
When changing scaling method the scalingMethodChanged() signal will be emitted.
BlackBerry 10.0.0
bb::cascades::ScrollMode::Type
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.
BlackBerry 10.0.0
bool
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.
BlackBerry 10.0.0
float
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.
BlackBerry 10.0.0
float
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.
BlackBerry 10.0.0
QDeclarativeListProperty< QObject >
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"
}
]
}
BlackBerry 10.0.0
QString
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.
QObject::objectName().
BlackBerry 10.0.0
QObject
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.
BlackBerry 10.0.0
Public Functions
Constructs a ScrollViewProperties.
BlackBerry 10.0.0
virtual
Destructor.
BlackBerry 10.0.0
Q_SLOT void
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. |
BlackBerry 10.0.0
bb::cascades::OverScrollEffectMode::Type
Returns the overscroll effect mode of the ScrollView.
The default mode is OverScrollEffectMode::OnPinchAndScroll.
The overscroll effect mode of the ScrollView.
BlackBerry 10.0.0
Q_SLOT void
Resets the current overscroll effect mode to the default mode ScrollMode::OnPinchAndScroll.
BlackBerry 10.0.0
Q_SLOT void
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. |
BlackBerry 10.0.0
bb::cascades::ScrollMode::Type
Returns the current scroll mode of the ScrollView.
The default mode is ScrollMode::Both.
The scroll mode of the ScrollView.
BlackBerry 10.0.0
Q_SLOT void
Resets the current scroll mode to the default mode ScrollMode::Both.
BlackBerry 10.0.0
Q_SLOT void
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. |
BlackBerry 10.0.0
bb::cascades::ScalingMethod::Type
Returns the current scale method for the content of the ScrollView.
The default method is ScalingMethod::None.
The scale method for the content of the ScrollView.
BlackBerry 10.0.0
Q_SLOT void
Resets the current scaling method to the default mode ScalingMethod::None.
BlackBerry 10.0.0
Q_SLOT void
Set whether pinch to zoom is enabled or not.
| Parameters | |
|---|---|
| enabled |
Whether pinch to zoom is enabled or not |
BlackBerry 10.0.0
bool
Get whether pinch to zoom is enabled or not.
Whether pinch to zoom is enabled or not
BlackBerry 10.0.0
Q_SLOT void
Set the maximum allowed content scale factor for pinch zoom.
| Parameters | |
|---|---|
| scale |
Maximum scale factor allowed |
BlackBerry 10.0.0
float
Get the maximum allowed content scale factor for pinch zoom.
Maximum scale factor allowed
BlackBerry 10.0.0
float
Get the minimum allowed content scale factor for pinch zoom.
Minimum scale factor allowed
BlackBerry 10.0.0
Q_SLOT void
Set the minimum allowed content scale factor for pinch zoom.
| Parameters | |
|---|---|
| scale |
Minimum scale allowed |
BlackBerry 10.0.0
virtual bool 
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 | |
|---|---|
| event |
The received event. |
True if the received event was recognized and processed, false otherwise.
BlackBerry 10.0.0
void 
Sets the objectName property.
| Parameters | |
|---|---|
| name |
The new name for the object. |
BlackBerry 10.0.0
virtual Q_INVOKABLE QString 
Returns a debug string representing this object.
A debug string for the object.
BlackBerry 10.0.0
Protected Functions
(Only has inherited protected functions)
Constructs an instance of BaseObject's subclass.
| Parameters | |
|---|---|
| parent |
An optional parent, defaults to 0. |
BlackBerry 10.0.0
virtual void 
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. |
BlackBerry 10.0.0
virtual void 
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. |
BlackBerry 10.0.0
Signals
void
Emitted when the overscroll effect mode has changed.
| Parameters | |
|---|---|
| newOverScrollEffectMode |
The new overscroll effect mode |
BlackBerry 10.0.0
void
Emitted when the scroll mode has changed.
| Parameters | |
|---|---|
| newScrollMode |
The new scroll mode |
BlackBerry 10.0.0
void
Emitted when the initial scaling method has changed.
| Parameters | |
|---|---|
| newInitialScalingMethod |
The new initial scaling method |
BlackBerry 10.0.0
void
Emitted when pinchToZoomEnabled has changed.
| Parameters | |
|---|---|
| enabled |
Whether pinch to zoom is enabled or not. |
BlackBerry 10.0.0
void
Emitted when the minimum allowed scale factor has changed.
| Parameters | |
|---|---|
| scale |
The new minimum content scale factor |
BlackBerry 10.0.0
void
Emitted when the maximum allowed scale factor has changed.
| Parameters | |
|---|---|
| scale |
The new maximum content scale factor |
BlackBerry 10.0.0
void 
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.
BlackBerry 10.0.0
void 
This signal is emitted when the objectName property is changed.
BlackBerry 10.0.0