Visecall's picture
Back up authored 2D makeup materials and local hair segmentation model
4f675f0 verified
Raw History Blame Contribute Delete
2.02 kB
import GeneralBiz
import FusionUI
import FunctionPanel
import Purchase 1.0
import Qt5Compat.GraphicalEffects
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import VECreator
Item {
id: root
width: itemBackground.width
height: itemBackground.height
opacity: enabled ? 1 : 0.4
enabled: true
property string title: ""
property var contextId
property bool selected: false
property color fontColorActive: LVColor.White0_Text_Primary
property color fontColorNormal: LVColor.Grey5_Text_Tertiary
property color backgroundColorActive: LVColor.Fill_Button_Level3
property color backgroundColorNormal: LVColor.Fill_Button_Level2
property color backgroundColorHover: LVColor.Fill_Button_Level3
signal click(var contextId)
Rectangle{
id: itemBackground
width: text.contentWidth + 30
height: 24
color: backgroundColorNormal
radius: 12
}
Text{
id: text
anchors.horizontalCenter: itemBackground.horizontalCenter
anchors.verticalCenter: itemBackground.verticalCenter
text: title
font: LVFont.ButtonSemibold11
color: fontColorNormal
}
onSelectedChanged: {
itemBackground.color = selected ? backgroundColorActive : backgroundColorNormal;
text.color = selected ? fontColorActive : fontColorNormal
}
MouseArea{
id: mouseArea
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
hoverEnabled: root.enabled
onEntered: {
if(!selected){
text.color = fontColorActive
itemBackground.color = backgroundColorHover
}
}
onExited: {
if(!selected){
text.color = fontColorNormal
itemBackground.color = backgroundColorNormal
}
}
onPressed: {
root.click(contextId)
}
}
}