mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-05 13:03:59 -06:00
Made smallrating widget re-usable
Also added it to the details page CURA-6013
This commit is contained in:
parent
30057e2fcd
commit
7a5701b001
3 changed files with 94 additions and 77 deletions
33
plugins/Toolbox/resources/qml/SmallRatingWidget.qml
Normal file
33
plugins/Toolbox/resources/qml/SmallRatingWidget.qml
Normal file
|
@ -0,0 +1,33 @@
|
|||
import QtQuick 2.3
|
||||
import QtQuick.Controls 1.4
|
||||
import UM 1.1 as UM
|
||||
import Cura 1.1 as Cura
|
||||
|
||||
|
||||
|
||||
Row
|
||||
{
|
||||
id: rating
|
||||
height: UM.Theme.getSize("rating_star").height
|
||||
visible: model.average_rating > 0 //Has a rating at all.
|
||||
spacing: UM.Theme.getSize("thick_lining").width
|
||||
|
||||
UM.RecolorImage
|
||||
{
|
||||
id: starIcon
|
||||
source: UM.Theme.getIcon("star_filled")
|
||||
color: model.user_rating == 0 ? "#5a5a5a" : UM.Theme.getColor("primary")
|
||||
height: UM.Theme.getSize("rating_star").height
|
||||
width: UM.Theme.getSize("rating_star").width
|
||||
}
|
||||
|
||||
Label
|
||||
{
|
||||
text: model.average_rating.toFixed(1) + " (" + model.num_ratings + " " + catalog.i18nc("@label", "ratings") + ")"
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
height: starIcon.height
|
||||
anchors.verticalCenter: starIcon.verticalCenter
|
||||
color: starIcon.color
|
||||
font: UM.Theme.getFont("small")
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue