You are here

Add new comment

Yes, it is a cleaner solution.
In fact, it would work just as expected (as it does in CSS where the reference path is always the CSS file, and not the application or "index").
That also saves me from having to document it.
It just didn't occur to me that there was already a recognizable pattern for making the changes: url(

This works:

	// Custom style sheet (QSS)...
	if (!options.sCustomStyleSheet.isEmpty()) {
		QFile file(options.sCustomStyleSheet);
		if (file.open(QFile::ReadOnly)) {
			QFileInfo fileInfo(options.sCustomStyleSheet);
			QString qssPath = fileInfo.path();
			QString qssContent = QString::fromUtf8(file.readAll());
			qssContent.replace("url(", "url("+qssPath+"/");
			app.setStyleSheet(qssContent);
			file.close();
		}
	}

Example QSS:
qtractorPluginListView {
background: url(Tecnico_Images/shelves.png);
}