1
0
Fork 0

Merge pull request #3161 from shocoman/development-6

Quote image paths in the Dark theme stylesheet
This commit is contained in:
Duncan Ogilvie 2023-08-08 21:45:40 +02:00 committed by GitHub
commit d162dd1adc
Signed by: GitHub
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 4 deletions

View File

@ -655,10 +655,11 @@ void MainWindow::loadSelectedTheme(bool reloadOnlyStyleCss)
{
auto style = QTextStream(&cssFile).readAll();
cssFile.close();
style = style.replace("url(./", QString("url(%1/../themes/%2/").arg(applicationDirPath, selectedTheme));
style = style.replace("url(\"./", QString("url(\"%1/../themes/%2/").arg(applicationDirPath, selectedTheme));
style = style.replace("url('./", QString("url('%1/../themes/%2/").arg(applicationDirPath, selectedTheme));
style = style.replace("$RELPATH", QString("%1/../themes/%2").arg(applicationDirPath, selectedTheme));
style = style.replace("url(./", QString("url(approot:/themes/%1/").arg(selectedTheme));
style = style.replace("url(\"./", QString("url(\"approot:/themes/%1/").arg(selectedTheme));
style = style.replace("url('./", QString("url('approot:/themes/%1/").arg(selectedTheme));
style = style.replace("$RELPATH", QString("approot:/themes/%1").arg(selectedTheme));
qApp->setStyleSheet(style);
}

View File

@ -8,6 +8,7 @@
#include <QTextStream>
#include <QLibraryInfo>
#include <QDebug>
#include <QDir>
#include "MiscUtil.h"
MyApplication::MyApplication(int & argc, char** argv)
@ -181,6 +182,9 @@ int main(int argc, char* argv[])
appPalette.setColor(QPalette::Link, ConfigColor("LinkColor"));
application.setPalette(appPalette);
// Register a path prefix for the program main directory
QDir::addSearchPath("approot", QApplication::applicationDirPath() + "/..");
// Load the selected theme
MainWindow::loadSelectedTheme(true);