kimageformats-psdplugin-test/mainwindow.cpp
2020-10-27 13:19:09 +08:00

34 lines
758 B
C++

#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QImageReader>
#include <QDebug>
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));
}