-
Notifications
You must be signed in to change notification settings - Fork 2
/
choose_yaml.cpp
43 lines (38 loc) · 1017 Bytes
/
choose_yaml.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
#include "choose_yaml.h"
#include "ui_choose_yaml.h"
choose_yaml::choose_yaml(QWidget *parent) :
QDialog(parent),
ui(new Ui::choose_yaml)
{
ui->setupUi(this);
connect(ui->yes, SIGNAL(clicked()), this, SLOT(enter()));
connect(ui->no, SIGNAL(clicked()), this, SLOT(cancel()));
connect(ui->browse, SIGNAL(clicked()), this,SLOT(choose_yaml_file()));
}
choose_yaml::~choose_yaml()
{
delete ui;
}
void choose_yaml::enter()
{
if(ui->yaml_src->text().isEmpty())
{
QMessageBox::critical(NULL, "错误", "请将路径填写完毕", QMessageBox::Yes, QMessageBox::Yes);
return;
}
this->close();
emit SendSignal(ui->yaml_src->text());
}
void choose_yaml::cancel()
{
this->close();
}
void choose_yaml::choose_yaml_file()
{
QString srcPath = QFileDialog::getOpenFileName(nullptr, tr("Choose yaml file"), tr("./"), tr("yaml文件(*.yaml);;所有文件(*.*)"));
if(srcPath.isEmpty())
{
return;
}
ui->yaml_src->setText(srcPath);
}