現象:BMP/PNG 正常,JPG/TIFF 載入失敗。原因:Qt 將圖片格式支持做為**動態插件**(qjpeg.dll、qtiff.dll 等)單獨打包,部署時必須將 imageformats 目錄隨程序一同發布。
D:\Qt\Qt5.5.1\5.5\msvc2013\plugins\imageformats\imageformats 文件夾複製到**可執行文件同級目錄**
myapp/
├── myapp.exe
├── Qt5Core.dll
├── ...
└── imageformats/
├── qjpeg.dll
├── qtiff.dll
└── ...
qDebug() << QImageReader::supportedImageFormats();
// 應包含 "jpg", "jpeg", "tiff", "tif" 等
官方部署工具 windeployqt.exe 可自動收集所有依賴插件,強烈推薦使用。