File: TimePickerSpinBoxButton.qml

package info (click to toggle)
plasma-mobile 6.5.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 20,412 kB
  • sloc: xml: 38,474; cpp: 18,529; javascript: 139; sh: 82; makefile: 5
file content (50 lines) | stat: -rw-r--r-- 1,451 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Copyright 2023 Carl Schwan <carl@carlschwan.eu>
// SPDX-License-Identifier: LGPL-2.0-or-later

import QtQuick 2.15
import QtQuick.Controls 2.15 as QQC2
import org.kde.kirigami 2.19 as Kirigami

QQC2.Button {
    id: root
    autoRepeat: true

    required property bool isEnd
    required property bool isStart

    readonly property color borderColor: if (enabled && (visualFocus || hovered || down)) {
        return Kirigami.Theme.focusColor
    } else {
        return Kirigami.ColorUtils.linearInterpolation(Kirigami.Theme.backgroundColor, Kirigami.Theme.textColor, 0.15)
    }

    topPadding: 0
    bottomPadding: 0

    contentItem: Item {
        implicitHeight: Kirigami.Units.gridUnit * 2
        Kirigami.Icon {
            source: root.icon.name
            anchors.centerIn: parent
            implicitHeight: Kirigami.Units.iconSizes.small
            implicitWidth: Kirigami.Units.iconSizes.small
        }
    }

    background: Kirigami.ShadowedRectangle {
        Kirigami.Theme.colorSet: Kirigami.Theme.Button
        color: root.down ? Kirigami.Theme.alternateBackgroundColor : Kirigami.Theme.backgroundColor

        corners {
            topLeftRadius: root.isStart ? 4 : 0
            topRightRadius: root.isStart ? 4 : 0
            bottomLeftRadius: root.isEnd ? 4 : 0
            bottomRightRadius: root.isEnd ? 4 : 0
        }

        border {
            width: 1
            color: root.borderColor
        }
    }
}