|
|
|
@ -78,7 +78,7 @@ QStringList Style::getThemeColorNames()
@@ -78,7 +78,7 @@ QStringList Style::getThemeColorNames()
|
|
|
|
|
|
|
|
|
|
QList<QColor> Style::themeColorColors = {QColor(), QColor("#004aa4"), QColor("#97ba00"), QColor("#c23716"), QColor("#4617b5")}; |
|
|
|
|
|
|
|
|
|
QString Style::getStylesheet(const QString &filename) |
|
|
|
|
QString Style::getStylesheet(const QString &filename, const QFont& baseFont) |
|
|
|
|
{ |
|
|
|
|
QFile file(filename); |
|
|
|
|
if (!file.open(QFile::ReadOnly | QFile::Text)) |
|
|
|
@ -87,7 +87,7 @@ QString Style::getStylesheet(const QString &filename)
@@ -87,7 +87,7 @@ QString Style::getStylesheet(const QString &filename)
|
|
|
|
|
return QString(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return resolve(file.readAll()); |
|
|
|
|
return resolve(file.readAll(), baseFont); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
QColor Style::getColor(Style::ColorPalette entry) |
|
|
|
@ -115,7 +115,7 @@ QFont Style::getFont(Style::Font font)
@@ -115,7 +115,7 @@ QFont Style::getFont(Style::Font font)
|
|
|
|
|
return fonts[font]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
QString Style::resolve(QString qss) |
|
|
|
|
QString Style::resolve(QString qss, const QFont& baseFont) |
|
|
|
|
{ |
|
|
|
|
if (dict.isEmpty()) |
|
|
|
|
{ |
|
|
|
@ -137,13 +137,15 @@ QString Style::resolve(QString qss)
@@ -137,13 +137,15 @@ QString Style::resolve(QString qss)
|
|
|
|
|
{"@themeLight", Style::getColor(Style::ThemeLight).name()}, |
|
|
|
|
|
|
|
|
|
// fonts
|
|
|
|
|
{"@baseFont", QString::fromUtf8("'%1' %2px") |
|
|
|
|
.arg(baseFont.family()).arg(QFontInfo(baseFont).pixelSize())}, |
|
|
|
|
{"@extraBig", qssifyFont(Style::getFont(Style::ExtraBig))}, |
|
|
|
|
{"@big", qssifyFont(Style::getFont(Style::Big))}, |
|
|
|
|
{"@bigBold", qssifyFont(Style::getFont(Style::BigBold))}, |
|
|
|
|
{"@medium", qssifyFont(Style::getFont(Style::Medium))}, |
|
|
|
|
{"@mediumBold", qssifyFont(Style::getFont(Style::MediumBold))}, |
|
|
|
|
{"@small", qssifyFont(Style::getFont(Style::Small))}, |
|
|
|
|
{"@smallLight", qssifyFont(Style::getFont(Style::SmallLight))}, |
|
|
|
|
{"@smallLight", qssifyFont(Style::getFont(Style::SmallLight))} |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|