diff --git a/lookandfeel/contents/components/SessionManagementScreen.qml b/lookandfeel/contents/components/SessionManagementScreen.qml index ac4baaf6f..0e87d26cc 100644 --- a/lookandfeel/contents/components/SessionManagementScreen.qml +++ b/lookandfeel/contents/components/SessionManagementScreen.qml @@ -52,11 +52,18 @@ FocusScope { default property alias _children: innerLayout.children + // FIXME: move this component into a layout, rather than abusing + // anchors and implicitly relying on other components' built-in + // whitespace to avoid items being overlapped. UserList { id: userListView visible: showUserList && y > 0 anchors { bottom: parent.verticalCenter + // We only need an extra bottom margin when text is constrained, + // since only in this case can the username label be a multi-line + // string that would otherwise overflow. + bottomMargin: constrainText ? PlasmaCore.Units.gridUnit * 3 : 0 left: parent.left right: parent.right } diff --git a/lookandfeel/contents/components/UserDelegate.qml b/lookandfeel/contents/components/UserDelegate.qml index 9a823a289..2e1270bcd 100644 --- a/lookandfeel/contents/components/UserDelegate.qml +++ b/lookandfeel/contents/components/UserDelegate.qml @@ -53,12 +53,10 @@ Item { Item { id: imageSource - anchors { - bottom: usernameDelegate.top - bottomMargin: PlasmaCore.Units.largeSpacing - horizontalCenter: parent.horizontalCenter - } - Behavior on width { + anchors.top: parent.top + anchors.horizontalCenter: parent.horizontalCenter + + Behavior on width { PropertyAnimation { from: faceSize duration: PlasmaCore.Units.longDuration; @@ -87,11 +85,8 @@ Item { } ShaderEffect { - anchors { - bottom: usernameDelegate.top - bottomMargin: PlasmaCore.Units.largeSpacing - horizontalCenter: parent.horizontalCenter - } + anchors.top: parent.top + anchors.horizontalCenter: parent.horizontalCenter width: imageSource.width height: imageSource.height @@ -151,16 +146,18 @@ Item { PlasmaComponents3.Label { id: usernameDelegate + anchors.top: imageSource.bottom + anchors.horizontalCenter: parent.horizontalCenter + // Make it bigger than other fonts to match the scale of the avatar better font.pointSize: wrapper.fontSize + 4 - anchors { - bottom: parent.bottom - horizontalCenter: parent.horizontalCenter - } + width: constrainText ? parent.width : implicitWidth text: wrapper.name style: softwareRendering ? Text.Outline : Text.Normal styleColor: softwareRendering ? PlasmaCore.ColorScope.backgroundColor : "transparent" //no outline, doesn't matter + wrapMode: Text.WordWrap + maximumLineCount: wrapper.constrainText ? 3 : 1 elide: Text.ElideRight horizontalAlignment: Text.AlignHCenter //make an indication that this has active focus, this only happens when reached with keyboard navigation diff --git a/lookandfeel/contents/components/UserList.qml b/lookandfeel/contents/components/UserList.qml index 49f38eb7b..1f612ece6 100644 --- a/lookandfeel/contents/components/UserList.qml +++ b/lookandfeel/contents/components/UserList.qml @@ -12,6 +12,7 @@ ListView { readonly property string selectedUser: currentItem ? currentItem.userName : "" readonly property int userItemWidth: PlasmaCore.Units.gridUnit * 8 readonly property int userItemHeight: PlasmaCore.Units.gridUnit * 8 + readonly property bool constrainText: count > 1 property int fontSize: PlasmaCore.Theme.defaultFont.pointSize + 2 implicitHeight: userItemHeight @@ -72,7 +73,7 @@ ListView { 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 + constrainText: view.constrainText isCurrent: ListView.isCurrentItem