Tumbler QML Type

A spinnable wheel of items that can be selected. More...

Import Statement: import Qt.labs.controls 1.0



Detailed Description

Tumbler {
    model: 5
    // ...

Non-wrapping Tumbler

The default contentItem of Tumbler is a PathView, which wraps when it reaches the top and bottom. To achieve a non-wrapping Tumbler, use ListView as the contentItem:

Tumbler {
    id: listViewTumbler

    contentItem: ListView {
        anchors.fill: parent
        model: listViewTumbler.model
        delegate: listViewTumbler.delegate

        snapMode: ListView.SnapToItem
        highlightRangeMode: ListView.StrictlyEnforceRange
        preferredHighlightBegin: height / 2 - (height / listViewTumbler.visibleItemCount / 2)
        preferredHighlightEnd: height / 2  + (height / listViewTumbler.visibleItemCount / 2)
        clip: true

Note: Types in the Qt.labs module are not guaranteed to remain compatible in future versions.

See also Customizing Tumbler and Input Controls.

Property Documentation

[read-only] count : int

This property holds the number of items in the model.

currentIndex : int

This property holds the index of the current item.

[read-only] currentItem : Item

This property holds the item at the current index.

delegate : component

This property holds the delegate used to display each item.

model : variant

This property holds the model that provides data for this tumbler.

visibleItemCount : int

This property holds the number of items visible in the tumbler. It must be an odd number, as the current item is always vertically centered.

© 2017 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.