PickerProvider
#include <bb/cascades/PickerProvider>
An interface for providing VisualNode objects as items in a Picker.
createItem(): creates an empty VisualNode object for the Picker, to be used as a picker item
updateItem(): updates an existing picker item for a particular cell in the Picker
columnCount(): gets the number of columns in the Picker
Here is how the PickerProvider can be attached to the Picker.
QML:
Picker {
id: picker
title: "Select items";
onCreationCompleted: {
picker.setPickerItemProvider(provider)
}
attachedObjects: [
CustomPickerItemsProvider {
id: provider
columnWidthRatio: [ 2, 1 ]
}
]
}
C++:
Picker *picker = Picker::create().title("Title");
PickerProvider *itemProvider = new MyPickerProvider();
picker->setPickerItemProvider(itemProvider);
BlackBerry 10.1.0
Inheritance
| bb::cascades::BaseObject | ||
| bb::cascades::PickerProvider | ||
QML properties
| columnWidthRatio | : QVariantList |
| objectName | : QString |
| parent | : QObject [read-only] |
QML signals
Properties Index
Public Static Attributes Index
| const int | NoBoundary |
Public Functions Index
| PickerProvider (QObject *parent=0) | |
| virtual | ~PickerProvider () |
| VisualNode * | createItem (Picker *pickerList, int columnIndex)=0 |
| void | updateItem (Picker *pickerList, int columnIndex, int rowIndex, VisualNode *pickerItem)=0 |
| int | columnCount () const =0 |
| virtual void | range (int column, int *lowerBoundary, int *upperBoundary) |
| virtual QVariant | value (Picker *picker, const QList< int > &indices) const |
| virtual QList< int > | indicesOf (Picker *picker, const QVariant &value) const |
| QVariantList | columnWidthRatio () |
| void | setColumnWidthRatio (const QVariantList &ratio) |
| void | resetColumnWidthRatio () |
| void | setObjectName (const QString &name) |
| virtual Q_INVOKABLE QString | toDebugString () const |
Protected Functions Index
Only has inherited protected functions
| BaseObject (QObject *parent=0) |
Signals Index
| void | itemUpdatesNeeded (int column) |
| void | columnWidthRatioChanged (const QVariantList &ratio) |
| void | updateRange (int column) |
| void | creationCompleted () |
| void | objectNameChanged (const QString &objectName) |
Properties
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 Static Attributes
const int
Public Functions
virtual
Destructor.
VisualNode *
Called to create a new item for the Picker.
| Parameters | |
|---|---|
| pickerList |
The generic picker control sending the request. |
| columnIndex |
The column which the item will be added to. |
The VisualNode pointer.
BlackBerry 10.1.0
void
Called to update the content for a picker item.
| Parameters | |
|---|---|
| pickerList |
The generic picker control sending the request. |
| columnIndex |
The column which the item is shown in. |
| rowIndex |
The item index this node is mapped to on the server. |
| pickerItem |
Pointer to the picker item to update. |
BlackBerry 10.1.0
int
Gets the number of columns for this provider.
The number of columns for this provider.
BlackBerry 10.1.0
virtual void
Gets the lower and upper boundaries for the column.
| Parameters | |
|---|---|
| column |
The column index. |
| lowerBoundary |
The lower boundary for the column. |
| upperBoundary |
The upper boundary for the column. |
BlackBerry 10.1.0
virtualQVariant
This method maps a list of indices to the corresponding value.
| Parameters | |
|---|---|
| picker |
The pointer to the picker control. |
| indices |
A list of indices to get the value for. |
QVariant holding values representing the list of indices.
BlackBerry 10.1.0
virtualQList< int >
Finds the picker item corresponding to the specified value.
| Parameters | |
|---|---|
| picker |
The pointer to the picker control. |
| value |
The value. |
The list of indices corresponding to the value, or empty list if the value cannot be located
BlackBerry 10.1.0
QVariantList
Gets the width ratio for columns in the picker control.
The list of width ratio for columns
BlackBerry 10.1.0
void
Sets width ratio for columns of picker control.
| Parameters | |
|---|---|
| ratio |
List of int-values specifying the relative width factor. |
BlackBerry 10.1.0
void
Resets the width ratio for columns in the picker control.
BlackBerry 10.1.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
Signals
void
Emitted when the Picker that uses this PickerProvider should call updateItem() for all of its cached items.
The PickerProvider implementation should typically emit this signal when an application wants to change the visual appearance of all items in a Picker.
| Parameters | |
|---|---|
| column |
Number of column to update. |
BlackBerry 10.1.0
void
Emitted when the column width ratio changes.
| Parameters | |
|---|---|
| ratio |
The new column width ratio |
BlackBerry 10.1.0
void
Emitted when the column range is changed and should be updated.
| Parameters | |
|---|---|
| column |
The column index for which the boundaries should be updated |
BlackBerry 10.1.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