SwipeView QML Type

Enables the user to navigate pages by swiping sideways. 更多...

导入语句: import QtQuick.Controls .
Since: Qt Quick Ultralite 1.0
继承:

Control

特性

方法

详细描述

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.

注意: 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.

注意: SwipeView is based on QtQuick .Templates::SwipeView, which requires that contentItem Flickable . Using any other contentItem 不被支持。

另请参阅 Controls Styling .

特性文档编制

[read-only] count : int

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

另请参阅 currentIndex .


currentIndex : int

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

另请参阅 currentItem .


[read-only] currentItem : Item

This property holds the currently visible item.

另请参阅 currentIndex .


interactive : bool

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

默认值为 true .


orientation : enumeration

This property holds the orientation.

可能的值:

常量 描述
Qt.Horizontal Horizontal (default)
Qt.Vertical Vertical

方法文档编制

void decrementCurrentIndex ()

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

另请参阅 currentIndex , incrementCurrentIndex ,和 setCurrentIndex .


Flickable getFlickable ()

Gives access to the Flickable that is responsible for scrolling content.


void incrementCurrentIndex ()

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

另请参阅 currentIndex , decrementCurrentIndex ,和 setCurrentIndex .


void setCurrentIndex ( int index )

This changes the current page to one at given index .

另请参阅 currentIndex , decrementCurrentIndex ,和 incrementCurrentIndex .