Embedded JPG resources not loading in Qt application

后端 未结 2 1575
礼貌的吻别
礼貌的吻别 2020-12-06 02:47

I have a Qt application that has some embedded JPG files that I want to display. When I compile and run both the debug and release versions on my machine, everything works

相关标签:
2条回答
  • 2020-12-06 03:05

    While the most accurate answer is given already, rather than having to deploy more dlls and a folder structure, I find it much easier to just convert the images to png...no image format dlls etc. required if you use pngs.

    0 讨论(0)
  • 2020-12-06 03:14

    It needs jpeg plugin to load images. If you have Qt installed they would be in %QTDIR%\plugins\imageformats.

    Copy qjpeg4.dll into plugin folder on your thumb drive.

    root/app.exe
    root/qt.conf
    root/plugins/imageformats/qjpeg4.dll
    

    In qt.conf file set path to your plugins dir:

    [Paths]
    plugins=./plugins
    
    0 讨论(0)
提交回复
热议问题