C

Tumbler QML Type

A control that can have several spinnable wheels, each with items that can be selected. More...

Import Statement: import QtQuick.Enterprise.Controls 1.3
Since: QtQuick.Enterprise.Controls 1.2
Inherits:

FocusScope

Properties

Methods

Detailed Description

A Tumbler

Note: Tumbler requires Qt 5.3.2 or later.

The Tumbler control is used with one or more TumblerColumn items, which define the content of each column:

Tumbler {
    TumblerColumn {
        model: 5
    }
    TumblerColumn {
        model: [0, 1, 2, 3, 4]
    }
    TumblerColumn {
        model: ["A", "B", "C", "D", "E]
    }
}

You can also use a traditional model with roles:

Rectangle {
    width: 220
    height: 350
    color: "#494d53"

    ListModel {
        id: listModel

        ListElement {
            foo: "A"
            bar: "B"
            baz: "C"
        }
        ListElement {
            foo: "A"
            bar: "B"
            baz: "C"
        }
        ListElement {
            foo: "A"
            bar: "B"
            baz: "C"
        }
    }

    Tumbler {
        anchors.centerIn: parent

        TumblerColumn {
            model: listModel
            role: "foo"
        }
        TumblerColumn {
            model: listModel
            role: "bar"
        }
        TumblerColumn {
            model: listModel
            role: "baz"
        }
    }
}

Limitations

For technical reasons, the model count must be equal to or greater than visibleItemCount plus one. The visibleItemCount must also be an odd number.

You can create a custom appearance for a Tumbler by assigning a TumblerStyle. To style individual columns, use the delegate and highlight properties of TumblerColumn.

Property Documentation

read-onlycolumnCount : int

The number of columns in the Tumbler.


style : Component


Method Documentation

addColumn( column)

Adds a column and returns the added column.

The column argument can be an instance of TumblerColumn, or a Component. The component has to contain a TumblerColumn. Otherwise null is returned.


currentIndexAt( columnIndex)

Returns the current index of the column at columnIndex, or null if the index is invalid.


getColumn( columnIndex)

Returns the column at columnIndex or null if the index is invalid.


insertColumn( index, column)

Inserts a column at the given index and returns the inserted column.

The column argument can be an instance of TumblerColumn, or a Component. The component has to contain a TumblerColumn. Otherwise, null is returned.


setCurrentIndexAt( columnIndex, itemIndex)

Sets the current index of the column at columnIndex to itemIndex.

Does nothing if columnIndex or itemIndex are invalid.


Available under certain Qt licenses.
Find out more.