qt 利用 HTML 生成PDF文档,不能显示jpg图片
?
利用 QPrinter 和html 生成 pdf文檔
其中用html語(yǔ)句有顯示圖片的語(yǔ)句
但只能顯示png格式的圖片,不能顯示jpg格式圖片。
經(jīng)過(guò)排查:語(yǔ)法,文件路徑等都正確,最終在stack overflow 中找到 原因:在執(zhí)行程序中沒(méi)有安裝 jpg圖形格式的plugin
https://stackoverflow.com/questions/14878670/qt-does-not-load-jpg-just-png
{
Your executable is missing the jpg plugin. Optional means, that if your executable doesn't find the plugins (dlls) it will start, but without loading these image formats. It is the same with a lot of qt features (fe: slqdrivers)
You will find the folder "imageformats" in C:\Qt\4.8.4\plugins (replace your installation dir and version), copy it to your executable path and it will show jpgs.
Probably, some environmental variables of your colleagues differ a bit from yours.
Take care with Qt plugins and the distribution of your application.
}
?
同樣 在qlistwiget中以圖標(biāo)方式顯示圖片時(shí)也不能顯示jpg格式文件。也用上面的方式解決。
?
轉(zhuǎn)載于:https://www.cnblogs.com/keleman/p/7715849.html
總結(jié)
以上是生活随笔為你收集整理的qt 利用 HTML 生成PDF文档,不能显示jpg图片的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: linux 下进程和线程指定CPU运行
- 下一篇: Java版二叉树遍历,查找,顺序化存储代