-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMain.qml
74 lines (67 loc) · 2.32 KB
/
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
import QtQuick 2.15
import QtQuick.Controls 2.15
ApplicationWindow {
id: window
visible: true
width: 600
height: 400
title: "AI News Social Network Simulation"
function simulateAIResponse(newsTitle, agentType) {
switch(agentType) {
case "ProGovernment":
return "Official says: " + newsTitle + " is a positive signal for progress!";
case "Skeptical":
return "Skeptic remarks: " + newsTitle + " might hide contradictions.";
case "YouthVoice":
return "Youth advocate: " + newsTitle + " inspires change!";
case "SpaceEnthusiast":
return "Cosmic view: " + newsTitle + " makes me think of our endless possibilities in space!";
default:
return "Neutral: " + newsTitle;
}
}
ListModel {
id: newsModel
ListElement { title: "Breaking News: Market Reaches All-Time High" }
ListElement { title: "Update: New Technological Innovations Unveiled" }
ListElement { title: "Alert: International Relations Tense Amid New Developments" }
}
header: ToolBar {
id: appHeader
Row {
anchors.fill: parent
spacing: 20
Label {
text: "AI News Feed"
font.bold: true
font.pointSize: 20
verticalAlignment: Text.AlignVCenter
}
Button {
text: "Refresh"
onClicked: {
newsModel.clear();
newsModel.append({ title: "Update: Economic Stimulus Boosts Job Creation" });
newsModel.append({ title: "Alert: Environmental Policies Spark Debate" });
newsModel.append({ title: "Tech: Renewable Energy Breakthrough Announced" });
}
}
}
}
ListView {
id: newsListView
anchors {
top: appHeader.bottom
left: parent.left
right: parent.right
bottom: parent.bottom
margins: 10
}
model: newsModel
delegate: NewsItem {
title: model.title
listViewWidth: newsListView.width // Pass the ListView width
listHorizontalCenter: newsListView.horizontalCenter
}
}
}