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.
master
cg2121 2022-08-18 07:50:24 -05:00 committed by Jim
parent 23f910c149
commit 0afcb71122
2 changed files with 20 additions and 0 deletions

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);
}

View File

@ -806,6 +806,7 @@ private slots:
void TBarReleased();
void LockVolumeControl(bool lock);
void ResetProxyStyleSliders();
private:
/* OBS Callbacks */