Browse Source

[desktop] Fix misaligned output device (#2786)

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

furthermore, default and default_dark did not properly define a min-width or min-height for QComboBox. This caused the platform theme to take over sizing which is NOT GOOD and should basically be avoided always

Signed-off-by: crueter <crueter@eden-emu.dev>
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/2786
Reviewed-by: MaranBr <maranbr@eden-emu.dev>
pull/2794/head
crueter 2 months ago
parent
commit
54d6283ac3
No known key found for this signature in database GPG Key ID: 425ACD2D4830EBC6
  1. 6
      dist/qt_themes/default/style.qss
  2. 6
      dist/qt_themes/default_dark/style.qss
  3. 1
      src/yuzu/configuration/configure_audio.cpp
  4. 8
      src/yuzu/configuration/shared_widget.cpp

6
dist/qt_themes/default/style.qss

@ -2,6 +2,12 @@ QAbstractSpinBox {
min-height: 19px; min-height: 19px;
} }
QComboBox {
padding: 0px 4px 0px 4px;
min-width: 60px;
min-height: 19px;
}
QPushButton#TogglableStatusBarButton { QPushButton#TogglableStatusBarButton {
color: #959595; color: #959595;
border: 1px solid transparent; border: 1px solid transparent;

6
dist/qt_themes/default_dark/style.qss

@ -6,6 +6,12 @@ QAbstractSpinBox {
min-height: 19px; min-height: 19px;
} }
QComboBox {
padding: 0px 4px 0px 4px;
min-width: 60px;
min-height: 19px;
}
QPushButton#TogglableStatusBarButton { QPushButton#TogglableStatusBarButton {
color: #959595; color: #959595;
border: 1px solid transparent; border: 1px solid transparent;

1
src/yuzu/configuration/configure_audio.cpp

@ -126,6 +126,7 @@ void ConfigureAudio::Setup(const ConfigurationShared::Builder& builder) {
restore_output_device_button->setVisible( restore_output_device_button->setVisible(
!Settings::values.audio_output_device_id.UsingGlobal()); !Settings::values.audio_output_device_id.UsingGlobal());
widget->layout()->addWidget(restore_output_device_button); widget->layout()->addWidget(restore_output_device_button);
connect(restore_output_device_button, &QAbstractButton::clicked, [this](bool) { connect(restore_output_device_button, &QAbstractButton::clicked, [this](bool) {
Settings::values.audio_output_device_id.SetGlobal(true); Settings::values.audio_output_device_id.SetGlobal(true);
SetOutputDevicesFromDeviceID(); SetOutputDevicesFromDeviceID();

8
src/yuzu/configuration/shared_widget.cpp

@ -507,7 +507,7 @@ void Widget::SetupComponent(const QString& label, std::function<void()>& load_fu
created = true; created = true;
const auto type = setting.TypeId(); const auto type = setting.TypeId();
QLayout* layout = new QHBoxLayout(this);
QHBoxLayout* layout = new QHBoxLayout(this);
layout->setContentsMargins(0, 0, 0, 0); layout->setContentsMargins(0, 0, 0, 0);
if (other_setting == nullptr) { if (other_setting == nullptr) {
@ -574,10 +574,10 @@ void Widget::SetupComponent(const QString& label, std::function<void()>& load_fu
if (require_checkbox) { if (require_checkbox) {
QWidget* lhs = QWidget* lhs =
CreateCheckBox(other_setting, label, checkbox_serializer, checkbox_restore_func, touch); CreateCheckBox(other_setting, label, checkbox_serializer, checkbox_restore_func, touch);
layout->addWidget(lhs);
layout->addWidget(lhs, 1);
} else if (setting.TypeId() != typeid(bool)) { } else if (setting.TypeId() != typeid(bool)) {
QLabel* qt_label = CreateLabel(label); QLabel* qt_label = CreateLabel(label);
layout->addWidget(qt_label);
layout->addWidget(qt_label, 1);
} }
if (setting.TypeId() == typeid(bool)) { if (setting.TypeId() == typeid(bool)) {
@ -649,7 +649,7 @@ void Widget::SetupComponent(const QString& label, std::function<void()>& load_fu
return; return;
} }
layout->addWidget(data_component);
layout->addWidget(data_component, 1);
if (!managed) { if (!managed) {
return; return;

Loading…
Cancel
Save