From a6871b2c1d98036ca760398dbf5bcd17b4ab2f28 Mon Sep 17 00:00:00 2001 From: jp9000 Date: Fri, 27 Dec 2019 10:53:26 -0800 Subject: [PATCH] UI: Add setThemeID to qt-wrappers Makes the function usable outside of just window-basic-stats.cpp. --- UI/qt-wrappers.cpp | 12 ++++++++++++ UI/qt-wrappers.hpp | 2 ++ UI/window-basic-stats.cpp | 12 ------------ 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/UI/qt-wrappers.cpp b/UI/qt-wrappers.cpp index 5916e89f8..e8a51d37d 100644 --- a/UI/qt-wrappers.cpp +++ b/UI/qt-wrappers.cpp @@ -323,3 +323,15 @@ bool LineEditChanged(QEvent *event) return false; } + +void setThemeID(QWidget *widget, const QString &themeID) +{ + if (widget->property("themeID").toString() != themeID) { + widget->setProperty("themeID", themeID); + + /* force style sheet recalculation */ + QString qss = widget->styleSheet(); + widget->setStyleSheet("/* */"); + widget->setStyleSheet(qss); + } +} diff --git a/UI/qt-wrappers.hpp b/UI/qt-wrappers.hpp index b0e20a097..69996deb2 100644 --- a/UI/qt-wrappers.hpp +++ b/UI/qt-wrappers.hpp @@ -105,3 +105,5 @@ static inline Qt::ConnectionType WaitConnection() bool LineEditCanceled(QEvent *event); bool LineEditChanged(QEvent *event); + +void setThemeID(QWidget *widget, const QString &themeID); diff --git a/UI/window-basic-stats.cpp b/UI/window-basic-stats.cpp index 76da53a68..6b891d26d 100644 --- a/UI/window-basic-stats.cpp +++ b/UI/window-basic-stats.cpp @@ -18,18 +18,6 @@ #define TIMER_INTERVAL 2000 #define REC_TIME_LEFT_INTERVAL 30000 -static void setThemeID(QWidget *widget, const QString &themeID) -{ - if (widget->property("themeID").toString() != themeID) { - widget->setProperty("themeID", themeID); - - /* force style sheet recalculation */ - QString qss = widget->styleSheet(); - widget->setStyleSheet("/* */"); - widget->setStyleSheet(qss); - } -} - void OBSBasicStats::OBSFrontendEvent(enum obs_frontend_event event, void *ptr) { OBSBasicStats *stats = reinterpret_cast(ptr);