ukui-menu/qml/AppControls2/StyleText.qml

34 lines
933 B
QML

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);
}
function updateFont() {
font = themePalette.systemFont();
}
Component.onCompleted: {
updateColor();
updateFont();
themePalette.styleColorChanged.connect(updateColor);
themePalette.systemFontChanged.connect(updateFont);
}
Component.onDestruction: {
themePalette.styleColorChanged.disconnect(updateColor);
themePalette.systemFontChanged.disconnect(updateFont);
}
onPaletteRoleChanged: {
updateColor();
}
onAlphaChanged: {
updateColor();
}
}