mirror of
				https://github.com/YACReader/yacreader
				synced 2025-11-04 01:05:06 -05:00 
			
		
		
		
	Implemented InfoRating interaction and value.
This commit is contained in:
		@ -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
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
@ -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;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user