-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathfrmoperateparentmsgbox.cpp
More file actions
87 lines (77 loc) · 2.14 KB
/
frmoperateparentmsgbox.cpp
File metadata and controls
87 lines (77 loc) · 2.14 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
#include "frmoperateparentmsgbox.h"
#include "ui_frmoperateparentmsgbox.h"
#include "frmmessagebox.h"
#include "ui_frmmessagebox.h"
#include "iconhelper.h"
#include "myhelper.h"
FrmOperateParentMsgBox::FrmOperateParentMsgBox(QWidget *parent) :
QDialog(parent),
ui(new Ui::FrmOperateParentMsgBox)
{
ui->setupUi(this);
this->mousePressed = false;
//设置窗体标题栏隐藏
this->setWindowFlags(Qt::FramelessWindowHint);
//设置窗体关闭时自动释放内存
//this->setAttribute(Qt::WA_DeleteOnClose);
//设置图形字体
IconHelper::Instance()->SetIcon(ui->lab_Ico, QChar(0xf015), 12);
IconHelper::Instance()->SetIcon(ui->btnMenu_Close, QChar(0xf00d), 10);
//关联关闭按钮
connect(ui->btnMenu_Close, SIGNAL(clicked()), this, SLOT(close()));
connect(ui->btnCancel, SIGNAL(clicked()), this, SLOT(close()));
//窗体居中显示
myHelper::FormInCenter(this);
}
FrmOperateParentMsgBox::~FrmOperateParentMsgBox()
{
delete ui;
}
void FrmOperateParentMsgBox::SetMessage(const QString &msg, int type)
{
QString name=msg;
if (type == 0)
{
ui->leName->setText(name);
ui->lab_Title->setText("新建区域");
} else if (type == 1)
{
ui->leName->setText(name);
ui->lab_Title->setText("修改区域");
} else if (type == 2)
{
ui->lab_Title->setText("错误");
}
}
void FrmOperateParentMsgBox::on_btnOk_clicked()
{
done(QDialog::Accepted);
if(ui->leName->text()!="")
{
emit sigoperate(ui->leName->text());
this->close();
}
else
{
myHelper::ShowMessageBoxError("名称不能为空");
}
}
void FrmOperateParentMsgBox::mouseMoveEvent(QMouseEvent *e)
{
if (mousePressed && (e->buttons() && Qt::LeftButton)) {
this->move(e->globalPos() - mousePoint);
e->accept();
}
}
void FrmOperateParentMsgBox::mousePressEvent(QMouseEvent *e)
{
if (e->button() == Qt::LeftButton) {
mousePressed = true;
mousePoint = e->globalPos() - this->pos();
e->accept();
}
}
void FrmOperateParentMsgBox::mouseReleaseEvent(QMouseEvent *)
{
mousePressed = false;
}