nova-shell/shell/modules/BarLabel.qml

27 lines
842 B
QML

import QtQuick
import "../services" as S
import NovaStats as NS
// Label element with minimum-width support via minText.
// Pure visual component - tooltip handling lives in the parent BarModule.
Text {
id: root
property string label: ""
property string minText: ""
property color accentColor: parent?.accentColor ?? NS.ThemeService.base05
text: label
width: minText ? Math.max(implicitWidth, _minMetrics.width) : implicitWidth
horizontalAlignment: minText ? Text.AlignHCenter : Text.AlignLeft
color: root.accentColor
font.pixelSize: NS.ThemeService.fontSize
font.family: NS.ThemeService.fontFamily
verticalAlignment: Text.AlignVCenter
TextMetrics {
id: _minMetrics
text: root.minText
font.pixelSize: root.font.pixelSize
font.family: root.font.family
}
}