Warning, /frameworks/kirigami/tests/wheelhandler/WheelHandlerScrollViewTest.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
0006 import QtQml
0007 import QtQuick.Templates as T
0008 import QtQuick.Controls as QQC2
0009 
0010 import org.kde.kirigami as Kirigami
0011 
0012 QQC2.ApplicationWindow {
0013     id: root
0014     width: 200 * Qt.styleHints.wheelScrollLines + scrollView.leftPadding + scrollView.rightPadding
0015     height: 200 * Qt.styleHints.wheelScrollLines + scrollView.topPadding + scrollView.bottomPadding
0016     visible: true
0017     ScrollView {
0018         id: scrollView
0019         anchors.fill: parent
0020         Grid {
0021             columns: Math.sqrt(visibleChildren.length)
0022             Repeater {
0023                 model: 500
0024                 delegate: Rectangle {
0025                     implicitWidth: 20 * Qt.styleHints.wheelScrollLines
0026                     implicitHeight: 20 * Qt.styleHints.wheelScrollLines
0027                     gradient: Gradient {
0028                         orientation: index % 2 ? Gradient.Vertical : Gradient.Horizontal
0029                         GradientStop { position: 0; color: Qt.rgba(Math.random(),Math.random(),Math.random(),1) }
0030                         GradientStop { position: 1; color: Qt.rgba(Math.random(),Math.random(),Math.random(),1) }
0031                     }
0032                 }
0033             }
0034             QQC2.Button {
0035                 id: enableSliderButton
0036                 width: 20 * Qt.styleHints.wheelScrollLines
0037                 height: 20 * Qt.styleHints.wheelScrollLines
0038                 contentItem: QQC2.Label {
0039                     horizontalAlignment: Text.AlignHCenter
0040                     verticalAlignment: Text.AlignVCenter
0041                     text: "Enable Slider"
0042                     wrapMode: Text.Wrap
0043                 }
0044                 checked: true
0045             }
0046             QQC2.Slider {
0047                 id: slider
0048                 enabled: enableSliderButton.checked
0049                 width: 20 * Qt.styleHints.wheelScrollLines
0050                 height: 20 * Qt.styleHints.wheelScrollLines
0051             }
0052             Repeater {
0053                 model: 500
0054                 delegate: Rectangle {
0055                     implicitWidth: 20 * Qt.styleHints.wheelScrollLines
0056                     implicitHeight: 20 * Qt.styleHints.wheelScrollLines
0057                     gradient: Gradient {
0058                         orientation: index % 2 ? Gradient.Vertical : Gradient.Horizontal
0059                         GradientStop { position: 0; color: Qt.rgba(Math.random(),Math.random(),Math.random(),1) }
0060                         GradientStop { position: 1; color: Qt.rgba(Math.random(),Math.random(),Math.random(),1) }
0061                     }
0062                 }
0063             }
0064         }
0065     }
0066 }