blob: ee0c359e9a1a2884fe5610ac0273b3fb90edefcc (
plain)
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
51
52
53
54
55
56
57
|
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
import QtQuick
import QtQuick.Controls.impl
import QtQuick.Templates as T
ColorImage {
id: indicator
required property T.AbstractButton control
required property url filePath
source: filePath
color: control.enabled && control.checked ? control.palette.accent : defaultColor
property Item indicatorBackground: Rectangle {
parent: control.indicator
x: (parent.width - width) / 2
y: (parent.height - height) / 2
width: 10
height: 10
radius: height * 0.5
scale: !control.checked && !control.down ? 0 : control.down && control.checked ? 0.8 : control.hovered ? 1.2 : 1
gradient: Gradient {
GradientStop {
position: 0
color: !control.checked ? "transparent" : Application.styleHints.colorScheme == Qt.Light ? "#0F000000" : "#12FFFFFF"
}
GradientStop {
position: 0.5
color: !control.checked ? "transparent" : Application.styleHints.colorScheme == Qt.Light ? "#0F000000" : "#12FFFFFF"
}
GradientStop {
position: 0.95
color: !control.checked ? "transparent" : Application.styleHints.colorScheme == Qt.Light ? "#29000000" : "#18FFFFFF"
}
}
Rectangle {
x: (parent.width - width) / 2
y: (parent.height - height) / 2
width: parent.width - 2
height: parent.height - 2
radius: height * 0.5
color: Application.styleHints.colorScheme === Qt.Dark ? "black" : "white"
}
Behavior on scale {
NumberAnimation{
duration: 167
easing.type: Easing.OutCubic
}
}
}
}
|