-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetexcludeditems_view.cpp
62 lines (53 loc) · 2.38 KB
/
setexcludeditems_view.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#include "setexcludeditems_view.h"
#include <QVBoxLayout>
#include <QHBoxLayout>
#include "ElaText.h"
#include "ElaContentDialog.h"
#include <QTextEdit>
#include "ElaPushButton.h"
setExcludedItems_view::setExcludedItems_view(QWidget *parent,UserManager *um)
: ElaWidget(parent,700,400)
{
this->setWindowTitle("珞珈云"); // 设置窗口标题
this->setWindowModality(Qt::ApplicationModal); // 设置窗口模态
this->hide(); // 初始隐藏当前窗口
this->setWindowButtonFlag(ElaAppBarType::StayTopButtonHint,false);
this->setWindowButtonFlag(ElaAppBarType::MinimizeButtonHint,false);
this->setWindowButtonFlag(ElaAppBarType::MaximizeButtonHint,false);
QWidget*centerarea=new QWidget(); // 创建一个新的QWidget对象作为主区域
QVBoxLayout* centerVLayout = new QVBoxLayout(centerarea); // 为中心部件设置垂直布局
centerVLayout->setContentsMargins(60, 15, 60, 30); // 设置布局边距
ElaText* Title = new ElaText("设置排除项目", this);
Title->setTextSize(25); // 设置文字大小
textEdit->setPlaceholderText("输入示例。。。。。。"); // 设置输入提示文本
QWidget* buttonArea = new QWidget();
buttonArea->setWindowFlags(Qt::FramelessWindowHint); // 去除窗口边框
buttonArea->setAttribute(Qt::WA_TranslucentBackground); // 设置背景透明
QHBoxLayout* buttonLayout = new QHBoxLayout(buttonArea);// 创建一个水平布局
buttonLayout->setContentsMargins(0, 0, 0, 0); // 设置布局的边距
_pushButton2 = new ElaPushButton("取消", this);
_pushButton2->setFixedSize(120, 40);
_pushButton3 = new ElaPushButton("确认", this);
_pushButton3->setFixedSize(120, 40);
buttonLayout->addWidget(_pushButton2);
buttonLayout->addWidget(_pushButton3);
connect(_pushButton2,&ElaPushButton::clicked,[=](){
this->hide();
});
connect(_pushButton3,&ElaPushButton::clicked,[=](){
um->setExcludedItems(textEdit->toPlainText());
//emit settingExcludedItems(textEdit->toPlainText());
this->hide();
});
centerVLayout->addWidget(Title);
centerVLayout->addWidget(textEdit);
centerVLayout->addWidget(buttonArea);
this->setCentralWidget(centerarea);// 将中心部件添加到窗口
}
setExcludedItems_view::~setExcludedItems_view()
{
}
void setExcludedItems_view::updateExcludedItems(QString items)
{
textEdit->setText(items);
}