| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- // Copyright (C) 2017 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.Templates as T
- import QtQuick.Controls.Universal
- import QtQuick.Controls.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
- delegate: Text {
- text: modelData
- font: control.font
- color: control.Universal.foreground
- 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 {
- implicitWidth: 60
- implicitHeight: 200
- 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
- }
- }
- property real delegateHeight: control.availableHeight / control.visibleItemCount
- }
- }
|