UI: Apply a style sheet using path

This allows the usage of other resources in the style sheet, like
icons/etc, relative to the style sheet location.  For example, to change
the main window app icon, add #OBSBasic { qproperty-windowIcon:
url("basic/newicon.png") } in the style sheet, where "basic/newicon.png"
is a path relative to the qss file location.
master
HomeWorld 2015-01-17 19:24:00 +02:00 committed by jp9000
parent 4093ce4d84
commit 0fea987ed4
1 changed files with 5 additions and 3 deletions

View File

@ -85,9 +85,11 @@ OBSBasic::OBSBasic(QWidget *parent)
int ret = os_get_config_path(styleSheetPath, sizeof(styleSheetPath),
"obs-studio/basic/stylesheet.qss");
if (ret > 0) {
QFile styleSheet(QT_UTF8(styleSheetPath));
if (styleSheet.open(QFile::ReadOnly))
setStyleSheet(styleSheet.readAll());
if (QFile::exists(styleSheetPath)) {
QString path = QString("file:///") +
QT_UTF8(styleSheetPath);
App()->setStyleSheet(path);
}
}
qRegisterMetaType<OBSScene> ("OBSScene");