kcms/users: don't let "Choose File…" text overflow

When using a language that's wordier than English and this label becomes
a two-line string, currently the layout breaks and the string overflows
because the Label item that draws it has no maximum height and elision
mode set.

This commit fixes that by setting them accordingly, and also using a
standard icon size for the icon so that there's actually enough room for
two lines of text.

BUG: 458614
FIXED-IN: 5.24.7
wilder-5.26
Nate Graham 4 years ago
parent 5b5b79ff61
commit 0dad5f0789
  1. 44
      kcms/users/package/contents/ui/UserDetailsPage.qml

@ -281,28 +281,38 @@ SimpleKCM {
Layout.rightMargin: Kirigami.Units.largeSpacing
QQC2.Button {
id: openButton
Layout.preferredHeight: Kirigami.Units.gridUnit * 6
Layout.preferredWidth: Layout.preferredHeight
ColumnLayout {
anchors.centerIn: parent
contentItem: Item {
ColumnLayout {
// Centering rather than filling is desired to keep the
// entire layout nice and tight when the text is short
anchors.centerIn: parent
spacing: 0 // the icon should bring its own
Kirigami.Icon {
implicitWidth: Kirigami.Units.gridUnit * 4
implicitHeight: Kirigami.Units.gridUnit * 4
source: "document-open"
Kirigami.Icon {
id: openIcon
Layout.alignment: Qt.AlignHCenter
}
QQC2.Label {
text: i18n("Choose File…")
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignBottom
fontSizeMode: Text.HorizontalFit
wrapMode: Text.Wrap
Layout.fillWidth: true
Layout.maximumWidth: Kirigami.Units.gridUnit * 5
implicitWidth: Kirigami.Units.iconSizes.huge
implicitHeight: Kirigami.Units.iconSizes.huge
source: "document-open"
Layout.alignment: Qt.AlignHCenter
}
QQC2.Label {
text: i18n("Choose File…")
Layout.fillWidth: true
Layout.maximumWidth: Kirigami.Units.gridUnit * 5
Layout.maximumHeight: openButton.availableHeight - openIcon.height
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignBottom
fontSizeMode: Text.HorizontalFit
wrapMode: Text.Wrap
elide: Text.ElideRight
}
}
}

Loading…
Cancel
Save