SVG icons do not show up on the deployed app
-
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.
-
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. -
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.@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.
-
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? -
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?@hhoushiar Please read what @VRonin asked above
-
@hhoushiar Please read what @VRonin asked above
@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. -
@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.@hhoushiar can you execute "ldd libqsvg.dylib" on the target machine?
-
@hhoushiar can you execute "ldd libqsvg.dylib" on the target machine?
@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.
-
@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.@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?
-
@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?
@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. -
There is a separate plugin for SVG icons, on windows it's iconengines/qsvgicons.dll did you deploy that one?
-
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? -
Hi and welcome to devnet,
What parameters are you giving to
macdeployqt
?
Can you also share your .pro file ? -
Hi and welcome to devnet,
What parameters are you giving to
macdeployqt
?
Can you also share your .pro file ?@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. -
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 ofmacdeployqt
.