Qt Stylesheet image: Can i add SVG code in "image:" instead of specifying url?
-
Can i add SVG code in "image:" instead of specifying url?
For instance, can i add SVG code for up and down arrows in the stylesheet for QScrollbar rather than specifying an url to the image?
@vdevadass
IIRC this should work via Qt stylesheets. At least the Qt filesystem is capable of loading such urls, so my guess it also should work within QSS.image: url("data:image/png;base64,<base64ImageData>") // replace '<base64ImageData>'
-
Hi
Why cant you just use SVG images ?
Like ":/somefile.svg"
(it located in qresource) -
i want to eliminate dependency on external resource, hence asking, if we cannot add in the stylesheet i would go for the .svg file.
@vdevadass
Ok but it wont be external if you use resource as its compiled into the .exe (app)
Anyway, i doubt it will allow the actual SVG code directly. Did not tried it base64 encoded though :) -
@vdevadass
Note on SVG.
Im using SVG for all icons. I discovered that the page "box" ( at least if editing with InkScape)
would define the maximum size the icon would become. ( when used with QIcon)
So if some of the icons looks fussy, it might be the reason. Simply scale SVG up and resave.