Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

QML error says that svg is unsupported

Tags:

qt

qml

qtsvg

I've used plugins before, but after I recompiled my qt libraries, I haven't been able to successfully use .svg image files any longer. There error I get is as follows:

file:///C:/Users/RBhatia/Documents/SettingsMenu/SettingsMenu/SlicingComp.qml:41:5: QML Image: Error decoding:
file:///C:/Users/RBhatia/Documents/SettingsMenu/SettingsMenu/img/sliceStep_slice1.svg: Unsupported image format

I have checked all my .dll files to make sure they are in 64 bit format. I also checked my environment variables, and even tried to use different librariesm but I simply cannot figure out what changed to cause this issue.

like image 334
rahul.bhatia.k Avatar asked Sep 20 '25 09:09

rahul.bhatia.k


2 Answers

The problem is not missing header files. It's due to missing dependencies to Qt libraries as mentioned in that comment here: Comment by JamesL

To use SVG images you need to specify QtSvg, QtXml, QtGui, and QtCore to be deployed with your project.

like image 151
Robert Wloch Avatar answered Sep 22 '25 04:09

Robert Wloch


The most probable reason I can think of is that you were missing some svg header files when you compiled your qt. If you do not add -svg to your configure, svg is treated as optional. Means if everything is there to build the svg plugin, it is build, else this feature is silently dropped.

You said, you checked your .dll files. Did you also check the plugins folder? Something like $QTDIR/plugins/imageformats. Must contains a qsvg4.dll. Or qsvg5.dll for Qt5.

like image 33
Greenflow Avatar answered Sep 22 '25 05:09

Greenflow