Issue when loading an ico from a Qt resource file

后端 未结 5 2302
星月不相逢
星月不相逢 2020-12-21 05:31

I am using Qt Designer 4.8.4 and I include two files in the QMainWindow resource file: a .ico file and a .gif file. When loading from code using:

QPixmap p;
         


        
5条回答
  •  余生分开走
    2020-12-21 05:46

    The accepted answer here is incorrect, or as mentioned in the comments, at least misleading. Qt has come with a plugin for handling ICO format since sometime in version 4.4. Here's a similar question from the same era.

    For deployment, one needs to copy the plugins/imageformats/[lib]qico.[dll|so] file from the Qt installation used for building with to within their executable's directory. Put it in a subfolder, like so: /imageformats/qico.dll. If testing a debug build, the d suffix version of the lib is needed instead (qicod.dll).

    (This newer question has been marked as a duplicate of this, so now 2 questions point to the wrong answer. Which is why I'm essentially repeating my post here.)

提交回复
热议问题