Warning, /plasma/qqc2-breeze-style/style/qtquickcontrols/ScrollBar.qml is written in an unsupported language. File is not indexed.

0001 /* SPDX-FileCopyrightText: 2020 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 QtQuick.Templates as T
0007 import org.kde.kirigami as Kirigami
0008 
0009 import org.kde.breeze.impl as Impl
0010 
0011 T.ScrollBar {
0012     id: control
0013 
0014     // content may be loaded after this component, ensure it always stays above content
0015     // inline with qqc2-desktop-style behaviour
0016     z: 9999
0017 
0018     implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
0019                             implicitContentWidth + leftPadding + rightPadding)
0020     implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
0021                              implicitContentHeight + topPadding + bottomPadding)
0022 
0023     padding: control.interactive ? Kirigami.Units.mediumSpacing : Impl.Units.verySmallSpacing
0024     leftPadding: horizontalPadding + separator.thickness
0025 
0026     visible: control.size < 1 && control.policy !== T.ScrollBar.AlwaysOff
0027     minimumSize: horizontal ? height / width : width / height
0028 
0029     interactive: !Kirigami.Settings.hasTransientTouchInput
0030 
0031     policy: Kirigami.Settings.isMobile || !control.interactive ? T.ScrollBar.AsNeeded : T.ScrollBar.AlwaysOn
0032 
0033     contentItem: Impl.ScrollHandle {
0034         control: control
0035         policy: control.policy
0036         pressed: control.pressed
0037     }
0038 
0039     background: Rectangle {
0040         visible: control.policy === T.ScrollBar.AlwaysOn
0041         color: "transparent"
0042         Kirigami.Separator {
0043             id: separator
0044             property int thickness: parent.visible ? Math.min(width, height) : 0
0045             weight: Kirigami.Separator.Weight.Light
0046             anchors {
0047                 left: parent.left
0048                 right: control.horizontal ? parent.right : undefined
0049                 top: parent.top
0050                 bottom: control.vertical ? parent.bottom : undefined
0051             }
0052         }
0053     }
0054 }