External CSS is ignored for SVGs?
-
Hello,
I use SVGs as icons for my buttons and menus. This works fine, except the external CSS is ignored.
The SVG contains
<style type="text/css"> @import url("colors.css") </style>
and the CSS
path { fill: red; }
It is displayed in the correct color in browsers as well as in image viewers, only in my Qt Widgets App it is black.
What's wrong, is this not supported by Qt?
Thank you...
-
Hi
The SVG in Qt is mostly the static features of SVG 1.2 Tiny specs.
So external CSS might not be supported at all. -
Thanks for answering. So there is no chance in Qt to set the color of svgs with a single point "ressource"?
Tried also
<?xml-stylesheet href="colors.css" type="text/css"?>
and
setStyleSheet("path { fill: red; }");
without success.
It would be much easier to change the color dynamically instead of bundling a separate icon theme for each color.
-
Thanks for answering. So there is no chance in Qt to set the color of svgs with a single point "ressource"?
Tried also
<?xml-stylesheet href="colors.css" type="text/css"?>
and
setStyleSheet("path { fill: red; }");
without success.
It would be much easier to change the color dynamically instead of bundling a separate icon theme for each color.
@LazyT
Hi
Well SVG being XML, it's possible to change it at runtime
but how complex it is, depends on how many places / uses it has.
You could also do it via text operations and replace all "red" with actual RGB color before using it but
I did not find any more smart way of doing as the xml-stylesheet can.