Warning, /plasma/libplasma/examples/applets/widgetgallery/contents/ui/Scrollers.qml is written in an unsupported language. File is not indexed.

0001 /*
0002     SPDX-FileCopyrightText: 2011 Daker Fernandes Pinheiro <dakerfp@gmail.com>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 import QtQuick
0008 import org.kde.plasma.components as PlasmaComponents
0009 import org.kde.plasma.extras as PlasmaExtras
0010 
0011 PlasmaComponents.Page {
0012     height: childrenRect.height
0013     property int implicitHeight: childrenRect.height
0014 
0015     tools: PlasmaComponents.ToolBarLayout {
0016         spacing: 5
0017         PlasmaComponents.ToolButton {
0018             visible: pageStack.depth > 1
0019             iconSource: "go-previous"
0020             onClicked: pageStack.pop()
0021         }
0022         PlasmaComponents.ScrollBar {
0023             orientation: Qt.Horizontal
0024             interactive: true
0025             flickableItem: scrollArea
0026             width: 200
0027         }
0028         PlasmaComponents.TextField {
0029             clearButtonShown: true
0030             text: "hello"
0031         }
0032     }
0033 
0034     PlasmaExtras.ScrollArea {
0035         anchors.fill: parent
0036         Flickable {
0037             id: flickable
0038             contentWidth: column.width
0039             contentHeight: column.height
0040             clip: true
0041             anchors.fill: parent
0042 
0043             Item {
0044                 width: Math.max(flickable.width, column.width)
0045                 height: column.height
0046                 Column {
0047                     id: column
0048                     spacing: 20
0049                     anchors.horizontalCenter: parent.horizontalCenter
0050 
0051                     PlasmaComponents.Label {
0052                         font.pixelSize: 20
0053                         text: "Scroll Bar"
0054                     }
0055 
0056                     PlasmaExtras.ScrollArea {
0057                         width: 200
0058                         height: 200
0059                         ListView {
0060                             id: scrollList
0061 
0062                             width: 200
0063                             height: 200
0064                             clip: true
0065                             model: 20
0066                             delegate: PlasmaComponents.Label {
0067                                 width: 200
0068                                 height: 30
0069                                 text: index
0070                                 font.pixelSize: 18
0071                             }
0072 
0073                             Rectangle {
0074                                 anchors.fill: parent
0075                                 color: "grey"
0076                                 opacity: 0.3
0077                             }
0078                         }
0079                     }
0080 
0081                     PlasmaComponents.Label {
0082                         font.pixelSize: 20
0083                         text: "Scroll Decorator"
0084                     }
0085 
0086                     Item {
0087                         width: 200
0088                         height: 200
0089                         PlasmaExtras.Highlight { anchors.fill: parent }
0090                         Flickable {
0091                             id: scrollArea
0092                             anchors.fill: parent
0093                             clip: true
0094                             contentWidth: 400
0095                             contentHeight: 400
0096 
0097                             // Flickable Contents
0098                             Rectangle {
0099                                 color: "green"
0100                                 width: 100
0101                                 height: 100
0102                             }
0103                             Rectangle {
0104                                 x: 80
0105                                 y: 80
0106                                 color: "blue"
0107                                 width: 200
0108                                 height: 200
0109                             }
0110                             Rectangle {
0111                                 x: 200
0112                                 y: 200
0113                                 color: "red"
0114                                 width: 150
0115                                 height: 150
0116                             }
0117                         }
0118 
0119                         // Scroll Decorators
0120                         PlasmaComponents.ScrollBar {
0121                             orientation: Qt.Vertical
0122                             flickableItem: scrollArea
0123                             inverted: true
0124                             anchors {
0125                                 top: scrollArea.top
0126                                 right: scrollArea.right
0127                                 bottom: scrollArea.bottom
0128                             }
0129                             PlasmaComponents.Label {
0130                                 y: parent.height / 2
0131                                 x: 13
0132                                 rotation: -90
0133                                 text: "inverted"
0134                             }
0135                         }
0136                         PlasmaComponents.ScrollBar {
0137                             orientation: Qt.Horizontal
0138                             flickableItem: scrollArea
0139                             anchors {
0140                                 left: scrollArea.left
0141                                 right: scrollArea.right
0142                                 bottom: scrollArea.bottom
0143                             }
0144                         }
0145                     }
0146                 }
0147             }
0148         }
0149     }
0150 }