-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCommentDelegate.qml
123 lines (114 loc) · 3.74 KB
/
CommentDelegate.qml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
import QtQuick 2.0
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
Rectangle {
color: "transparent"
width: commentview.width
implicitHeight: 50 + cmtext.height
Rectangle {
anchors.left: parent.left
anchors.leftMargin: model.indent
width: parent.width
height: parent.height
// implicitWidth: 50 + cmtext.width
radius: 10
border.width: 0.8
border.color: "#E0E0E0"
Component.onCompleted: {
commentview.sizesum += 10 + parent.height
commentview.maxIndent = Math.max(model.indent, commentview.maxIndent)
}
Rectangle {
anchors.left: parent.left
anchors.leftMargin: 1
anchors.verticalCenter: parent.verticalCenter
height: parent.height - 15
width: 2
color: "#f56565"
}
Rectangle {
id: commentinfo
anchors.left: parent.left
anchors.leftMargin: 20
anchors.top: parent.top
anchors.topMargin: 5
width: parent.width - 40
height: 20
// spacing: 0
Label {
id: authortext
anchors.left: parent.left
text: model.author
font.bold: Font.Medium
}
Label {
id: datetext
anchors.left: authortext.right
anchors.bottom: authortext.bottom
anchors.leftMargin: 10
anchors.bottomMargin: 2
text: model.date
color: "#718096"
font.pixelSize: 10
Layout.preferredWidth: 5
}
Label {
id: seprator
anchors.left: datetext.right
anchors.bottom: authortext.bottom
anchors.leftMargin: 5
text: "|"
Layout.preferredWidth: 1
}
ClickableText {
id: childnumber
anchors.left: seprator.right
anchors.bottom: authortext.bottom
anchors.leftMargin: 5
font.pixelSize: 11
text: model.childs + " reply"
color: "#f56565"
Layout.preferredWidth: contentWidth
onClicked: model.childs != 0 ? commentmodel.getReplies(index, model.id) : 0
}
ClickableText {
id: replyicon
anchors.right: parent.right
anchors.rightMargin: -5
font.family: "fontello"
font.pixelSize: 13
text: "\uf112"
color: "#9E9E9E"
onClicked: cmpage.replyTo(model.id, model.author, model.indent)
}
Label {
id: removeicon
visible: loginhandler.username == model.author
anchors.right: replyicon.left
anchors.rightMargin: 5
font.family: "fontello"
font.pixelSize: 15
text: "\ue800"
color: "#FF3D00"
MouseArea {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onClicked: {
commentmodel.remove(index)
commentview.sizesum -= 40 + cmtext.height
}
}
}
}
Text {
id: cmtext
anchors.top: commentinfo.bottom
anchors.topMargin: 15
anchors.left: parent.left
anchors.leftMargin: 15
width: parent.width - 50
text: model.text
wrapMode: Text.Wrap
}
}
}