#include "newcheckmethod.h" #include "ui_newcheckmethod.h" #include "checkdevice.h" #include "qfiledialog.h" #include "formcheckpoint.h" NewCheckMethod::NewCheckMethod(QWidget *parent) : QWidget(parent), ui(new Ui::NewCheckMethod) { ui->setupUi(this); } NewCheckMethod::~NewCheckMethod() { delete ui; } void NewCheckMethod::showCheckDevice() { CheckDevice *checkWindow = new CheckDevice; checkWindow->setWindowState(Qt::WindowMaximized); checkWindow->setWindowModality(Qt::ApplicationModal); checkWindow->show(); } void NewCheckMethod::choosePicture() { QString sName = QFileDialog::getOpenFileName(this,"选择图片","","Image File(*.bmp *.jpg *.jpeg *.png)"); //第一个参数:标准文件对话框的父窗口;第二个参数:标准文件对话框的标题;第三个参数:指定默认的目录;第四个参数:文件过滤器 QImage img(sName); //int WindowW = this->width(); //int WindowH = this->height(); //ui->label->setGeometry(0, 0, WindowW, WindowH); QImage scalimg = img.scaled(ui->label_11->size(), Qt::KeepAspectRatio, Qt::SmoothTransformation); ui->label_11->setPixmap(QPixmap::fromImage(scalimg)); //ui->label_11->setPixmap(QPixmap(sName)); } void NewCheckMethod::deletePicture() { ui->label_11->clear(); } void NewCheckMethod::showCheckPoint() { FormCheckPoint *checkWindow = new FormCheckPoint; //checkWindow.setWindowState(Qt::WindowMaximized); checkWindow->setWindowModality(Qt::ApplicationModal); checkWindow->show(); }