#include "theme-loader.h"
#include <QDir>
#include <QApplication>


ThemeLoader::ThemeLoader(QString path)
	: m_path(path)
{}

QStringList ThemeLoader::getAllThemes() const
{
	return QDir(m_path).entryList(QDir::Dirs | QDir::NoDotAndDotDot);
}


bool ThemeLoader::setTheme(QString name)
{
	QString dir = QString(m_path).replace('\\', '/') + name + "/";

	QFile f(dir + "style.css");
	if (!f.open(QFile::ReadOnly | QFile::Text))
		return false;

	QString css = f.readAll();
	f.close();

	// Replace urls relative paths by absolute ones
	css.replace("url(", "url(" + dir);

	qApp->setStyleSheet(css);
	return true;
}

#include "theme-loader.h"
#include <QDir>
#include <QApplication>


ThemeLoader::ThemeLoader(QString path)
	: m_path(path)
{}

QStringList ThemeLoader::getAllThemes() const
{
	return QDir(m_path).entryList(QDir::Dirs | QDir::NoDotAndDotDot);
}


bool ThemeLoader::setTheme(QString name)
{
	QFile f(m_path + "/" + name + "/style.css");
	if (!f.open(QFile::ReadOnly | QFile::Text))
		return false;

	QString css = f.readAll();
	f.close();
	qApp->setStyleSheet(css);
	return true;
}

--- 
+++ 
@@ -15,12 +15,18 @@
 
 bool ThemeLoader::setTheme(QString name)
 {
-	QFile f(m_path + "/" + name + "/style.css");
+	QString dir = QString(m_path).replace('\\', '/') + name + "/";
+
+	QFile f(dir + "style.css");
 	if (!f.open(QFile::ReadOnly | QFile::Text))
 		return false;
 
 	QString css = f.readAll();
 	f.close();
+
+	// Replace urls relative paths by absolute ones
+	css.replace("url(", "url(" + dir);
+
 	qApp->setStyleSheet(css);
 	return true;
 }
Allow to use relative path images in themes
