PickerItemComponent
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
}
}
}
]
}
This class can only be used in QML. In C++, the visuals for picker items can be managed using PickerProvider.
BlackBerry 10.1.0
QML signals
| onTypeChanged | : {} |
| onContentChanged | : {} |
Public Functions Index
| PickerItemComponent (QObject *parent=0) | |
| QString | type () const |
| void | setType (const QString &typeString) |
| QDeclarativeComponent * | content () const |
| void | setContent (QDeclarativeComponent *component) |
Signals Index
| void | typeChanged (const QString &type) |
| void | contentChanged (QDeclarativeComponent *content) |
Properties
QString
The type of items this PickerItemComponent should be used for.
The default value is an empty string.
BlackBerry 10.1.0
QDeclarativeComponent
Item visuals are defined on this property.
This is the default property for PickerItemComponent.
Since this property is of the type QDeclarativeComponent*, it does not contain instances of Control objects. Neither can object instances be assigned to this property. Instead, the QML from this property is used by a Picker to create item visuals of the specified type when needed. Which means that symbols only available in item visuals (for example pickerItemData) can be used in the QML on this property, since the symbols are not resolved until a Picker creates item visuals. On the other hand, symbols only available in the context of this PickerItemComponent cannot be used in the QML on this property, because item visuals are created in contexts of their own. Data can however be communicated to the item visuals by setting it as a dynamic property on this PickerItemComponent, or on the Picker.
BlackBerry 10.1.0
Public Functions
Constructs a PickerItemComponent instance.
BlackBerry 10.1.0
QString
Gets the type for the picker item.
A string indicating the type of item.
BlackBerry 10.1.0
void
Sets the type for the picker item.
| Parameters | |
|---|---|
| typeString |
The type of item in the picker. |
BlackBerry 10.1.0
QDeclarativeComponent *
Gets the content for the picker item.
The content containing the item visuals.
BlackBerry 10.1.0
void
Sets the content for the picker item.
| Parameters | |
|---|---|
| component |
The content containing the item visuals. |
BlackBerry 10.1.0