Fix PC3 TabButton alignment

Prior to a45bd75800, label alignment was
controlled by its Layout properties. However that commit made the label
fill width to fix elision, which means that the Layout.Alignment property
no longer has any effect anymore. Therefore, we need to use the
horizontalAlignment property to position the text within its
now-width-filling box.
This commit is contained in:
Nate Graham 2021-04-08 17:51:43 -06:00
parent 46b46c8135
commit 9ce8e84f5e

View File

@ -61,13 +61,12 @@ T.TabButton {
Label {
id: label
Layout.fillWidth: true
Layout.alignment: control.display != T.AbstractButton.TextBesideIcon || icon.source.length === 0 ? Qt.AlignCenter : Qt.AlignVCenter | Qt.AlignLeft
visible: text.length > 0 && control.display !== T.AbstractButton.IconOnly
text: control.Kirigami.MnemonicData.richTextLabel
font: control.font
color: control.visualFocus ? PlasmaCore.ColorScope.highlightColor : PlasmaCore.ColorScope.textColor
opacity: enabled || control.highlighted || control.checked ? 1 : 0.4
horizontalAlignment: Text.AlignHCenter
horizontalAlignment: control.display != T.AbstractButton.TextBesideIcon || icon.source.length === 0 ? Text.AlignHCenter : Text.AlignLeft
verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight
}