Use frameSVG's margins to calculate face position

* Remove double setting of delegate width/height
* Calculate delegate height internally instead of hardcoding
* Move notificaton out of delegate so it doesn't move when scrolling
*
wilder-5.14
David Edmundson 12 years ago
parent f98379fae2
commit b56b286dd9
  1. 68
      lookandfeel/contents/components/UserDelegate.qml
  2. 1
      lookandfeel/contents/components/UserList.qml
  3. 25
      lookandfeel/contents/components/UserSelect.qml

@ -31,26 +31,14 @@ Item {
property string name
property string userName
property alias iconSource: face.source
property alias faceSize: face.width
property alias notification: notificationText.text
readonly property int padding: 3 //face.fixedMargins.top
property alias faceSize: frame.width
signal clicked()
width: userItemWidth
height: userItemHeight
height: faceSize + loginText.implicitHeight
opacity: isCurrent ? 1.0 : 0.618
Rectangle {//debug
visible: debug
border.color: "blue"
border.width: 1
anchors.fill: parent
color: "#00000000"
z:-1000
}
Behavior on opacity {
NumberAnimation { duration: 250 }
}
@ -62,7 +50,6 @@ Item {
top: parent.top
left: parent.left
right: parent.right
topMargin: padding*3
}
height: parent.height*2/3
@ -82,68 +69,41 @@ Item {
id: frame
imagePath: "widgets/background"
//width is set in alias at top
height: width
anchors {
fill: face
margins: -padding*3
horizontalCenter: parent.horizontalCenter
top: parent.top
}
}
PlasmaCore.IconItem {
id: face
anchors {
horizontalCenter: parent.horizontalCenter
top: parent.top
fill: frame
//negative to make frame around the image
topMargin: frame.margins.top
leftMargin: frame.margins.left
rightMargin: frame.margins.right
bottomMargin: frame.margins.bottom
}
height: width
}
}
BreezeLabel {
id: loginText
anchors {
bottom: notificationText.top
left: parent.left
right: parent.right
}
text: wrapper.name
elide: Text.ElideRight
horizontalAlignment: Text.AlignHCenter
maximumLineCount: 2
wrapMode: Text.Wrap
height: Math.round(Math.max(paintedHeight, theme.mSize(theme.defaultFont).height*1.2))
Rectangle {//debug
visible: debug
border.color: "red"
border.width: 1
anchors.fill: parent
color: "#00000000"
z:-1000
}
}
BreezeLabel {
id: notificationText
anchors {
bottom: parent.bottom
left: parent.left
right: parent.right
bottomMargin: padding
}
text: wrapper.name
elide: Text.ElideRight
horizontalAlignment: Text.AlignHCenter
maximumLineCount: 2
wrapMode: Text.Wrap
font.weight: Font.Bold
height: Math.round(Math.max(paintedHeight, theme.mSize(theme.defaultFont).height*1.2))
Rectangle {//debug
visible: debug
border.color: "yellow"
border.width: 1
anchors.fill: parent
color: "#00000000"
z:-1000
}
}
MouseArea {

@ -34,7 +34,6 @@ ListView {
userName: model.name
iconSource: model.icon ? model.icon : "user-identity"
width: view.userItemWidth
height: view.userItemHeight
faceSize: view.userFaceSize
onClicked: {

@ -24,18 +24,12 @@ import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
Item {
height: usersList.height
property alias model: usersList.model
property alias selectedUser: usersList.selectedUser
property alias selectedIndex: usersList.currentIndex
property alias delegate: usersList.delegate
property string notification: ""
property alias notification: notificationLabel.text
onNotificationChanged: {
usersList.currentItem.notification = notification
}
InfoPane {
id: infoPane
anchors {
@ -95,4 +89,21 @@ Item {
currentIndex = 0;
}
}
BreezeLabel {
id: notificationLabel
anchors {
bottom: parent.bottom
horizontalCenter: parent.horizontalCenter
}
width: usersList.userItemWidth * 3 //don't pass the infoPane
horizontalAlignment: Text.AlignHCenter
maximumLineCount: 1
wrapMode: Text.Wrap
font.weight: Font.Bold
height: Math.round(Math.max(paintedHeight, theme.mSize(theme.defaultFont).height*1.2))
}
}

Loading…
Cancel
Save