UI: Fix source toolbar shifting when nothing is selected

#5125 added icons to the source toolbar but no icon is displayed when nothing is selected.

This adds a spacer on the right side of the label that gets toggled inversely to the source icon, to maintain the same width
This commit is contained in:
Warchamp7 2021-08-23 07:16:09 -04:00 committed by Jim
parent 6e566f9b23
commit 2f637ede0f
2 changed files with 27 additions and 0 deletions

View file

@ -308,6 +308,31 @@
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="contextSourceIconSpacer">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>22</width>
<height>22</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>22</width>
<height>22</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="Line" name="line_3">
<property name="orientation">

View file

@ -3140,6 +3140,7 @@ void OBSBasic::UpdateContextBar(bool force)
QPixmap pixmap = icon.pixmap(QSize(16, 16));
ui->contextSourceIcon->setPixmap(pixmap);
ui->contextSourceIconSpacer->hide();
ui->contextSourceIcon->show();
const char *name = obs_source_get_name(source);
@ -3150,6 +3151,7 @@ void OBSBasic::UpdateContextBar(bool force)
obs_source_configurable(source));
} else {
ui->contextSourceIcon->hide();
ui->contextSourceIconSpacer->show();
ui->contextSourceLabel->setText(
QTStr("ContextBar.NoSelectedSource"));