C

SwipeView QML Type

Enables the user to navigate pages by swiping sideways. More...

Import Statement: import QtQuick.Controls
Since: Qt Quick Ultralite 1.0
Inherits:

Control

Properties

Methods

Detailed Description

SwipeView provides a swipe-based navigation model.

SwipeView is populated with a set of pages. One page is visible at a time. The user can navigate between the pages by swiping sideways. Notice that SwipeView itself is entirely non-visual.

SwipeView{
    id: theSwipe
    width: 150; height: 150
    clip: true
    Rectangle
    {
        color: "red"
    }
    Rectangle
    {
        color: "yellow"
    }
    Rectangle
    {
        color: "lightGreen"
    }
}

As shown above, SwipeView is populated with a static set of pages that are defined inline as children of the view.

It is generally not advisable to add excessive amounts of pages to a SwipeView. However, when the amount of pages grows larger, or individual pages are relatively complex, it may be desirable to free up resources by unloading pages that are outside the immediate reach of the user. See also Load components dynamically section in the Qt Quick Ultralite Performance Guide.

Note: SwipeView takes over the geometry management of items added to the view. Using anchors on the items is not supported, and any width or height assignment is overridden by the view. Notice that this only applies to the root of the item. Specifying width and height, or using anchors for its children works as expected.

Note: SwipeView is based on QtQuick.Templates::SwipeView, which requires that contentItem is a Flickable. Using any other contentItem is not supported.

See also Controls Styling.

Property Documentation

[read-only] count : int

This property holds the the number of pages in the SwipeView.

See also currentIndex.


currentIndex : int

This property holds the index of the currently visible item. It can be used to automatically scroll to a particular page.

See also currentItem.


[read-only] currentItem : Item

This property holds the currently visible item.

See also currentIndex.


interactive : bool

This property describes whether the user can interact with the SwipeView. The user cannot swipe a view that is not interactive.

The default value is true.


orientation : enumeration

This property holds the orientation.

Possible values:

ConstantDescription
Qt.HorizontalHorizontal (default)
Qt.VerticalVertical

Method Documentation

void decrementCurrentIndex()

This changes the current page to the one with lower index.

See also currentIndex, incrementCurrentIndex, and setCurrentIndex.


void incrementCurrentIndex()

This changes the current page to the one with higher index.

See also currentIndex, decrementCurrentIndex, and setCurrentIndex.


void setCurrentIndex(int index)

This changes the current page to one at given index.

See also currentIndex, decrementCurrentIndex, and incrementCurrentIndex.


Available under certain Qt licenses.
Find out more.