From 0fea987ed4571a6b507240c57babf6b97e72c5a1 Mon Sep 17 00:00:00 2001 From: HomeWorld Date: Sat, 17 Jan 2015 19:24:00 +0200 Subject: [PATCH] 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. --- obs/window-basic-main.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/obs/window-basic-main.cpp b/obs/window-basic-main.cpp index dfaafa545..b40fb09c3 100644 --- a/obs/window-basic-main.cpp +++ b/obs/window-basic-main.cpp @@ -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");