Important: Please read the Qt Code of Conduct -

[Solved]Icons of resource don't show up when taking the exe out of QtCreator

  • Hello guys :),

    I'm using some small icons in my program, where they appear in some lists and combo boxes. The resource file is defined as follows:

    <!DOCTYPE RCC><RCC version="1.0">

    and in the qmake file it's defined as follows:

    RC_FILE += rsrcs.qrc

    RESOURCES += rsrcs.qrc

    When I execute the program through QtCreator, the icons show up correctly with no problems. But when I take the executable and execute it through windows explorer, I get this problem, where the icons don't appear.

    Any ideas?

    Thank you for any efforts.

  • Strange behaviour.

    I'll take a guess: the .ico files need an imageReader plugin that's sitting in the default Qt installation dir. When launched from QtCreator, the IDE sets the environment variables to those locations so the applications find the imageReaders and all the other stuff. But when you launch from outside QtCreator the application can't find the plugins and thus fails to load the .ico.
    If this is the case, you have two options: switch from the microsoft .ico to a proper format like .png that is supported natively by Qt. Or copy the appropriate imageReader plugin to a place where the app can find it (I think the plugins must be in a directory "imageformats" in the executable's directory).

  • I got it. It doesn't have to do with ico or other types (but thanks though, using jpg reduced the executable size by 25%).

    The problem was that I was using Qt 4.8.0 Dlls while the program was compiled with Qt 4.8.1.

    My mistake. Sorry.

    I'm keeping this for future reference.

    Thanks for the help :)

Log in to reply