SwipeDelegate QML Type
A swipable item delegate. More...
Import Statement: | import QtQuick.Controls 2.0 |
Since: | Qt 5.7 |
Inherits: |
Properties
- swipe
- swipe.position : real
- swipe.complete : bool
- swipe.left : Component
- swipe.behind : Component
- swipe.right : Component
- swipe.leftItem : Item
- swipe.behindItem : Item
- swipe.rightItem : Item
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
Property | Description |
---|---|
position | This 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 . |
complete | This property holds whether the control is fully exposed after having been swiped to the left or right. When complete is |
left | This 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. |
behind | This property holds the delegate that is shown when the SwipeDelegate is swiped to both the left and right. As with the 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. |
right | This 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. |
leftItem | This property holds the item instantiated from the left component.If |
behindItem | This property holds the item instantiated from the behind component.If |
rightItem | This property holds the item instantiated from the right component.If |
See also contentItem and background.