#include "mainwindow.h" #include "ui_mainwindow.h" #include #include MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) , ui(new Ui::MainWindow) { ui->setupUi(this); } MainWindow::~MainWindow() { delete ui; } void MainWindow::on_pushButton_clicked() { // 如果输出里有 psd 说明确实加载进去了 qDebug() << QImageReader::supportedImageFormats(); // 后面的文件改成 psd 文件的路径 QScopedPointer< QImageReader> ir(new QImageReader(R"(E:\ff.psd)")); qDebug() << ir->canRead(); QImage read = ir->read(); if (read.isNull()) { qDebug() << "read is null"; } ui->label->setPixmap(QPixmap::fromImage(read)); }