mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-09-24 23:31:36 +08:00
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.
This commit is contained in:
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user