Warning, /frameworks/kirigami/autotests/wheelhandler/ContentFlickable.qml is written in an unsupported language. File is not indexed.

0001 /* SPDX-FileCopyrightText: 2021 Noah Davis <noahadvs@gmail.com>
0002  * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0003  */
0004 
0005 import QtQuick 2.15
0006 import QtQuick.Controls 2.15 as QQC2
0007 
0008 Flickable {
0009     id: flickable
0010     property real cellWidth: 60
0011     property real cellHeight: 60
0012     readonly property QQC2.Button enableSliderButton: enableSliderButton
0013     readonly property QQC2.Slider slider: slider
0014     implicitWidth: cellWidth * 10 + leftMargin + rightMargin
0015     implicitHeight: cellHeight * 10 + topMargin + bottomMargin
0016     contentWidth: contentItem.childrenRect.width
0017     contentHeight: contentItem.childrenRect.height
0018     Grid {
0019         id: grid
0020         columns: Math.sqrt(visibleChildren.length)
0021         Repeater {
0022             model: 500
0023             delegate: Rectangle {
0024                 implicitWidth: flickable.cellWidth
0025                 implicitHeight: flickable.cellHeight
0026                 gradient: Gradient {
0027                     orientation: index % 2 ? Gradient.Vertical : Gradient.Horizontal
0028                     GradientStop { position: 0; color: Qt.rgba(Math.random(),Math.random(),Math.random(),1) }
0029                     GradientStop { position: 1; color: Qt.rgba(Math.random(),Math.random(),Math.random(),1) }
0030                 }
0031             }
0032         }
0033         QQC2.Button {
0034             id: enableSliderButton
0035             width: flickable.cellWidth
0036             height: flickable.cellHeight
0037             contentItem: QQC2.Label {
0038                 horizontalAlignment: Text.AlignHCenter
0039                 verticalAlignment: Text.AlignVCenter
0040                 text: "Enable Slider"
0041                 wrapMode: Text.Wrap
0042             }
0043             checked: true
0044         }
0045         QQC2.Slider {
0046             id: slider
0047             enabled: enableSliderButton.checked
0048             width: flickable.cellWidth
0049             height: flickable.cellHeight
0050         }
0051         Repeater {
0052             model: 500
0053             delegate: Rectangle {
0054                 implicitWidth: flickable.cellWidth
0055                 implicitHeight: flickable.cellHeight
0056                 gradient: Gradient {
0057                     orientation: index % 2 ? Gradient.Vertical : Gradient.Horizontal
0058                     GradientStop { position: 0; color: Qt.rgba(Math.random(),Math.random(),Math.random(),1) }
0059                     GradientStop { position: 1; color: Qt.rgba(Math.random(),Math.random(),Math.random(),1) }
0060                 }
0061             }
0062         }
0063     }
0064 }