Skip to content

Commit e92de82

Browse files
myk1343deepin-bot[bot]
authored andcommitted
fix: 修复右键打印不识别改后缀的图片问题
修复右键打印不识别改后缀的图片问题 Bug: https://pms.uniontech.com/bug-view-315823.html Log: 修复右键打印不识别改后缀的图片问题
1 parent ea9338f commit e92de82

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

libimageviewer/quickprint/printimageloader.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,11 @@ bool PrintImageLoader::loadImageData(PrintImageData::Ptr &imagePtr)
264264
QImageReader reader(imagePtr->filePath);
265265
// jumpToImage 可能返回 false, 但数据正常读取
266266
reader.jumpToImage(imagePtr->frame);
267+
if (!reader.canRead()) {
268+
reader.setAutoDetectImageFormat(true); //控制是否通过内容识别格式
269+
reader.setDecideFormatFromContent(true); // 根据内容识别格式
270+
reader.setFileName(imagePtr->filePath); //必须重新设置一下文件,才能触发内部加载方式的切换
271+
}
267272
if (!reader.canRead()) {
268273
qWarning() << QString("Load multi frame image failed(jump to image): %1").arg(reader.errorString());
269274
imagePtr->state = ContentError;

0 commit comments

Comments
 (0)