Warning, /plasma-mobile/calindori/src/contents/ui/kirigami-playground/ClockElement.qml is written in an unsupported language. File is not indexed.

0001 /*
0002  * SPDX-FileCopyrightText: 2019 Dimitris Kardarakos <dimkard@posteo.net>
0003  *
0004  * SPDX-License-Identifier: GPL-3.0-or-later
0005  */
0006 
0007 import QtQuick 2.7
0008 import QtQuick.Controls 2.0 as Controls2
0009 import org.kde.kirigami 2.2 as Kirigami
0010 import QtQuick.Layouts 1.3
0011 
0012 
0013 Controls2.AbstractButton {
0014     id: hoursButton
0015 
0016     property int selectedValue
0017     property string type
0018 
0019     checked: index == selectedValue
0020     text: index == selectedValue ? ( (type == "hours" && index == 0) ? 12 : index )
0021                                  : ( (type == "hours") ? ( index == 0 ? 12 : ( (index % 3 == 0) ? index : ".") ) : (index % 15 == 0) ? index : ".")
0022     contentItem: Controls2.Label {
0023         text: hoursButton.text
0024         color: index === parent.selectedValue ? Kirigami.Theme.highlightColor : Kirigami.Theme.textColor
0025         horizontalAlignment: Text.AlignHCenter
0026         verticalAlignment: Text.AlignVCenter
0027     }
0028 
0029     background: Rectangle {
0030         implicitHeight: Kirigami.Units.gridUnit * 1.2
0031         implicitWidth: height
0032         radius: width * 0.5
0033         Kirigami.Theme.colorSet: Kirigami.Theme.Button
0034         Kirigami.Theme.inherit: false
0035         color: parent.checked ? Kirigami.Theme.backgroundColor : "transparent"
0036     }
0037 }
0038