From 0dad5f0789c8eb5e4fa893622fdc550898488779 Mon Sep 17 00:00:00 2001 From: Nate Graham Date: Fri, 2 Sep 2022 15:29:16 -0600 Subject: [PATCH] =?UTF-8?q?kcms/users:=20don't=20let=20"Choose=20File?= =?UTF-8?q?=E2=80=A6"=20text=20overflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- .../package/contents/ui/UserDetailsPage.qml | 44 ++++++++++++------- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/kcms/users/package/contents/ui/UserDetailsPage.qml b/kcms/users/package/contents/ui/UserDetailsPage.qml index 35da764bf..f49457c2f 100644 --- a/kcms/users/package/contents/ui/UserDetailsPage.qml +++ b/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 + } } }