Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. SVG icons do not show up on the deployed app
QtWS25 Last Chance

SVG icons do not show up on the deployed app

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
22 Posts 6 Posters 11.7k 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.
  • H Offline
    H Offline
    hhoushiar
    wrote on last edited by hhoushiar
    #3

    I am using QRC. And yes I am talking about the icons in the Gui.

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #4

      Hm it has to work then... unless there is some problem loading SVG module - try saving logs to some file and inspect it.

      Or you open QRC via relative path and that fails.

      (Z(:^

      1 Reply Last reply
      1
      • VRoninV Offline
        VRoninV Offline
        VRonin
        wrote on last edited by VRonin
        #5

        did you deploy the imageformats plugin qsvg.dll?

        "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
        ~Napoleon Bonaparte

        On a crusade to banish setIndexWidget() from the holy land of Qt

        1 Reply Last reply
        1
        • H Offline
          H Offline
          hhoushiar
          wrote on last edited by
          #6

          If the path was wrong then how come the icons are there when I open the app from command line as I mentioned in my initial post but that also only works if I call it directly from my Contents directory.
          I also deployed the imageformats plugin but with libqsvg.dylib not qsvg.dll since I am deploying on the MacOS.

          sierdzioS 1 Reply Last reply
          0
          • H Offline
            H Offline
            hhoushiar
            wrote on last edited by
            #7

            I also tried DYLD_PRINT_LIBRARIES=1 and QT_DEBUG_PLUGINS=1 to see the libs and plugins that are getting used. But the SVG plugin gets called only when I run the app from terminal in the Contents directory.

            1 Reply Last reply
            0
            • H hhoushiar

              If the path was wrong then how come the icons are there when I open the app from command line as I mentioned in my initial post but that also only works if I call it directly from my Contents directory.
              I also deployed the imageformats plugin but with libqsvg.dylib not qsvg.dll since I am deploying on the MacOS.

              sierdzioS Offline
              sierdzioS Offline
              sierdzio
              Moderators
              wrote on last edited by
              #8

              @hhoushiar said in SVG icons do not show up on the deployed app:

              If the path was wrong then how come the icons are there when I open the app from command line as I mentioned in my initial post but that also only works if I call it directly from my Contents directory.

              Current dir is different when you run from Contents that when you run the app from Finder. This can be mitigated by using QCoreApplication::applicationDirPath() to "anchor" your relative paths.

              As said though, if you use QRC the standard way (compiled into app binary), paths cannot be a problem.

              (Z(:^

              1 Reply Last reply
              0
              • H Offline
                H Offline
                hhoushiar
                wrote on last edited by
                #9

                One more thing when it fails to show the icons I get errors like:
                QML Image: Error decoding: something.svg Unsupported image format
                So I think the problem is that it cannot find the plugin.
                But I don't know that else I have to add since the plugin is in the correct directory.
                Should I modify something?

                jsulmJ 1 Reply Last reply
                0
                • H hhoushiar

                  One more thing when it fails to show the icons I get errors like:
                  QML Image: Error decoding: something.svg Unsupported image format
                  So I think the problem is that it cannot find the plugin.
                  But I don't know that else I have to add since the plugin is in the correct directory.
                  Should I modify something?

                  jsulmJ Offline
                  jsulmJ Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on last edited by
                  #10

                  @hhoushiar Please read what @VRonin asked above

                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                  H 1 Reply Last reply
                  0
                  • jsulmJ jsulm

                    @hhoushiar Please read what @VRonin asked above

                    H Offline
                    H Offline
                    hhoushiar
                    wrote on last edited by
                    #11

                    @jsulm Thanks for your reply but I have already deployed the libqsvg.dylib in PlugIns/imageformats.
                    I am also using sql plugins and they are running without a problem. The problem is only with the SVG.
                    I have tried almost all the solutions that I could find online but unfortunately nothing has worked for me.

                    jsulmJ JKSHJ 2 Replies Last reply
                    0
                    • H hhoushiar

                      @jsulm Thanks for your reply but I have already deployed the libqsvg.dylib in PlugIns/imageformats.
                      I am also using sql plugins and they are running without a problem. The problem is only with the SVG.
                      I have tried almost all the solutions that I could find online but unfortunately nothing has worked for me.

                      jsulmJ Offline
                      jsulmJ Offline
                      jsulm
                      Lifetime Qt Champion
                      wrote on last edited by
                      #12

                      @hhoushiar can you execute "ldd libqsvg.dylib" on the target machine?

                      https://forum.qt.io/topic/113070/qt-code-of-conduct

                      H 1 Reply Last reply
                      0
                      • jsulmJ jsulm

                        @hhoushiar can you execute "ldd libqsvg.dylib" on the target machine?

                        H Offline
                        H Offline
                        hhoushiar
                        wrote on last edited by
                        #13

                        @jsulm So the equivalent to "ldd" on MacOS is "otool -L" if I am not wrong.
                        and I execute this for libqsvg.dylib in my plugins and here is the output:

                        libqsvg.dylib:
                        	libqsvg.dylib (compatibility version 0.0.0, current version 0.0.0)
                        	@rpath/QtSvg.framework/Versions/5/QtSvg (compatibility version 5.7.0, current version 5.7.1)
                        	@rpath/QtWidgets.framework/Versions/5/QtWidgets (compatibility version 5.7.0, current version 5.7.1)
                        	@rpath/QtGui.framework/Versions/5/QtGui (compatibility version 5.7.0, current version 5.7.1)
                        	@rpath/QtCore.framework/Versions/5/QtCore (compatibility version 5.7.0, current version 5.7.1)
                        	/System/Library/Frameworks/DiskArbitration.framework/Versions/A/DiskArbitration (compatibility version 1.0.0, current version 1.0.0)
                        	/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
                        	/System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)
                        	/System/Library/Frameworks/AGL.framework/Versions/A/AGL (compatibility version 1.0.0, current version 1.0.0)
                        	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.1.0)
                        	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1226.10.1)
                        

                        I also have the QtSvg, QtWidgets, QtGui and QtCore frameworks in Frameworks directory of my app bundle.

                        1 Reply Last reply
                        0
                        • H hhoushiar

                          @jsulm Thanks for your reply but I have already deployed the libqsvg.dylib in PlugIns/imageformats.
                          I am also using sql plugins and they are running without a problem. The problem is only with the SVG.
                          I have tried almost all the solutions that I could find online but unfortunately nothing has worked for me.

                          JKSHJ Offline
                          JKSHJ Offline
                          JKSH
                          Moderators
                          wrote on last edited by
                          #14

                          @hhoushiar said in SVG icons do not show up on the deployed app:

                          I have already deployed the libqsvg.dylib in PlugIns/imageformats

                          I don't know how things are done on macOS, but for Windows and Linux the path is <app>/imageformats/, not <app>/PlugIns/imageformats

                          Does the new location help?

                          Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                          H 1 Reply Last reply
                          1
                          • JKSHJ JKSH

                            @hhoushiar said in SVG icons do not show up on the deployed app:

                            I have already deployed the libqsvg.dylib in PlugIns/imageformats

                            I don't know how things are done on macOS, but for Windows and Linux the path is <app>/imageformats/, not <app>/PlugIns/imageformats

                            Does the new location help?

                            H Offline
                            H Offline
                            hhoushiar
                            wrote on last edited by hhoushiar
                            #15

                            @JKSH said in SVG icons do not show up on the deployed app:

                            I don't know how things are done on macOS, but for Windows and Linux the path is <app>/imageformats/, not <app>/PlugIns/imageformats

                            Thanks for the reply but unfortunately that does not help. Under MacOS the app bundle structure should contain Frameworks to put all the libs, Plugins to put all the plugins and Resources to put the qml stuff.
                            I followed this based on the Qt documentation "Qt for macOS - Deployment". I am using QtSql.frmawork and sqldrivers plugins the same way and they work just fine. The problem is only with imageformats and SVG.

                            1 Reply Last reply
                            0
                            • H Offline
                              H Offline
                              hhoushiar
                              wrote on last edited by
                              #16

                              Does anyone have any other idea?
                              I really need to be able to deploy the app soon.
                              I really appreciate any help.

                              1 Reply Last reply
                              0
                              • VRoninV Offline
                                VRoninV Offline
                                VRonin
                                wrote on last edited by
                                #17

                                There is a separate plugin for SVG icons, on windows it's iconengines/qsvgicons.dll did you deploy that one?

                                "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
                                ~Napoleon Bonaparte

                                On a crusade to banish setIndexWidget() from the holy land of Qt

                                H 1 Reply Last reply
                                0
                                • VRoninV VRonin

                                  There is a separate plugin for SVG icons, on windows it's iconengines/qsvgicons.dll did you deploy that one?

                                  H Offline
                                  H Offline
                                  hhoushiar
                                  wrote on last edited by
                                  #18

                                  @VRonin Thanks for your reply.
                                  Yeah I have that as well.
                                  Actually a few days ago I deployed the app under windows and I thought the MacOS should be easier and that was a big mistake.

                                  1 Reply Last reply
                                  0
                                  • H Offline
                                    H Offline
                                    hhoushiar
                                    wrote on last edited by
                                    #19

                                    Still not working.
                                    I don't know what is the difference between the SVG plugin and for example the platform or sql plugins.
                                    I tried to change the qt.conf file that did not help.
                                    Funny thing is if I don't copy the Qt stuff in the app bundle and let it use the frameworks and plugins directly from Qt installed directory it works but when I copy them into my app bundle it does not work.
                                    Is there a way to see what plugins the application tries to open and where it is looking for them?
                                    The QT_DEBUG_PLUGINS only outputs the plugins that it opens but it does not show the failed attempts.
                                    Or am I missing something here?

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

                                      Hi and welcome to devnet,

                                      What parameters are you giving to macdeployqt ?
                                      Can you also share your .pro file ?

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

                                      H 1 Reply Last reply
                                      1
                                      • SGaistS SGaist

                                        Hi and welcome to devnet,

                                        What parameters are you giving to macdeployqt ?
                                        Can you also share your .pro file ?

                                        H Offline
                                        H Offline
                                        hhoushiar
                                        wrote on last edited by
                                        #21

                                        @SGaist Thanks for the help.
                                        So I was using it like this: macdeployqt directory/to/bundle -verbose=3 -qmldir=directory/to/myapp/qml
                                        How should I share the .pro file? should I just copy the necessary parts here or do you need all of it?
                                        Since I have multiple libs that they get compiled with the app and also the build process is for Mac, Windows and Linux.
                                        I also have to say that I updated the Qt from 5.7.1 to 5.8 and now it works.
                                        But I would like to know what was the problem with 5.7.1 and if there is a bug in the Qt code.
                                        Thanks again for your help.

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

                                          Might be a glitch in the 5.7.1 version of macdeployqt. If you want to check then you should take a look at the change logs or compare the sources of macdeployqt.

                                          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

                                          • Login

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