small component patches + code cleanup
This commit is contained in:
@@ -13,4 +13,44 @@ Rectangle {
|
||||
readonly property var t: Cfg.Config.theme
|
||||
|
||||
property bool moduleEnabled: true
|
||||
|
||||
property bool hovered: false
|
||||
property bool popupOpen: false
|
||||
|
||||
property color chipColor: "transparent"
|
||||
property color chipColorHovered: "transparent"
|
||||
property color chipBorderColor: "transparent"
|
||||
property color chipBorderColorHovered: "transparent"
|
||||
property bool chipHoverEnabled: false
|
||||
property var chipTapAction: null
|
||||
|
||||
property int chipAnimDuration: 150
|
||||
property bool chipAnimWidth: false
|
||||
property bool chipAnimImplicitWidth: false
|
||||
|
||||
radius: panelRadius
|
||||
color: hovered ? chipColorHovered : chipColor
|
||||
border.color: (hovered || popupOpen) ? chipBorderColorHovered : chipBorderColor
|
||||
border.width: borderWidth
|
||||
|
||||
Behavior on color { ColorAnimation { duration: chip.chipAnimDuration } }
|
||||
Behavior on border.color { ColorAnimation { duration: chip.chipAnimDuration } }
|
||||
Behavior on width {
|
||||
NumberAnimation { duration: 250; easing.type: Easing.OutCubic }
|
||||
enabled: chipAnimWidth
|
||||
}
|
||||
Behavior on implicitWidth {
|
||||
NumberAnimation { duration: 250; easing.type: Easing.OutCubic }
|
||||
enabled: chipAnimImplicitWidth
|
||||
}
|
||||
|
||||
HoverHandler {
|
||||
id: hoverHandler
|
||||
cursorShape: chipHoverEnabled ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||
onHoveredChanged: chip.hovered = hovered
|
||||
}
|
||||
|
||||
TapHandler {
|
||||
onTapped: if (chip.chipTapAction) chip.chipTapAction()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user