2
2
import Ubuntu.Components 0.1
3
3
import Ubuntu.Components.ListItems 0.1 as ListItem
14
// right: parent.right
17
// height: units.gu(10)
19
// anchors.fill: parent
20
// fillMode: Image.PreserveAspectFit
21
// source: Qt.resolvedUrl(logo)
8
anchors.margins: units.gu(2)
10
model: StackListModel {
12
path: "questions/" + questionViewer.question
14
args: "filter=!--btTK8(xvrs&sort=votes"
18
id: questionItemDelegate
27
19
width: parent.width
28
anchors.bottom: parent.bottom
29
anchors.bottomMargin: units.gu(2)
30
anchors.top: parent.top
31
anchors.topMargin: units.gu(2)
32
//contentHeight: parent.width * count
34
model: StackListModel {
36
path: "questions/" + questionViewer.question
38
args: "filter=!6JmlAA.G22_g3"//withbody"
42
id: questionItemDelegate
46
width: parent.width - units.gu(4)
20
anchors.centerIn: parent
24
width: parent.width - units.gu(2)
29
color: model.accepted_answer_id ? "green" : "gray"
30
anchors.margins: units.gu(2)
33
anchors.centerIn: parent
42
width: parent.width - question_score.width
43
anchors.left: question_score.right
44
anchors.margins: units.gu(2)
46
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
51
width: parent.width - units.gu(4)
56
height: question_body.paintedHeight
57
anchors.margins: units.gu(2)
62
width: parent.width - units.gu(2)
63
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
69
text: "Asked by: <b>" + model.owner['display_name'] + "</b> (Reputation: <b>" + model.owner['reputation'] + "</b>)"
74
anchors.topMargin: units.gu(2)
87
property var owner: ''
89
property var score: ''
90
property bool accepted:undefined
91
width: parent.width - units.gu(4)
96
color: accepted ? "green" : "gray"
97
anchors.margins: units.gu(2)
102
anchors.centerIn: parent
48
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
111
text: " by: <b>" + owner + "</b> (Reputation: <b>" + rep + "</b>)"
112
anchors.left: answer_score.right
113
anchors.verticalCenter: answer_score.verticalCenter
114
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
120
id: answerBodyComponent
123
property var body: ''
125
width: parent.width - units.gu(4)
126
height: answer_body.paintedHeight + units.gu(5)
131
height: answer_body.paintedHeight
133
anchors.margins: units.gu(2)
52
138
width: parent.width - units.gu(4)
53
139
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
56
// text: model.answers[0]["body"]
57
// width: parent.width - units.gu(4)
58
// wrapMode: Text.WrapAtWordBoundaryOrAnywhere
145
Component.onCompleted: {
146
if (model.answer_count > 0 && model.answers){
147
for (var i=0; i<model.answer_count; i++){
148
var answerer = answererComponent.createObject(questionItemDelegate)
149
var answer = answerBodyComponent.createObject(questionItemDelegate)
150
answer.body = model.answers.get(i).body
151
answerer.accepted = model.answers.get(i)["is_accepted"]
152
answerer.score = model.answers.get(i)["score"]
153
answerer.owner = model.answers.get(i).owner['display_name']
154
answerer.rep = model.answers.get(i).owner['reputation']