FreeKill/qml/Pages/RoomElement/SkillButton.qml

71 lines
1.5 KiB
QML
Raw Normal View History

// SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick
import Qt5Compat.GraphicalEffects
Item {
id: root
property alias skill: skill.text
property string type: "active"
property string orig: ""
property bool pressed: false
2023-04-23 13:10:07 +00:00
property bool prelighted: false
onEnabledChanged: {
if (!enabled)
pressed = false;
}
2023-04-23 13:10:07 +00:00
width: type !== "notactive" ? Math.max(80, skill.width + 8) : skill.width
height: type !== "notactive" ? 36 : 24
Image {
x: -13 - 120 * 0.166
y: -6 - 55 * 0.166
scale: 0.66
2023-04-23 13:10:07 +00:00
source: type === "notactive" ? ""
: AppPath + "/image/button/skill/" + type + "/"
+ (enabled ? (pressed ? "pressed" : "normal") : "disabled")
}
2023-04-23 13:10:07 +00:00
Image {
visible: type === "prelight"
source: AppPath + "/image/button/skill/" +
(prelighted ? "prelight.png" : "unprelight.png")
transformOrigin: Item.TopLeft
x: -10
scale: 0.7
}
Text {
anchors.centerIn: parent
id: skill
font.family: fontLi2.name
font.pixelSize: Math.max(26 - text.length, 18)
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 {
2023-04-23 13:10:07 +00:00
enabled: root.type !== "notactive" && root.enabled
2023-03-18 07:34:42 +00:00
onTapped: parent.pressed = !parent.pressed;
}
}