Implemented InfoRating interaction and value.

This commit is contained in:
Luis Ángel San Martín 2016-04-17 21:49:54 +02:00
parent bcc51241b3
commit aad00d77d3
2 changed files with 28 additions and 3 deletions

View File

@ -105,6 +105,7 @@ Rectangle {
InfoRating {
Layout.alignment: Qt.AlignTop
Layout.rightMargin: 30
rating: comicInfo.rating
}
visible: mainContainer.compact
@ -146,6 +147,7 @@ Rectangle {
InfoRating {
Layout.alignment: Qt.AlignTop
Layout.rightMargin: 30
rating: comicInfo.rating
}
}
}

View File

@ -3,13 +3,17 @@ import QtQuick 2.6
import QtGraphicalEffects 1.0
Row {
spacing: 6
spacing: 0
property int rating : 0
property int mouseIndex : 0
signal ratingChangedByUser(int rating)
Repeater {
id: rating_compact
model: 5
Item {
width: 20
width: 25
height: 20
Image {
@ -20,8 +24,27 @@ Row {
ColorOverlay {
anchors.fill: star
source: star
color: index <= 2 ? "#ffffff" : "#1c1c1c"
color: index < (mouseIndex > 0 ? mouseIndex : rating) ? "#ffffff" : "#1c1c1c"
}
MouseArea {
anchors.fill: parent
hoverEnabled: true
onPositionChanged: {
mouseIndex = index + 1;
}
onClicked: {
ratingChangedByUser(mouseIndex);
}
onExited: {
mouseIndex = 0;
}
}
}
}
}