SwipeDelegate QML Type

A swipable item delegate. More...

Import Statement: import QtQuick.Controls 2.0
Since: Qt 5.7
Inherits:

ItemDelegate

Properties

Detailed Description

SwipeDelegate presents a view item that can be swiped left or right to expose more options or information. It is used as a delegate in views such as ListView.

SwipeDelegate inherits its API from AbstractButton. For instance, you can set text and react to clicks using the AbstractButton API.

Information regarding the progress of a swipe, as well as the components that should be shown upon swiping, are both available through the swipe grouped property object. For example, swipe.position holds the position of the swipe within the range -1.0 to 1.0. The swipe.left property determines which item will be displayed when the control is swiped to the right, and vice versa for swipe.right. The positioning of these components is left to applications to decide. For example, without specifying any position for swipe.left or swipe.right, the following will occur:

If swipe.left and swipe.right are anchored to the left and right of the background item (respectively), they'll behave like this:

When using swipe.left and swipe.right, the control cannot be swiped past the left and right edges. To achieve this type of "wrapping" behavior, set swipe.behind instead. This will result in the same item being shown regardless of which direction the control is swiped. For example, in the image below, we set swipe.behind and then swipe the control repeatedly in both directions:

See also Customizing SwipeDelegate and Delegate Controls.

Property Documentation

swipe group

swipe.position : real

swipe.complete : bool

swipe.left : Component

swipe.behind : Component

swipe.right : Component

swipe.leftItem : Item

swipe.behindItem : Item

swipe.rightItem : Item

PropertyDescription
positionThis property holds the position of the swipe relative to either side of the control. When this value reaches either -1.0 (left side) or 1.0 (right side) and the mouse button is released, complete will be true.
completeThis property holds whether the control is fully exposed after having been swiped to the left or right.

When complete is true, any interactive items declared in left, right, or behind will receive mouse events.

leftThis property holds the left delegate.

The left delegate sits behind both contentItem and background. When the SwipeDelegate is swiped to the right, this item will be gradually revealed.

Both interactive and non-interactive items can be used here. Normal event handling rules apply; if an interactive control like Button is used, interaction signals of SwipeDelegate such as clicked() will not get emitted if the button is clicked.

behindThis property holds the delegate that is shown when the SwipeDelegate is swiped to both the left and right.

As with the left and right delegates, it sits behind both contentItem and background. However, a SwipeDelegate whose behind has been set can be continuously swiped from either side, and will always show the same item.

Both interactive and non-interactive items can be used here. Normal event handling rules apply; if an interactive control like Button is used, interaction signals of SwipeDelegate such as clicked() will not get emitted if the button is clicked.

rightThis property holds the right delegate.

The right delegate sits behind both contentItem and background. When the SwipeDelegate is swiped to the left, this item will be gradually revealed.

Both interactive and non-interactive items can be used here. Normal event handling rules apply; if an interactive control like Button is used, interaction signals of SwipeDelegate such as clicked() will not get emitted if the button is clicked.

leftItemThis property holds the item instantiated from the left component.

If left has not been set, or the position hasn't changed since creation of the SwipeDelegate, this property will be null.

behindItemThis property holds the item instantiated from the behind component.

If behind has not been set, or the position hasn't changed since creation of the SwipeDelegate, this property will be null.

rightItemThis property holds the item instantiated from the right component.

If right has not been set, or the position hasn't changed since creation of the SwipeDelegate, this property will be null.

See also contentItem and background.


© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.