-
Notifications
You must be signed in to change notification settings - Fork 65
/
mymessagebox.cpp
36 lines (32 loc) · 935 Bytes
/
mymessagebox.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
#include "mymessagebox.h"
#include "ui_mymessagebox.h"
#include<QDesktopWidget>
#include<QListWidget>
#include<mylistwidget.h>
Mymessagebox::Mymessagebox(QWidget *parent) :
QWidget(parent),
ui(new Ui::Mymessagebox)
{
ui->setupUi(this);
setWindowFlags(Qt::FramelessWindowHint|Qt::Tool);
setAttribute(Qt::WA_TranslucentBackground);
ui->label_2->installEventFilter(this);
QRect rect = QApplication::desktop()->availableGeometry();
move(rect.width()-width()-10,rect.height()-height()-3);
QListWidgetItem* item1=new QListWidgetItem();
item1->setSizeHint(QSize(0,70));
Mylistwidget* m=new Mylistwidget();
ui->listWidget->addItem(item1);
ui->listWidget->setItemWidget(item1,m);
}
Mymessagebox::~Mymessagebox()
{
delete ui;
}
bool Mymessagebox::eventFilter(QObject *object, QEvent *e)
{
if(e->type()==QEvent::MouseButtonPress&&object==ui->label_2)
{
hide();
}
}