2023-04-26 17:04:22 +08:00
|
|
|
import QtQuick 2.15
|
2023-03-02 13:57:13 +08:00
|
|
|
import org.ukui.menu.core 1.0
|
|
|
|
|
2024-01-18 03:24:01 +08:00
|
|
|
import org.ukui.quick.items 1.0 as UkuiItems
|
|
|
|
import org.ukui.quick.platform 1.0 as Platform
|
|
|
|
|
2023-03-02 13:57:13 +08:00
|
|
|
MouseArea {
|
|
|
|
id: buttonMouseArea
|
|
|
|
hoverEnabled: true
|
|
|
|
property string buttonIcon: ""
|
2023-04-08 18:42:31 +08:00
|
|
|
property alias highlight: themeIcon.highLight
|
|
|
|
property alias autoHighLight: themeIcon.autoHighLight
|
2023-03-02 13:57:13 +08:00
|
|
|
|
2024-01-18 03:24:01 +08:00
|
|
|
UkuiItems.StyleBackground {
|
2023-04-26 17:04:22 +08:00
|
|
|
id: buttonBase
|
2024-01-18 03:24:01 +08:00
|
|
|
useStyleTransparency: false
|
2024-02-02 15:42:23 +08:00
|
|
|
paletteRole: Platform.Theme.Text
|
2023-03-02 13:57:13 +08:00
|
|
|
anchors.fill: parent
|
|
|
|
radius: height / 2
|
2023-03-22 16:42:06 +08:00
|
|
|
alpha: buttonMouseArea.containsPress ? 0.20 : buttonMouseArea.containsMouse ? 0.16 : 0.10
|
2023-03-02 13:57:13 +08:00
|
|
|
}
|
|
|
|
|
2024-01-18 03:24:01 +08:00
|
|
|
UkuiItems.Icon {
|
2023-04-08 18:42:31 +08:00
|
|
|
id: themeIcon
|
2023-03-02 13:57:13 +08:00
|
|
|
anchors.centerIn: parent
|
|
|
|
width: 16; height: width
|
|
|
|
source: buttonIcon
|
2024-01-18 03:24:01 +08:00
|
|
|
mode: UkuiItems.Icon.AutoHighlight
|
2023-03-02 13:57:13 +08:00
|
|
|
}
|
2023-04-26 17:04:22 +08:00
|
|
|
states: State {
|
|
|
|
when: buttonMouseArea.activeFocus
|
|
|
|
PropertyChanges {
|
|
|
|
target: buttonBase
|
2024-01-18 03:24:01 +08:00
|
|
|
borderColor: Platform.Theme.Highlight
|
2023-04-26 17:04:22 +08:00
|
|
|
border.width: 2
|
|
|
|
}
|
|
|
|
}
|
2023-03-02 13:57:13 +08:00
|
|
|
}
|