Revision control
Copy as Markdown
// Copyright (C) 2026 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
import QtQuick.Controls.impl
import QtQuick.Templates as T
import Qt.labs.StyleKit
import Qt.labs.StyleKit.impl
T.Tumbler {
id: control
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
implicitContentWidth + leftPadding + rightPadding)
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
implicitContentHeight + topPadding + bottomPadding)
readonly property real __delegateHeight: availableHeight / visibleItemCount
leftPadding: styleReader.leftPadding
rightPadding: styleReader.rightPadding
topPadding: styleReader.topPadding
bottomPadding: styleReader.bottomPadding
leftInset: styleReader.background.leftMargin
rightInset: styleReader.background.rightMargin
topInset: styleReader.background.topMargin
bottomInset: styleReader.background.bottomMargin
spacing: styleReader.spacing
font: styleReader.font
StyleVariation.controlType: styleReader.controlType
StyleReader {
id: styleReader
controlType: StyleReader.Tumbler
enabled: control.enabled
focused: control.activeFocus
hovered: control.hovered
palette: control.palette
}
delegate: Text {
text: modelData
color: styleReader.text.color
font: control.font
opacity: (1.0 - Math.abs(Tumbler.displacement) / (control.visibleItemCount / 2)) * (control.enabled ? 1 : 0.6)
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
required property var modelData
required property int index
}
contentItem: TumblerView {
model: control.model
delegate: control.delegate
path: Path {
startX: control.contentItem.width / 2
startY: -control.__delegateHeight / 2
PathLine {
x: control.contentItem.width / 2
y: (control.visibleItemCount + 1) * control.__delegateHeight - control.__delegateHeight / 2
}
}
}
background: BackgroundDelegate {
quickControl: control
backgroundStyle: styleReader.background
}
}