-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpreventalz.cpp
More file actions
210 lines (189 loc) · 8.95 KB
/
preventalz.cpp
File metadata and controls
210 lines (189 loc) · 8.95 KB
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
#include "preventalz.h"
preventALZ::preventALZ(QWidget* parent)
: ElaScrollPage(parent)
{
QWidget* centralWidget = new QWidget(this);
centralWidget->setWindowTitle("关于阿尔茨海默病");
QVBoxLayout* centerVLayout = new QVBoxLayout(centralWidget);
centerVLayout->setContentsMargins(0, 0, 0, 0);
ElaImageCard* backgroundCard = new ElaImageCard(this);
backgroundCard->setCardImage(QImage(":/icon/picture/Home_Background.png"));
ElaText* flowLayoutText = new ElaText("防阿尔茨海默病训练", this);
// ElaFlowLayout
ElaPopularCard* homeCard = new ElaPopularCard(this);
connect(homeCard, &ElaPopularCard::popularCardButtonClicked, this, [=]() {
QDesktopServices::openUrl(QUrl("https://www.bilibili.com/video/BV1zj411K7ue"));
});
homeCard->setCardPixmap(QPixmap(":/icon/picture/知识库.png"));
homeCard->setTitle("怎么吃、动、训练");
homeCard->setSubTitle("5.0⭐ 防治阿尔茨海默病知识与技能");
homeCard->setInteractiveTips("点击观看");
homeCard->setDetailedText("主要包含六个方面:饮食、运动、睡眠调节、压力管理、避免环境危害、生活起居和职业行为。");
ElaPopularCard* homeCard1 = new ElaPopularCard(this);
connect(homeCard1, &ElaPopularCard::popularCardButtonClicked, this, [=]() {
QDesktopServices::openUrl(QUrl("https://www.bilibili.com/video/BV14m421G76A"));
});
homeCard1->setTitle("大脑健康警告信号和抗衰老技术");
homeCard1->setSubTitle("5.0⭐ 预防阿尔茨海默氏症");
homeCard1->setCardPixmap(QPixmap(":/icon/picture/R-医学.png"));
homeCard1->setInteractiveTips("点击观看");
homeCard1->setDetailedText("Leroy Hood 博士与我一起参加“医生的药房”这一集,阐明大脑健康和科学健康的未来。");
ElaPopularCard* homeCard2 = new ElaPopularCard(this);
connect(homeCard2, &ElaPopularCard::popularCardButtonClicked, this, [=]() {
QDesktopServices::openUrl(QUrl("https://www.bilibili.com/video/BV1S3411H7gt"));
});
homeCard2->setTitle("阿尔茨海默病的防与治");
homeCard2->setSubTitle("5.0⭐ 徐俊:守住记忆");
homeCard2->setCardPixmap(QPixmap(":/icon/picture/记忆.png"));
homeCard2->setInteractiveTips("点击观看");
homeCard2->setDetailedText("徐俊教授,首都医科大学附属北京天坛医院神经病学中心认知障碍科主任医师。");
ElaPopularCard* homeCard3 = new ElaPopularCard(this);
connect(homeCard3, &ElaPopularCard::popularCardButtonClicked, this, [=]() {
QDesktopServices::openUrl(QUrl("https://www.bilibili.com/video/BV1Gy42187ZA"));
});
homeCard3->setTitle("如何预防阿尔茨海默病");
homeCard3->setSubTitle("5.0⭐ 脑健康与脑寿命");
homeCard3->setCardPixmap(QPixmap(":/icon/picture/摇手.png"));
homeCard3->setInteractiveTips("点击观看");
homeCard3->setDetailedText("Dr. Richard Isaacson is the founder and former Director of the Alzheimer’s Prevention Clinic at the Weill Cornell Memory Disorders Program. ");
// ElaPopularCard* homeCard4 = new ElaPopularCard(this);
// connect(homeCard4, &ElaPopularCard::popularCardButtonClicked, this, [=]() { Q_EMIT elaCardNavigation(); });
// homeCard4->setTitle("NONE");
// homeCard4->setSubTitle("5.0⭐ NONE");
// homeCard4->setCardPixmap(QPixmap(":/Resource/Image/control/FlipView.png"));
// homeCard4->setInteractiveTips("NONE");
// homeCard4->setDetailedText("NONE");
// homeCard4->setCardFloatPixmap(QPixmap(":/Resource/Image/IARC/IARC_7+.svg.png"));
// ElaPopularCard* homeCard5 = new ElaPopularCard(this);
// connect(homeCard5, &ElaPopularCard::popularCardButtonClicked, this, [=]() { Q_EMIT elaIconNavigation(); });
// homeCard5->setTitle("NONE");
// homeCard5->setSubTitle("5.0⭐ NONE");
// homeCard5->setCardPixmap(QPixmap(":/Resource/Image/control/CommandBarFlyout.png"));
// homeCard5->setInteractiveTips("NONE");
// homeCard5->setDetailedText("NONE");
// homeCard5->setCardFloatPixmap(QPixmap(":/Resource/Image/IARC/IARC_7+.svg.png"));
ElaFlowLayout* flowLayout = new ElaFlowLayout(0, 5, 5);
flowLayout->setIsAnimation(true);
flowLayout->addWidget(homeCard);
flowLayout->addWidget(homeCard1);
flowLayout->addWidget(homeCard2);
flowLayout->addWidget(homeCard3);
// flowLayout->addWidget(homeCard4);
// flowLayout->addWidget(homeCard5);
centerVLayout->addWidget(backgroundCard);
centerVLayout->addWidget(flowLayoutText);
centerVLayout->addLayout(flowLayout);
centerVLayout->setSpacing(20);
centerVLayout->addStretch();
addCentralWidget(centralWidget);
ElaText* homeStack1 = new ElaText("HomeStack1", this);
QFont font = homeStack1->font();
font.setPixelSize(32);
homeStack1->setFont(font);
homeStack1->setAlignment(Qt::AlignCenter);
homeStack1->setWindowTitle("HomeStack1");
addCentralWidget(homeStack1);
ElaText* homeStack2 = new ElaText("HomeStack2", this);
homeStack2->setFont(font);
homeStack2->setAlignment(Qt::AlignCenter);
homeStack2->setWindowTitle("HomeStack2");
addCentralWidget(homeStack2);
ElaAcrylicUrlCard* urlCard1 = new ElaAcrylicUrlCard(this);
urlCard1->setUrl("https://www.bilibili.com/video/BV13q4y1i7x2");
urlCard1->setCardPixmap(QPixmap(":/icon/picture/大脑.png"));
urlCard1->setTitle("TED科普动画");
urlCard1->setSubTitle("什么是阿兹海默症");
ElaAcrylicUrlCard* urlCard2 = new ElaAcrylicUrlCard(this);
urlCard2->setUrl("https://www.bilibili.com/video/BV1Tx411Y7i1/");
urlCard2->setCardPixmap(QPixmap(":/icon/picture/大脑2.png"));
urlCard2->setTitle("【科普】");
urlCard2->setSubTitle("你了解阿尔兹海默症吗");
ElaScrollArea* cardScrollArea = new ElaScrollArea(backgroundCard);
cardScrollArea->setWidgetResizable(true);
cardScrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
cardScrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
cardScrollArea->setIsGrabGesture(Qt::Horizontal, true);
QWidget* cardScrollAreaWidget = new QWidget(this);
cardScrollAreaWidget->setStyleSheet("background-color:transparent;");
cardScrollArea->setWidget(cardScrollAreaWidget);
QHBoxLayout* cardScrollAreaWidgetLayout = new QHBoxLayout(cardScrollAreaWidget);
cardScrollAreaWidgetLayout->setSpacing(15);
cardScrollAreaWidgetLayout->setContentsMargins(20, 40, 0, 0);
cardScrollAreaWidgetLayout->addWidget(urlCard1);
cardScrollAreaWidgetLayout->addWidget(urlCard2);
cardScrollAreaWidgetLayout->addStretch();
QHBoxLayout* backgroundLayout = new QHBoxLayout(backgroundCard);
backgroundLayout->addWidget(cardScrollArea);
backgroundLayout->setContentsMargins(0, 0, 0, 0);
// 菜单
_homeMenu = new ElaMenu(this);
ElaMenu* checkMenu = _homeMenu->addMenu(ElaIconType::Cubes, "查看");
checkMenu->addAction("查看1");
checkMenu->addAction("查看2");
checkMenu->addAction("查看3");
checkMenu->addAction("查看4");
ElaMenu* checkMenu1 = _homeMenu->addMenu(ElaIconType::Cubes, "查看");
checkMenu1->addAction("查看1");
checkMenu1->addAction("查看2");
checkMenu1->addAction("查看3");
checkMenu1->addAction("查看4");
ElaMenu* checkMenu2 = checkMenu->addMenu(ElaIconType::Cubes, "查看");
checkMenu2->addAction("查看1");
checkMenu2->addAction("查看2");
checkMenu2->addAction("查看3");
checkMenu2->addAction("查看4");
// QKeySequence key = QKeySequence(Qt::CTRL | Qt::Key_S);
_homeMenu->addSeparator();
_homeMenu->addElaIconAction(ElaIconType::BoxCheck, "排序方式", QKeySequence::Save);
_homeMenu->addElaIconAction(ElaIconType::ArrowRotateRight, "刷新");
QAction* action = _homeMenu->addElaIconAction(ElaIconType::ArrowRotateLeft, "撤销");
connect(action, &QAction::triggered, this, [=]() {
ElaNavigationRouter::getInstance()->navigationRouteBack();
});
_homeMenu->addElaIconAction(ElaIconType::Copy, "复制");
_homeMenu->addElaIconAction(ElaIconType::MagnifyingGlassPlus, "显示设置");
}
preventALZ::~preventALZ()
{
}
void preventALZ::mouseReleaseEvent(QMouseEvent* event)
{
switch (event->button())
{
case Qt::LeftButton:
{
//ElaMessageBar::success(ElaMessageBarType::TopRight, "Success", "Never Close Your Eyes", 2500);
//ElaMessageBar::success(ElaMessageBarType::TopRight, "Success", "Never Close Your Eyes", 1500);
break;
}
case Qt::RightButton:
{
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
_homeMenu->popup(event->globalPosition().toPoint());
#else
_homeMenu->popup(event->globalPos());
#endif
break;
}
case Qt::BackButton:
{
this->navigation(0);
break;
}
case Qt::ForwardButton:
{
this->navigation(1);
break;
}
case Qt::MiddleButton:
{
this->navigation(2);
break;
}
default:
{
break;
}
}
ElaScrollPage::mouseReleaseEvent(event);
}