PickerProvider

Since: BlackBerry 10.1.0

#include <bb/cascades/PickerProvider>

An interface for providing VisualNode objects as items in a Picker.

When you implement a PickerProvider, the following functions are required:

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);


Overview

Inheritance

bb::cascades::BaseObject
bb::cascades::PickerProvider

QML properties

columnWidthRatio: QVariantList
objectName: QStringInherited
parent: QObject [read-only]Inherited

Properties Index

Public Static Attributes Index

const intNoBoundary

Public Functions Index

PickerProvider (QObject *parent=0)
virtual ~PickerProvider ()
intcolumnCount () const =0
QVariantListcolumnWidthRatio ()
VisualNode *createItem (Picker *pickerList, int columnIndex)=0
virtual QList< int >indicesOf (Picker *picker, const QVariant &value) const
virtual voidrange (int column, int *lowerBoundary, int *upperBoundary)
voidresetColumnWidthRatio ()
voidsetColumnWidthRatio (const QVariantList &ratio)
voidupdateItem (Picker *pickerList, int columnIndex, int rowIndex, VisualNode *pickerItem)=0
virtual QVariantvalue (Picker *picker, const QList< int > &indices) const
voidsetObjectName (const QString &name)Inherited
virtual Q_INVOKABLE QStringtoDebugString () const Inherited

Protected Functions Index

Only has inherited protected functions

BaseObject (QObject *parent=0)Inherited

Signals Index

voidcolumnWidthRatioChanged (const QVariantList &ratio)
voiditemUpdatesNeeded (int column)
voidupdateRange (int column)
voidcreationCompleted ()Inherited
voidobjectNameChanged (const QString &objectName)Inherited

Properties

QVariantList columnWidthRatio

Column width ratio defining widths of the Picker columns.

Since:

BlackBerry 10.1.0

QString objectNameInherited

This property is overridden from QObject.

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 Static Attributes

const int NoBoundary ()

Public Functions

PickerProvider (

virtual~PickerProvider ()

Destructor.

int columnCount ()

Gets the number of columns for this provider.

Return:

The number of columns for this provider.

Since:

BlackBerry 10.1.0

QVariantList columnWidthRatio ()

Gets the width ratio for columns in the picker control.

Return:

The list of width ratio for columns

Since:

BlackBerry 10.1.0

VisualNode * createItem (
  • Picker *pickerList,
  • intcolumnIndex )

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.

Return:

The VisualNode pointer.

Since:

BlackBerry 10.1.0

virtualQList< int > indicesOf (

Finds the picker item corresponding to the specified value.

Parameters
picker

The pointer to the picker control.

value

The value.

Return:

The list of indices corresponding to the value, or empty list if the value cannot be located

Since:

BlackBerry 10.1.0

virtual void range (
  • intcolumn,
  • int *lowerBoundary,
  • int *upperBoundary )

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.

Since:

BlackBerry 10.1.0

void resetColumnWidthRatio ()

Resets the width ratio for columns in the picker control.

Since:

BlackBerry 10.1.0

void setColumnWidthRatio (

Sets width ratio for columns of picker control.

Parameters
ratio

List of int-values specifying the relative width factor.

Since:

BlackBerry 10.1.0

void updateItem (

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.

Since:

BlackBerry 10.1.0

virtualQVariant value (

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.

Return:

QVariant holding values representing the list of indices.

Since:

BlackBerry 10.1.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

Signals

void columnWidthRatioChanged (

Emitted when the column width ratio changes.

Parameters
ratio

The new column width ratio

Since:

BlackBerry 10.1.0

void itemUpdatesNeeded (
  • intcolumn)

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.

Since:

BlackBerry 10.1.0

void updateRange (
  • intcolumn)

Emitted when the column range is changed and should be updated.

Parameters
column

The column index for which the boundaries should be updated

Since:

BlackBerry 10.1.0

void creationCompleted ()Inherited

Emitted 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 indicates 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-09-30



Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus