stable icon widths via minIcon, fix volume icon jitter
This commit is contained in:
parent
ae3d55912f
commit
deb71231fb
2 changed files with 11 additions and 0 deletions
|
|
@ -7,6 +7,7 @@ Text {
|
||||||
id: root
|
id: root
|
||||||
property string icon: ""
|
property string icon: ""
|
||||||
property string tooltip: ""
|
property string tooltip: ""
|
||||||
|
property string minIcon: ""
|
||||||
property bool _hovered: false
|
property bool _hovered: false
|
||||||
property string _displayIcon: icon
|
property string _displayIcon: icon
|
||||||
property string _pendingIcon: ""
|
property string _pendingIcon: ""
|
||||||
|
|
@ -39,11 +40,20 @@ Text {
|
||||||
easing.type: Easing.OutQuad
|
easing.type: Easing.OutQuad
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
width: minIcon ? Math.max(implicitWidth, _minIconMetrics.width) : implicitWidth
|
||||||
|
horizontalAlignment: minIcon ? Text.AlignHCenter : Text.AlignLeft
|
||||||
color: M.Theme.base05
|
color: M.Theme.base05
|
||||||
font.pixelSize: M.Theme.fontSize + 1
|
font.pixelSize: M.Theme.fontSize + 1
|
||||||
font.family: M.Theme.iconFontFamily
|
font.family: M.Theme.iconFontFamily
|
||||||
verticalAlignment: Text.AlignVCenter
|
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.enabled: _hovered && !(parent && parent._hovered === true)
|
||||||
layer.effect: MultiEffect {
|
layer.effect: MultiEffect {
|
||||||
shadowEnabled: true
|
shadowEnabled: true
|
||||||
|
|
|
||||||
|
|
@ -74,6 +74,7 @@ M.BarSection {
|
||||||
|
|
||||||
M.BarIcon {
|
M.BarIcon {
|
||||||
icon: root._volumeIcon
|
icon: root._volumeIcon
|
||||||
|
minIcon: "\uF028"
|
||||||
color: root._volumeColor
|
color: root._volumeColor
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
MouseArea {
|
MouseArea {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue