Commit f7cf3c2a authored by David Edmundson's avatar David Edmundson

Don't elide UserDelegate text when there's only one item

Summary:
In the lock screen the user delegate has to elide the text when there
are multiple items next to each other, otherwise it will overlap.

When there's only one item (which is quite common) we don't need to
and doing so looks weird.

Test Plan:
Modified SDDM dummydata/userModel to have one entry with a long name
and back to multiple entries.

Reviewers: #plasma, broulik

Reviewed By: #plasma, broulik

Subscribers: broulik, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D7472
parent cc864748
......@@ -32,6 +32,7 @@ Item {
property string userName
property string avatarPath
property string iconSource
property bool constrainText: true
signal clicked()
property real faceSize: Math.min(width, height - usernameDelegate.height - units.largeSpacing)
......@@ -132,10 +133,10 @@ Item {
id: usernameDelegate
anchors {
bottom: parent.bottom
left: parent.left
right: parent.right
horizontalCenter: parent.horizontalCenter
}
height: implicitHeight // work around stupid bug in Plasma Components that sets the height
width: constrainText ? parent.width : implicitWidth
text: wrapper.name
elide: Text.ElideRight
horizontalAlignment: Text.AlignHCenter
......
......@@ -76,6 +76,9 @@ ListView {
width: userItemWidth
height: userItemHeight
//if we only have one delegate, we don't need to clip the text as it won't be overlapping with anything
constrainText: ListView.view.count > 1
isCurrent: ListView.isCurrentItem
onClicked: {
......
......@@ -132,6 +132,7 @@ PlasmaCore.ColorScope {
horizontalCenter: parent.horizontalCenter
bottom: parent.verticalCenter
}
constrainText: false
avatarPath: kuser.faceIconUrl
iconSource: "user-identity"
isCurrent: true
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment