Style API for ListItem component. More...

Import Statement: import Ubuntu.Components.Styles 1.3
Since: Ubuntu.Components.Styles 1.2



Detailed Description

Style API for the ListItem component which provides actions, select and drag handler delegates, and snap animation via its properties. ListItem treats the style differently compared to the other components, as it loads the style only when needed and not upon component creation.

Property Documentation

animatePanels : bool

The property drives the different panel animations in the style. Panels should not be animated when created upon scrolling a view.

dragPanel : Item

The property holds the item visualizing the drag handler. ListItem's dragging mechanism uses this property to detect the area the dragging can be initiated from. If not set, the ListItem will assume the dragging can be initiated from the entire area of the ListItem.

dropAnimation : PropertyAnimation

The property holds the animation executed on ListItem dropping.

[read-only] flickable : Flickable

The property holds the Flickable (or ListView) holding the ListItem styled.

This QML property was introduced in Ubuntu.Components.Styles 1.3.

[read-only] listItemIndex : in

The property proxies the ListItem's index context property to the style, which is either the index of the list item in a ListView or the child index. Use this property rather than the index context property as that may not be defined in situations where the ListItem is not a delegate of a ListView or Repeater.

This QML property was introduced in Ubuntu.Components.Styles 1.3.

snapAnimation : Animation

Holds the behavior used in animating when snapped in or out.

Method Documentation


Function called by the ListItem when a rebounding action is requested from the style. This usually happens when the list item's content is swiped and there is a press event happening outside of the ListItem's boundary or when the view embedding the ListItem starts scrolling.

swipeEvent(SwipeEvent event)

The function is called by the ListItem when a swipe action is performed, i.e. when the swipe is started, the position is updated or the swipe ends. The event object provides information about the swipe status, positions and the updated ListItem.contentItem position. The style implementation can override the contentItem position by setting the event.content.x or event.content.y properties to the desired value.

The event object properties are:

  • status - enumeration of Started, Updated, Finished values representing the swipe event status
  • to - (x, y) coordinates of the current mouse/touch point - read-only
  • from - (x, y) coordinates of the previous mouse/touch point - read-only
  • content - (x, y) updated coordinates of the ListItem.contentItem, read-write