ukui-menu/qml/AppControls2/StyleText.qml

34 lines
971 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 updateFontSize() {
systemFontSize = themePalette.systemFontSize();
}
Component.onCompleted: {
updateColor();
updateFontSize();
themePalette.styleColorChanged.connect(updateColor);
themePalette.systemFontSizeChanged.connect(updateFontSize);
}
Component.onDestruction: {
themePalette.styleColorChanged.disconnect(updateColor);
themePalette.systemFontSizeChanged.disconnect(updateFontSize);
}
onPaletteRoleChanged: {
updateColor();
}
onAlphaChanged: {
updateColor();
}
}