Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt RC_FILE vs automatic resource file conflict
Forum Updated to NodeBB v4.3 + New Features

Qt RC_FILE vs automatic resource file conflict

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    netnazgul
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • N Offline
        N Offline
        netnazgul
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved