All Classes Functions Properties
PreviewRatingDisplay.qml
/*
* Copyright (C) 2014 Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.0
import Ubuntu.Components 0.1
import "../../Components"
PreviewWidget {
id: root
height: childrenRect.height
Column {
anchors { left: parent.left; right: parent.right; }
visible: reviewsRepeater.count > 0
Repeater {
id: reviewsRepeater
objectName: "reviewsRepeater"
model: root.widgetData["reviews"]
delegate: Column {
id: reviewItem
objectName: "reviewItem" + index
anchors { left: parent.left; right: parent.right;}
spacing: units.gu(1)
Rating {
id: rating
objectName: "rating"
size: 5
value: modelData["rating"] || -1
visible: value >= 0
property var urlIconEmpty: widgetData["rating-icon-empty"]
property var urlIconFull: widgetData["rating-icon-full"]
property var urlIconHalf: widgetData["rating-icon-half"]
}
Label {
id: authorLabel
objectName: "authorLabel"
anchors { left: parent.left; right: parent.right }
// TODO cimi: Yet another fix requiring Palette update.
color: "grey" //Theme.palette.selected.backgroundText
opacity: .8
text: modelData["author"] || ""
visible: text !== ""
wrapMode: Text.Wrap
}
Label {
id: reviewLabel
objectName: "reviewLabel"
anchors { left: parent.left; right: parent.right }
// TODO cimi: Yet another fix requiring Palette update.
color: "grey" //Theme.palette.selected.backgroundText
opacity: .8
text: modelData["review"] || ""
visible: text !== ""
wrapMode: Text.Wrap
}
Item {
id: spacing
anchors { left: parent.left; right: parent.right }
height: units.gu(2)
visible: rating.visible || authorLabel.visible || reviewLabel.visible
}
}
}
}
}
PreviewWidget::widgetData
var widgetData
Variable used to contain widget's data.
Definition: PreviewWidget.qml:24
Rating
Definition: Rating.qml:17
PreviewWidget
Definition: PreviewWidget.qml:17