-
Notifications
You must be signed in to change notification settings - Fork 0
/
about.cpp
48 lines (41 loc) · 1.04 KB
/
about.cpp
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
#include "about.h"
#include "ui_about.h"
about::about(QWidget *parent) :
QDialog(parent),
ui(new Ui::about)
{
ui->setupUi(this);
ui->link->installEventFilter(this); // 安装事件过滤器
}
about::~about()
{
delete ui;
}
bool about::eventFilter(QObject *obj, QEvent *event)
{
if (obj == ui->link)//指定某个QLabel
{
if (event->type() == QEvent::MouseButtonPress) //鼠标点击
{
QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(event); // 事件转换
if(mouseEvent->button() == Qt::LeftButton)
{
QDesktopServices::openUrl(QUrl(QString("https://github.com/SiJin233/ER_SAVE")));
return true;
}
else
{
return false;
}
}
else
{
return false;
}
}
else
{
// pass the event on to the parent class
return QWidget::eventFilter(obj, event);
}
}