nova-shell/shell/modules/BarLabel.qml

26 lines
795 B
QML

import QtQuick
import "../services" as S
// 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 ?? S.Theme.base05
text: label
width: minText ? Math.max(implicitWidth, _minMetrics.width) : implicitWidth
horizontalAlignment: minText ? Text.AlignHCenter : Text.AlignLeft
color: root.accentColor
font.pixelSize: S.Theme.fontSize
font.family: S.Theme.fontFamily
verticalAlignment: Text.AlignVCenter
TextMetrics {
id: _minMetrics
text: root.minText
font.pixelSize: root.font.pixelSize
font.family: root.font.family
}
}