44 lines
1.0 KiB
QML
44 lines
1.0 KiB
QML
import QtQuick 2.0
|
|
import org.ukui.menu.core 1.0
|
|
|
|
Rectangle {
|
|
property bool useStyleTransparent: true
|
|
property int paletteRole: Palette.Base
|
|
property int paletteGroup: Palette.Active
|
|
property real alpha: 1.0
|
|
|
|
clip: true
|
|
border.width: 0
|
|
|
|
function updateColor() {
|
|
border.color = themePalette.paletteColor(Palette.Highlight)
|
|
if (useStyleTransparent) {
|
|
color = themePalette.paletteColorWithTransparency(paletteRole,paletteGroup)
|
|
} else {
|
|
color = themePalette.paletteColorWithCustomTransparency(paletteRole,paletteGroup,alpha)
|
|
}
|
|
}
|
|
|
|
Component.onCompleted: {
|
|
updateColor()
|
|
themePalette.styleColorChanged.connect(updateColor)
|
|
}
|
|
Component.onDestruction: {
|
|
themePalette.styleColorChanged.disconnect(updateColor)
|
|
}
|
|
|
|
onUseStyleTransparentChanged: {
|
|
updateColor()
|
|
}
|
|
onPaletteRoleChanged: {
|
|
updateColor()
|
|
}
|
|
onPaletteGroupChanged: {
|
|
updateColor()
|
|
}
|
|
onAlphaChanged: {
|
|
updateColor()
|
|
}
|
|
}
|
|
|