2023-04-09 05:35:35 +00:00
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
2022-09-14 05:01:10 +00:00
|
|
|
import QtQuick
|
|
|
|
import Qt5Compat.GraphicalEffects
|
|
|
|
|
|
|
|
Item {
|
|
|
|
id: root
|
|
|
|
property alias skill: skill.text
|
|
|
|
property string type: "active"
|
|
|
|
property string orig: ""
|
|
|
|
property bool pressed: false
|
|
|
|
|
|
|
|
onEnabledChanged: {
|
|
|
|
if (!enabled)
|
|
|
|
pressed = false;
|
|
|
|
}
|
|
|
|
|
2023-02-27 02:23:48 +00:00
|
|
|
width: type === "active" ? Math.max(80, skill.width + 8) : skill.width
|
|
|
|
height: type === "active" ? 36 : 24
|
2022-09-14 05:01:10 +00:00
|
|
|
|
|
|
|
Image {
|
|
|
|
x: -13 - 120 * 0.166
|
|
|
|
y: -6 - 55 * 0.166
|
|
|
|
scale: 0.66
|
|
|
|
source: type !== "active" ? ""
|
|
|
|
: AppPath + "/image/button/skill/active/"
|
|
|
|
+ (enabled ? (pressed ? "pressed" : "normal") : "disabled")
|
|
|
|
}
|
|
|
|
|
|
|
|
Text {
|
|
|
|
anchors.centerIn: parent
|
|
|
|
id: skill
|
|
|
|
font.family: fontLi2.name
|
2023-02-27 02:23:48 +00:00
|
|
|
font.pixelSize: Math.max(26 - text.length, 18)
|
2022-09-14 05:01:10 +00:00
|
|
|
visible: false
|
|
|
|
}
|
|
|
|
|
|
|
|
Glow {
|
|
|
|
id: glowItem
|
|
|
|
source: skill
|
|
|
|
anchors.fill: skill
|
|
|
|
radius: 6
|
|
|
|
//samples: 8
|
|
|
|
color: "grey"
|
|
|
|
}
|
|
|
|
|
|
|
|
LinearGradient {
|
|
|
|
anchors.fill: skill
|
|
|
|
source: skill
|
|
|
|
gradient: Gradient {
|
|
|
|
GradientStop { position: 0; color: "#FFE07C" }
|
|
|
|
GradientStop { position: 1; color: "#B79A5F" }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-03-18 07:34:42 +00:00
|
|
|
TapHandler {
|
2022-09-14 05:01:10 +00:00
|
|
|
enabled: root.type === "active" && root.enabled
|
2023-03-18 07:34:42 +00:00
|
|
|
onTapped: parent.pressed = !parent.pressed;
|
2022-09-14 05:01:10 +00:00
|
|
|
}
|
|
|
|
}
|