Qt RC_FILE vs automatic resource file conflict



  • 0 down vote favorite

    Trying to add an app icon to Qt application. Simple solution for Qt 5.1 and higher is to use
    @RC_ICONS += app.ico @

    This doesn't work for earlier versions, so one has to include *.rc file with
    @IDI_ICON1 ICON DISCARDABLE "app.ico"@

    However this breaks another Qt functionality concerning resource files, for example adding application version with VERSION variable.

    When just VERSION variable is used, there is _resource.res file generated automatically during build (rcc is involved):

    @rc -DUNICODE -DWIN32 -DAPP_VERSION="0.1.1" -DQT_DLL -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -DNDEBUG -fo release\QUSBAD_resource.res QUSBAD_resource.rc@

    After I add RC_FILE += ico.rc, rcc invoke is the same except rc and res files names, but resulting application doesn't have any version information.

    @rc -DUNICODE -DWIN32 -DAPP_VERSION="0.1.1" -DQT_DLL -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -DNDEBUG -fo release\ico.res ..\QUSBAD\ico.rc@

    Is there a way to incorporate both automatic and custom rc-files?


  • Lifetime Qt Champion

    Hi,

    To workaround that, you can test what the current version of Qt is in your pro file and use one technique or the other.

    However, it might be considered a regression. You should check the "bug report system":http://bugreports.qt-project.org to see if it's something known. If not, please consider opening a new report providing a minimal compilable example showing how to reproduce this behavior.



  • The only workaround I currently happened to get is to first run qmake to create auto-generated *.rc file in build folder, then insert IDI_ICON1 line there and build.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.