diff --git a/lookandfeel/contents/components/SessionManagementScreen.qml b/lookandfeel/contents/components/SessionManagementScreen.qml index 8e99c2840..c64e481fd 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 f6c3ca205..7515b1fa2 100644 --- a/lookandfeel/contents/components/UserDelegate.qml +++ b/lookandfeel/contents/components/UserDelegate.qml @@ -54,11 +54,9 @@ Item { Item { id: imageSource - anchors { - bottom: usernameDelegate.top - bottomMargin: PlasmaCore.Units.largeSpacing - horizontalCenter: parent.horizontalCenter - } + anchors.top: parent.top + anchors.horizontalCenter: parent.horizontalCenter + Behavior on width { PropertyAnimation { from: faceSize @@ -88,11 +86,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 @@ -152,16 +147,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 d60498e6c..a9719b81c 100644 --- a/lookandfeel/contents/components/UserList.qml +++ b/lookandfeel/contents/components/UserList.qml @@ -13,6 +13,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 @@ -73,7 +74,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