-
Notifications
You must be signed in to change notification settings - Fork 0
/
savepic.cpp
36 lines (32 loc) · 1.02 KB
/
savepic.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 <QMessageBox>
#include <QTextCodec>
#include "savepic.h"
#include "ui_savepic.h"
savepic::savepic(QWidget *parent) :
QLabel(parent),
ui(new Ui::savepic)
{
ui->setupUi(this);
bg=new QMovie(":/images/images/setlevel.jpg");//设置背景图片
this->setMovie(bg);
this->setScaledContents(true);
bg->start();
QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));
connect(ui->save,&QPushButton::clicked,[=](){//点击按钮保存图片
QString filename=ui->picname->text();
if (filename.isEmpty()){
QMessageBox::warning(this,
QString::fromLocal8Bit("提示"),
QString::fromLocal8Bit("文件名不能为空!"));
}
else emit savePicture(filename);//将文件名告知父亲窗口
});
connect(ui->cancel,&QPushButton::clicked,[=](){
emit donothing();
});//取消保存
}
savepic::~savepic()
{
delete bg;
delete ui;
}