Warning, /libraries/kirigami-addons/src/dateandtime/private/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: LGPL-2.0-or-later
0005  */
0006 
0007 import QtQuick 2.12
0008 import QtQuick.Controls 2.5 as Controls2
0009 import org.kde.kirigami 2.15 as Kirigami
0010 import QtQuick.Layouts 1.11
0011 
0012 Controls2.ToolButton {
0013     id: hoursButton
0014 
0015     property int selectedValue
0016     property string type
0017 
0018     checkable: true
0019     checked: index == selectedValue
0020     autoExclusive: true
0021     text: index == selectedValue ? ( (type == "hours" && index == 0) ? 12 : index )
0022                                  : ( (type == "hours") ? ( index == 0 ? 12 : ( (index % 3 == 0) ? index : ".") ) : (index % 15 == 0) ? index : ".")
0023     contentItem: Controls2.Label {
0024         text: hoursButton.text
0025         color: index <= parent.selectedValue ? Kirigami.Theme.activeTextColor : Kirigami.Theme.textColor
0026         horizontalAlignment: Text.AlignHCenter
0027         verticalAlignment: Text.AlignVCenter
0028     }
0029 
0030     background: Rectangle {
0031         implicitHeight: Kirigami.Units.gridUnit
0032         implicitWidth: height
0033         radius: width*0.5
0034         color: parent.checked ? Kirigami.Theme.activeBackgroundColor : "transparent"
0035     }
0036 }
0037