0
0
mirror of https://github.com/obsproject/obs-studio.git synced 2024-09-19 20:32:15 +02:00

UI: Fix mixer dock widget minSize being too big

When the vertical volume meter was introduced it set in the OBSBasic.ui
mixer dock definition a min width/height that was valid for both
widgets. QStackedWidget hints the minimum size as the higher w/h
of its children so this workaround is necessary.
This commit is contained in:
Shaolin 2018-06-12 22:52:08 -03:00
parent 0bd2e23d14
commit d7fd29351f
3 changed files with 15 additions and 10 deletions

View File

@ -617,12 +617,6 @@
<item>
<widget class="QStackedWidget" name="stackedMixerArea">
<widget class="VScrollArea" name="hMixerScrollArea">
<property name="minimumSize">
<size>
<width>175</width>
<height>220</height>
</size>
</property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>

View File

@ -1560,9 +1560,8 @@ void OBSBasic::OBSInit()
}
}
bool vertical = config_get_bool(App()->GlobalConfig(), "BasicWindow",
"VerticalVolControl");
ui->stackedMixerArea->setCurrentIndex(vertical);
ToggleMixerLayout(config_get_bool(App()->GlobalConfig(), "BasicWindow",
"VerticalVolControl"));
if (config_get_bool(basicConfig, "General", "OpenStatsOnStartup"))
on_stats_triggered();
@ -2524,13 +2523,24 @@ void OBSBasic::StackedMixerAreaContextMenuRequested()
popup.exec(QCursor::pos());
}
void OBSBasic::ToggleMixerLayout(bool vertical)
{
if (vertical) {
ui->stackedMixerArea->setMinimumSize(180, 220);
ui->stackedMixerArea->setCurrentIndex(1);
} else {
ui->stackedMixerArea->setMinimumSize(220, 0);
ui->stackedMixerArea->setCurrentIndex(0);
}
}
void OBSBasic::ToggleVolControlLayout()
{
bool vertical = !config_get_bool(GetGlobalConfig(), "BasicWindow",
"VerticalVolControl");
config_set_bool(GetGlobalConfig(), "BasicWindow", "VerticalVolControl",
vertical);
ui->stackedMixerArea->setCurrentIndex(vertical);
ToggleMixerLayout(vertical);
// We need to store it so we can delete current and then add
// at the right order

View File

@ -252,6 +252,7 @@ private:
void GetAudioSourceProperties();
void VolControlContextMenu();
void ToggleVolControlLayout();
void ToggleMixerLayout(bool vertical);
void RefreshSceneCollections();
void ChangeSceneCollection();