File size: 2,021 Bytes
4f675f0 | 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 58 59 60 61 62 63 64 65 66 67 68 69 70 | 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)
}
}
}
|