Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Change base dir for stylesheet urls
Is it possible to change the base directory for the paths in the stylesheets?
Maybe I am looking at it the wrong way. The Problem is that (on Linux) we use the ./config folder for our appimage's additional files. It seems like the stylesheets can't find the relative paths set in there (for example a background.png or some font).
IIRC the current dir is used for loading. So if possible you could call
QDir::setCurrent()before applying the stylesheet.
thanks that seems to work
I just noticed that this might not be what I was looking for after all.
Doesn't QDir::setCurrent set the working directory for the entire process?
I don't really want that... I only want it for the stylesheet.
And if I reset the working dir after setStylesheet it won't work anymore if I open a new Dialog afterwards for example.
In that case what you can do is to have a stylesheet which contains a placeholder for the path "prefix". Use QString::arg to replace that placeholder with required value when applying the stylesheet.
JonB last edited by