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. [Solved] QIcons are not shown in binary, while shown when compiled from source

[Solved] QIcons are not shown in binary, while shown when compiled from source

Scheduled Pinned Locked Moved General and Desktop
qiconbinaryqpixmapcmake
7 Posts 3 Posters 2.8k Views
  • 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.
  • V Offline
    V Offline
    viruca
    wrote on last edited by viruca
    #1

    I have a big Qt program which is compiled using CMake. I add the resource files by
    qt5_add_resources(IMG_RSC_ADDED Data/Actions.qrc )
    add_executable(${PROJECT_NAME} ${Application_SRCS} ${IMG_RSC_ADDED} )

    In my program, I load these icons to actions, for example:

    m_action = new QAction(":/icon.svg", tr("&Bar"), this);

    And everything works when I compile from source - the icons are where they are supposed to be.

    I created a binary of my program so that to test it on another machine. I put all the necessary dlls to the folder where my exe file is. However, the icons are not displayed in that binary. While I thought that the command qt5_add_resources makes the icons a part of the binary, it does not seem to be the case. Where my problem could be? How to make the icons to be displayed in the binary?

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

      Hi,

      Maybe a silly question but do you have the SVG plugin deployed ?

      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
      • V Offline
        V Offline
        viruca
        wrote on last edited by
        #3

        Hi, thank you for suggestion, but yes, I have all the necessary plugins.

        1 Reply Last reply
        0
        • hskoglundH Offline
          hskoglundH Offline
          hskoglund
          wrote on last edited by
          #4

          Hi, to add to @SGaist's thinking (plugin problem) what happens if you try a Windows .bmp file instead of a .svg file?

          V 1 Reply Last reply
          0
          • hskoglundH hskoglund

            Hi, to add to @SGaist's thinking (plugin problem) what happens if you try a Windows .bmp file instead of a .svg file?

            V Offline
            V Offline
            viruca
            wrote on last edited by
            #5

            @hskoglund , thank you for suggestion.

            I tried few things, and I also tried other file formats like png. It started to work after I added Q_INIT_RESOURCE macro, but only for png format. Does it mean I am missing some plugins to add support for svg?

            Inside my binary folder, I already have imageformats and iconengines. I can see that both contain dlls related to svg format: imageformats has qsvg.dll and iconengines has qsvgicon.dll. Any ideas why svg cannot be displayed in binary? Thanks!

            1 Reply Last reply
            0
            • hskoglundH Offline
              hskoglundH Offline
              hskoglund
              wrote on last edited by
              #6

              Hi, it could be a simple answer: maybe you forgot to copy Qt5Svg.dll to your other machine?

              V 1 Reply Last reply
              1
              • hskoglundH hskoglund

                Hi, it could be a simple answer: maybe you forgot to copy Qt5Svg.dll to your other machine?

                V Offline
                V Offline
                viruca
                wrote on last edited by
                #7

                @hskoglund You were right! Thank you.

                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