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
wilder-5.14
David Edmundson 9 years ago
parent cc86474810
commit f7cf3c2a68
  1. 5
      lookandfeel/contents/components/UserDelegate.qml
  2. 3
      lookandfeel/contents/components/UserList.qml
  3. 1
      lookandfeel/contents/logout/Logout.qml

@ -32,6 +32,7 @@ Item {
property string userName property string userName
property string avatarPath property string avatarPath
property string iconSource property string iconSource
property bool constrainText: true
signal clicked() signal clicked()
property real faceSize: Math.min(width, height - usernameDelegate.height - units.largeSpacing) property real faceSize: Math.min(width, height - usernameDelegate.height - units.largeSpacing)
@ -132,10 +133,10 @@ Item {
id: usernameDelegate id: usernameDelegate
anchors { anchors {
bottom: parent.bottom bottom: parent.bottom
left: parent.left horizontalCenter: parent.horizontalCenter
right: parent.right
} }
height: implicitHeight // work around stupid bug in Plasma Components that sets the height height: implicitHeight // work around stupid bug in Plasma Components that sets the height
width: constrainText ? parent.width : implicitWidth
text: wrapper.name text: wrapper.name
elide: Text.ElideRight elide: Text.ElideRight
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter

@ -76,6 +76,9 @@ ListView {
width: userItemWidth width: userItemWidth
height: userItemHeight 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 isCurrent: ListView.isCurrentItem
onClicked: { onClicked: {

@ -132,6 +132,7 @@ PlasmaCore.ColorScope {
horizontalCenter: parent.horizontalCenter horizontalCenter: parent.horizontalCenter
bottom: parent.verticalCenter bottom: parent.verticalCenter
} }
constrainText: false
avatarPath: kuser.faceIconUrl avatarPath: kuser.faceIconUrl
iconSource: "user-identity" iconSource: "user-identity"
isCurrent: true isCurrent: true

Loading…
Cancel
Save