diff --git a/YACReaderLibrary/qml/ComicInfo.qml b/YACReaderLibrary/qml/ComicInfo.qml index 48291cef..f1f48084 100644 --- a/YACReaderLibrary/qml/ComicInfo.qml +++ b/YACReaderLibrary/qml/ComicInfo.qml @@ -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 } } } diff --git a/YACReaderLibrary/qml/InfoRating.qml b/YACReaderLibrary/qml/InfoRating.qml index 9e730195..9a2e5e76 100644 --- a/YACReaderLibrary/qml/InfoRating.qml +++ b/YACReaderLibrary/qml/InfoRating.qml @@ -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; + } } } } + + }