stable icon widths via minIcon, fix volume icon jitter

This commit is contained in:
Damocles 2026-04-12 21:00:36 +02:00
parent ae3d55912f
commit deb71231fb
2 changed files with 11 additions and 0 deletions

View file

@ -7,6 +7,7 @@ Text {
id: root
property string icon: ""
property string tooltip: ""
property string minIcon: ""
property bool _hovered: false
property string _displayIcon: icon
property string _pendingIcon: ""
@ -39,11 +40,20 @@ Text {
easing.type: Easing.OutQuad
}
}
width: minIcon ? Math.max(implicitWidth, _minIconMetrics.width) : implicitWidth
horizontalAlignment: minIcon ? Text.AlignHCenter : Text.AlignLeft
color: M.Theme.base05
font.pixelSize: M.Theme.fontSize + 1
font.family: M.Theme.iconFontFamily
verticalAlignment: Text.AlignVCenter
TextMetrics {
id: _minIconMetrics
text: root.minIcon
font.pixelSize: root.font.pixelSize
font.family: root.font.family
}
layer.enabled: _hovered && !(parent && parent._hovered === true)
layer.effect: MultiEffect {
shadowEnabled: true

View file

@ -74,6 +74,7 @@ M.BarSection {
M.BarIcon {
icon: root._volumeIcon
minIcon: "\uF028"
color: root._volumeColor
anchors.verticalCenter: parent.verticalCenter
MouseArea {