UI: Reset volume/media sliders on theme change

Since volume/media sliders are using QProxyStyle, they are not
updated when themes are changed, so re-initialize them.
This commit is contained in:
cg2121
2022-08-20 16:29:16 -07:00
committed by Jim
parent 23f910c149
commit 0afcb71122
2 changed files with 20 additions and 0 deletions
+19
View File
@@ -474,6 +474,9 @@ OBSBasic::OBSBasic(QWidget *parent)
connect(ui->broadcastButton, &QPushButton::clicked, this,
&OBSBasic::BroadcastButtonClicked);
connect(App(), &OBSApp::StyleChanged, this,
&OBSBasic::ResetProxyStyleSliders);
UpdatePreviewSafeAreas();
UpdatePreviewSpacingHelpers();
}
@@ -10233,3 +10236,19 @@ float OBSBasic::GetDevicePixelRatio()
{
return dpi;
}
void OBSBasic::ResetProxyStyleSliders()
{
/* Since volume/media sliders are using QProxyStyle, they are not
* updated when themes are changed, so re-initialize them. */
vector<OBSSource> sources;
for (size_t i = 0; i != volumes.size(); i++)
sources.emplace_back(volumes[i]->GetSource());
ClearVolumeControls();
for (const auto &source : sources)
ActivateAudioSource(source);
UpdateContextBar(true);
}