1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-09-01 18:04:05 +02:00

increase delegate size and add hover effect

This commit is contained in:
Michael Zanetti
2012-12-02 21:32:12 +01:00
parent 73b5e977c8
commit 3f7f1df61f
2 changed files with 32 additions and 4 deletions

View File

@@ -32,7 +32,7 @@ Item {
}
Row {
width: defaultFontHeight * 15
width: defaultFontHeight * 30
height: artistInputField.height
spacing: defaultFontHeight
@@ -50,9 +50,10 @@ Item {
ArtistView {
height: parent.height - headerText.height - artistInputField.height
width: defaultFontHeight * 15
width: defaultFontHeight * 30
model: artistChartsModel
clip: true
delegateHeight: defaultFontHeight * 6
onItemClicked: {
mainView.startStationFromArtist(artistChartsModel.itemFromIndex(index).artistName)

View File

@@ -4,19 +4,41 @@ import tomahawk 1.0
ListView {
id: root
property int delegateHeight: defaultFontHeight * 3
signal itemClicked(int index)
delegate: Item {
width: parent.width
height: defaultFontHeight * 3
height: root.delegateHeight
Rectangle {
id: background
anchors.fill: parent
radius: defaultFontHeight / 2
opacity: 0.5
gradient: Gradient {
GradientStop { position: 0.0; color: "#00FFFFFF" }
GradientStop { position: 1.0; color: "#55FFFFFF" }
GradientStop { position: 1.0; color: "#AAFFFFFF" }
}
states: [
State {
name: "hovered"; when: mouseArea.containsMouse
PropertyChanges { target: background; opacity: 1 }
}
]
transitions: [
Transition {
from: "*"; to: "hovered"
NumberAnimation { properties: "opacity"; duration: 100 }
},
Transition {
from: "hovered"; to: "*"
NumberAnimation { properties: "opacity"; duration: 600 }
}
]
}
Row {
@@ -24,6 +46,7 @@ ListView {
spacing: defaultFontHeight
CoverImage {
id: coverImage
height: parent.height
width: height
showLabels: false
@@ -33,12 +56,16 @@ ListView {
text: model.artistName
color: "white"
anchors.verticalCenter: parent.verticalCenter
width: parent.width - coverImage.width - parent.spacing
elide: Text.ElideRight
}
}
MouseArea {
id: mouseArea
anchors.fill: parent
onClicked: root.itemClicked(index)
hoverEnabled: true
}
}
}