ukui-menu/qml/AppControls2/StyleBackground.qml

43 lines
1003 B
QML

import QtQuick 2.0
import QtQuick.Controls 2.5
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
function updateColor() {
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()
}
}