From c25114d29fc7c1d885f8f012a81cf6c36227eff2 Mon Sep 17 00:00:00 2001 From: crueter Date: Sun, 19 Oct 2025 13:40:17 -0400 Subject: [PATCH] [desktop] Fix misaligned output device Builder::BuildWidget previously relied on Qt to handle layout stretching by implicitly setting each widget to have a stretch of 0. This is very bad behavior, so to fix this we must set a stretch of 1 on each widget that's added by the builder Signed-off-by: crueter --- src/yuzu/configuration/configure_audio.cpp | 1 + src/yuzu/configuration/shared_widget.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/yuzu/configuration/configure_audio.cpp b/src/yuzu/configuration/configure_audio.cpp index 58478059a4..9d21759240 100644 --- a/src/yuzu/configuration/configure_audio.cpp +++ b/src/yuzu/configuration/configure_audio.cpp @@ -126,6 +126,7 @@ void ConfigureAudio::Setup(const ConfigurationShared::Builder& builder) { restore_output_device_button->setVisible( !Settings::values.audio_output_device_id.UsingGlobal()); widget->layout()->addWidget(restore_output_device_button); + connect(restore_output_device_button, &QAbstractButton::clicked, [this](bool) { Settings::values.audio_output_device_id.SetGlobal(true); SetOutputDevicesFromDeviceID(); diff --git a/src/yuzu/configuration/shared_widget.cpp b/src/yuzu/configuration/shared_widget.cpp index b7fc98d637..2d76a774f6 100644 --- a/src/yuzu/configuration/shared_widget.cpp +++ b/src/yuzu/configuration/shared_widget.cpp @@ -507,7 +507,7 @@ void Widget::SetupComponent(const QString& label, std::function& load_fu created = true; const auto type = setting.TypeId(); - QLayout* layout = new QHBoxLayout(this); + QHBoxLayout* layout = new QHBoxLayout(this); layout->setContentsMargins(0, 0, 0, 0); if (other_setting == nullptr) { @@ -574,10 +574,10 @@ void Widget::SetupComponent(const QString& label, std::function& load_fu if (require_checkbox) { QWidget* lhs = CreateCheckBox(other_setting, label, checkbox_serializer, checkbox_restore_func, touch); - layout->addWidget(lhs); + layout->addWidget(lhs, 1); } else if (setting.TypeId() != typeid(bool)) { QLabel* qt_label = CreateLabel(label); - layout->addWidget(qt_label); + layout->addWidget(qt_label, 1); } if (setting.TypeId() == typeid(bool)) { @@ -649,7 +649,7 @@ void Widget::SetupComponent(const QString& label, std::function& load_fu return; } - layout->addWidget(data_component); + layout->addWidget(data_component, 1); if (!managed) { return;