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
commit 2f637ede0f
2 changed files with 27 additions and 0 deletions

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