Warning, /plasma/plasma-mobile/kcms/time/ui/Digit.qml is written in an unsupported language. File is not indexed.
0001 /*
0002 SPDX-FileCopyrightText: 2011 Marco Martin <mart@kde.org>
0003
0004 SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006
0007 import QtQuick 2.7
0008 import org.kde.kirigami 2.4 as Kirigami
0009
0010
0011 Item {
0012 id: root
0013
0014 property alias model: spinnerView.model
0015 property alias currentIndex: spinnerView.currentIndex
0016 property alias delegate: spinnerView.delegate
0017 property alias moving: spinnerView.moving
0018 property int selectedIndex: -1
0019 property int fontSize: 14
0020
0021 width: placeHolder.width*1.3
0022 height: placeHolder.height*3
0023
0024 Text {
0025 id: placeHolder
0026 visible: false
0027 font.pointSize: root.fontSize
0028 text: "00"
0029 }
0030
0031 PathView {
0032 id: spinnerView
0033 anchors.fill: parent
0034 model: 60
0035 clip: true
0036 pathItemCount: 5
0037 dragMargin: 800
0038 preferredHighlightBegin: 0.5
0039 preferredHighlightEnd: 0.5
0040 delegate: Text {
0041 horizontalAlignment: Text.AlignHCenter
0042 width: spinnerView.width
0043 property int ownIndex: index
0044 text: index < 10 ? "0"+index : index
0045 color: Kirigami.Theme.textColor
0046 font.pointSize: root.fontSize
0047 }
0048
0049 onMovingChanged: {
0050 userConfiguring = true
0051 if (!moving) {
0052 userConfiguringTimer.restart()
0053 selectedIndex = childAt(width/2, height/2).ownIndex
0054 }
0055 }
0056
0057 path: Path {
0058 startX: spinnerView.width/2
0059 startY: spinnerView.height + 1.5*placeHolder.height
0060 PathAttribute { name: "itemOpacity"; value: 0 }
0061 PathLine {
0062 x: spinnerView.width/2
0063 y: spinnerView.height/2
0064 }
0065 PathAttribute { name: "itemOpacity"; value: 1 }
0066 PathLine {
0067 x: spinnerView.width/2
0068 y: -1.5*placeHolder.height
0069 }
0070 PathAttribute { name: "itemOpacity"; value: 0 }
0071 }
0072 }
0073 }
0074