-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpicturereader.cpp
More file actions
100 lines (59 loc) · 2.51 KB
/
picturereader.cpp
File metadata and controls
100 lines (59 loc) · 2.51 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#include "picturereader.h"
#include "personinterface.h"
#include <QDebug>
PictureReader::PictureReader(QImage pic) {
this->setWindowTitle(tr("Picture Reader"));
this->resize(400, 300);
labelPicture = new QLabel(this);
labelPicture->setObjectName(QStringLiteral("labelPicture"));
labelPicture->setGeometry(QRect(30, 20, 341, 201));
labelPicture->setFrameShape(QFrame::Box);
pushButtonOk = new QPushButton(this);
pushButtonOk->setObjectName(QStringLiteral("pushButtonOk"));
pushButtonOk->setGeometry(QRect(90, 250, 93, 28));
pushButtonOk->setText(tr("Ok"));
pushButtonCancel = new QPushButton(this);
pushButtonCancel->setObjectName(QStringLiteral("pushButtonCancel"));
pushButtonCancel->setGeometry(QRect(200, 250, 93, 28));
pushButtonCancel->setText(tr("Cancel"));
picRead= new QImage();
picRead = new QImage(pic.scaled( labelPicture->width(),labelPicture->height(),Qt::KeepAspectRatio,Qt::SmoothTransformation));
labelPicture->setPixmap(QPixmap::fromImage(*picRead));
labelPicture->move((this->width()-picRead->width())/2,40);
labelPicture->setFrameStyle(0);
connect(pushButtonOk,SIGNAL(clicked()),this, SLOT(sendPicture()));
}
PictureReader::~PictureReader()
{
delete this;
}
void PictureReader::sendPicture(){
picture = picRead;
labelPicture->setPixmap(QPixmap::fromImage(*picture));
labelPicture->resize( (labelPicture->pixmap()->scaled(picture->width(),picture->height(),Qt::KeepAspectRatio,Qt::SmoothTransformation)).size());
labelPicture->move((this->width()-picture->width())/2,40);
labelPicture->setFrameStyle(0);
qDebug()<<"bug send picture";
emit pics(*picture);
this->close();
}
// connect(pushButton, SIGNAL(doubleClicked ( const QModelIndex & )),
// this, SLOT(askModify(const QModelIndex & )));
//PictureReader::PictureReader(QImage pic,QWidget *parent) :
// QDialog(parent),
// ui(new Ui::PictureReader)
//{
// ui->setupUi(this);
//}
//PictureReader::PictureReader(QImage pic, QWidget *parent): QDialog(parent),ui(new Ui::PictureReader)
//{
// ui->setupUi(this);
// picRead= new QImage();
// picRead = new QImage(pic.scaled( ui->labelPicture->width(),ui->labelPicture->height(),Qt::KeepAspectRatio,Qt::SmoothTransformation));
// ui->labelPicture->setPixmap(QPixmap::fromImage(*picRead));
// connect(ui->pushButtonOk,SIGNAL(clicked()),this, SLOT(sendPicture()));
//}
//void PictureReader::changeEvent(QEvent* event)
//{
// emit FormChanged(event);
//}