ukui-menu/qml/AppControls2/RoundButton.qml

39 lines
1.0 KiB
QML
Raw Normal View History

import QtQuick 2.15
import org.ukui.menu.core 1.0
import org.ukui.quick.items 1.0 as UkuiItems
import org.ukui.quick.platform 1.0 as Platform
MouseArea {
id: buttonMouseArea
hoverEnabled: true
property string buttonIcon: ""
property alias highlight: themeIcon.highLight
property alias autoHighLight: themeIcon.autoHighLight
UkuiItems.StyleBackground {
id: buttonBase
useStyleTransparency: false
paletteRole: Platform.Theme.Text
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
}
UkuiItems.Icon {
id: themeIcon
anchors.centerIn: parent
width: 16; height: width
source: buttonIcon
mode: UkuiItems.Icon.AutoHighlight
}
states: State {
when: buttonMouseArea.activeFocus
PropertyChanges {
target: buttonBase
borderColor: Platform.Theme.Highlight
border.width: 2
}
}
}