Empty QML Type
A list item with no contents. More...
Import Statement: | import Ubuntu.Components.ListItems 1.0 |
Inherits: | |
Inherited By: | Base, Expandable, SingleControl, Standard, and ValueSelector. |
Properties
- action : Action
- activeFocusOnPress : bool
- backgroundIndicator : list<Item>
- confirmRemoval : bool
- divider : ThinDivider
- highlightWhenPressed : bool
- hovered : bool
- iconName : string
- iconSource : url
- pressed : bool
- removable : bool
- selected : bool
- showDivider : bool
- style : Component
- swipingState : string
- text : string
- waitingConfirmationForRemoval : bool
Signals
- clicked()
- itemRemoved()
- pressAndHold()
- triggered(var value)
Methods
- cancelItemRemoval()
- trigger(value)
Detailed Description
Note: The component is deprecated. Use ListItem component instead. The Empty class can be used for generic list items containing other components such as buttons. It is selectable and can take mouse clicks. It will attempt to detect if a thin dividing line at the bottom of the item is suitable, but this behaviour can be overridden (using showDivider). For specific types of list items, see its subclasses.
The item will still remain in memory after being removed from the list so it is up to the application to destroy it. This can be handled by the signal itemRemoved that is fired after all animation is done.
Examples:
import Ubuntu.Components 1.2 import Ubuntu.Components.ListItems 1.0 as ListItem Item { Model { id: contactModel ListElement { name: "Bill Smith" number: "555 3264" } ListElement { name: "John Brown" number: "555 8426" } } ListView { width: 180; height: 200 model: contactModel delegate: ListItem.Empty { height: units.gu(6) removable: true onItemRemoved: contactModel.remove(index) Text { text: name + " " + number anchors.centerIn: parent } } } }
See the documentation of the derived classes of Empty for more examples.
Property Documentation
action : Action |
The Action associated with this ActionItem. If action is set, the values of the Action properties are copied to the values of the ActionItem properties.
The property specifies whether the StyledItem can gain focus on a mouse press/touch or not. When the value is true, the focus will be set on the component when the mouse is pressed over it or touched. However if one of the component's ancestor StyledItem or derived is having the property value false, the focus will not be gained automatically.
In the following example the TextField will stay focused when clicked on the red rectangle.
import QtQuick 2.4 import Ubuntu.Components 1.2 Column { width: units.gu(50) height: units.gu(100) StyledItem { objectName: "passiveScope" width: parent.width height: units.gu(30) Rectangle { anchors.fill: parent color: "red" StyledItem { objectName: "activeScope" activeFocusOnPress: true anchors.fill: parent } } } TextField { id: input text: "The input stays focus even if red box is clicked" } Component.onCompleted: input.forceActiveFocus() Connections { target: window onActiveFocusItemChanged: console.debug("focus on", window.activeFocusItem) } }
The default value is false
.
This QML property was introduced in Ubuntu.Components 1.1.
backgroundIndicator : list<Item> |
Defines the item background item to be showed during the item swiping
divider : ThinDivider |
Exposes our the bottom line divider.
Highlight the list item when it is pressed. This is used to disable the highlighting of the full list item when custom highlighting needs to be implemented (for example in ListItem.Standard which can have a split).
The icon associated with the actionItem in the suru icon theme. Default value: action.iconName.
Note: The complete list of icons available in Ubuntu is not published yet. For now please refer to the folders where the icon themes are installed:
- Ubuntu Touch: /usr/share/icons/suru
- Ubuntu Desktop: /usr/share/icons/ubuntu-mono-dark
These 2 separate icon themes will be merged soon.
If both iconSource and iconName are defined, iconName will be ignored.
iconSource : url |
Set to show or hide the thin bottom divider line (drawn by the ThinDivider component). This line is shown by default except in cases where this item is the delegate of a ListView.
style : Component |
Component instantiated immediately and placed below everything else.
Defines if the item is waiting for the user interaction during the swipe to delete
Signal Documentation
This handler is called when there is a mouse click on the button and the button is not disabled. If action is defined, the action will be triggered.
triggered(var value) |
Called when the actionItem is triggered.