forked from HuijunXu/CUMT-Daily
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNewsList_Main.qml
88 lines (80 loc) · 2.73 KB
/
NewsList_Main.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
import QtQuick 2.0
import TimeLine 1.0
Rectangle {
id: root
width:1000
height: 1650
color: "transparent"
MouseArea{anchors.fill: parent}
ListView{
id: mainNewsList
anchors.fill: parent
Component.onCompleted: {
console.log(root.type)
mainNewsList.model=TL.getNewsByType(root.type)
//root.height=(count-1)*165*360/820+(parent.width*9/16+70*360/768)
root.height=(count+2)*165+(parent.width*9/16+70*newsList.rate)-165*newsList.rate
}
delegate:Rectangle{
id: dele
width: mainNews.width
height: index===0?(parent.width*9/16+70*newsList.rate):165*newsList.rate
Component.onCompleted: {
if(index===0){
var component = Qt.createComponent("NewsList_Top.qml");
var sprite = component.createObject(dele, {"x": 0, "y": 0});
sprite.setModel(root.type);
}
}
Image{
id: pic
width: 180*newsList.rate
height: 120*newsList.rate
anchors.left: parent.left
anchors.leftMargin: 20*newsList.rate
anchors.top: parent.top
anchors.topMargin: 20*newsList.rate
Component.onCompleted: {
source= modelData.thumbnail
}
}
Text{
id: title
anchors.top: parent.top
anchors.topMargin: 20*newsList.rate
anchors.left: pic.right
anchors.leftMargin: 10*newsList.rate
width: parent.width-220*newsList.rate
text: modelData.title
font.family: "微软雅黑"
font.pixelSize: 30*newsList.rate
}
Text{
anchors.top: title.bottom
anchors.topMargin: 10*newsList.rate
anchors.left: pic.right
anchors.leftMargin: 10*newsList.rate
width: parent.width-220*newsList.rate
height:50*newsList.rate
text: modelData.discribe
font.family: "微软雅黑"
font.pixelSize: 25*newsList.rate
color: "grey"
wrapMode: Text.Wrap
}
Rectangle{
anchors.bottom: parent.bottom
width: parent.width
height: 1
color: "lightgrey"
}
MouseArea{
anchors.fill: parent
onClicked: {
newsWindow.init(modelData.id);
newsWindow.show();
}
}
}
}
}