ukui-menu/qml/AppControls2/StyleText.qml

34 lines
933 B
QML
Raw Normal View History

import QtQuick 2.0
import org.ukui.menu.core 1.0
Text {
property int paletteRole: Palette.Text
property real alpha: 1
property real systemFontSize: 10
property real textUltra: 2*systemFontSize
font.pointSize: systemFontSize
function updateColor() {
color = themePalette.paletteColorWithCustomTransparency(paletteRole, Palette.Active, alpha);
}
2023-11-03 15:09:42 +08:00
function updateFont() {
font = themePalette.systemFont();
}
Component.onCompleted: {
updateColor();
2023-11-03 15:09:42 +08:00
updateFont();
themePalette.styleColorChanged.connect(updateColor);
2023-11-03 15:09:42 +08:00
themePalette.systemFontChanged.connect(updateFont);
}
Component.onDestruction: {
themePalette.styleColorChanged.disconnect(updateColor);
2023-11-03 15:09:42 +08:00
themePalette.systemFontChanged.disconnect(updateFont);
}
onPaletteRoleChanged: {
updateColor();
}
onAlphaChanged: {
updateColor();
}
}