-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpicturedialog.cpp
More file actions
49 lines (42 loc) · 1.13 KB
/
picturedialog.cpp
File metadata and controls
49 lines (42 loc) · 1.13 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
#include "picturedialog.h"
#include "ui_picturedialog.h"
#include <QMessageBox>
#include <QDebug>
#include <QFile>
#include <QFileDialog>
pictureDialog::pictureDialog(const QPixmap &pixmap) :
ui(new Ui::pictureDialog)
{
ui->setupUi(this);
this->setWindowTitle("save picture");
ui->picturelabel->setPixmap(pixmap);
}
pictureDialog::~pictureDialog()
{
delete ui;
}
void pictureDialog::on_savePictureBtn_clicked()
{
QString fn = QFileDialog::getSaveFileName(
this,
tr("保存图片"),
".",
("jpeg file(*.jpg);;png file(*.png);;bmp file(*.bmp)"));
if(fn.isEmpty()){
return ;
}
const QPixmap *pixmap = ui->picturelabel->pixmap();
if(pixmap){
if(pixmap->save(fn)){
QMessageBox::information(this,
tr("Tip"),
tr("Save Pictrue Success"));
}
else{
QMessageBox::warning(this,
tr("Error"),
tr("Save Pictrue Fail"));
}
}
// imwrite(fn,);
}