PickerItemComponent

Since: BlackBerry 10.1.0

Specifies a QML template used by a Picker to display items.

A PickerItemComponent can be attached to a Picker control using the Picker::pickerItemComponents property, and it can contain whatever QML components that you want to display in your picker item.

The type property is used to specify the type of item that the PickerItemComponent is used for (for example, you might have one PickerItemComponent used for "contacts" and another for "groups", each of which has a unique visual appearance).

Here's how to create a PickerItemComponent object and add it to a picker.

Picker {
    dataModel: XmlDataModel { source: "model.xml" }
    pickerItemComponents: [
        PickerItemComponent {
            type: "item"

            Container {
                layout: StackLayout {
                    orientation: Orientation.LeftToRight
                }
                ImageView {
                    imageSource: pickerItemData.image
                }
                Label {
                    text: pickerItemData.title
                }
            }
        }
    ]
}
Note:

This class can only be used in QML. In C++, the visuals for picker items can be managed using PickerProvider.


Overview

QML properties

content: QDeclarativeComponent
type: QString

Properties Index

QDeclarativeComponentcontent
QStringtype

Public Functions Index

PickerItemComponent (QObject *parent=0)
QDeclarativeComponent *content () const
voidsetContent (QDeclarativeComponent *component)
voidsetType (const QString &typeString)
QStringtype () const

Signals Index

voidcontentChanged (QDeclarativeComponent *content)
voidtypeChanged (const QString &type)

Properties

QDeclarativeComponent content

Item visuals are defined on this property.

Since:

BlackBerry 10.1.0

QString type

The type of items this PickerItemComponent should be used for.

The default value is an empty string.

Since:

BlackBerry 10.1.0

Public Functions

PickerItemComponent (

Constructs a PickerItemComponent instance.

Since:

BlackBerry 10.1.0

QDeclarativeComponent * content ()

Gets the content for the picker item.

Return:

The content containing the item visuals.

Since:

BlackBerry 10.1.0

void setContent (
  • QDeclarativeComponent *component)

Sets the content for the picker item.

Parameters
component

The content containing the item visuals.

Since:

BlackBerry 10.1.0

void setType (

Sets the type for the picker item.

Parameters
typeString

The type of item in the picker.

Since:

BlackBerry 10.1.0

QString type ()

Gets the type for the picker item.

Return:

A string indicating the type of item.

Since:

BlackBerry 10.1.0

Signals

void contentChanged (
  • QDeclarativeComponent *content)

Emitted when content has changed.

Since:

BlackBerry 10.1.0

void typeChanged (

Emitted when type has changed.

Since:

BlackBerry 10.1.0

Last modified: 2014-06-24



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

comments powered by Disqus