1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-31 15:32:45 +00:00

Fix CS Key Binding settings page

This got broken by e07d8f3066. Creating QGridLayout with parent and setting it
later has not the same effect.
This commit is contained in:
elsid 2023-12-14 00:28:43 +01:00
parent 4dfd2b0f46
commit a29ae07957
No known key found for this signature in database
GPG Key ID: 4DE04C198CBA7625
11 changed files with 12 additions and 16 deletions

View File

@ -36,7 +36,7 @@ CSMPrefs::SettingWidgets CSMPrefs::BoolSetting::makeWidgets(QWidget* parent)
connect(mWidget, &QCheckBox::stateChanged, this, &BoolSetting::valueChanged); connect(mWidget, &QCheckBox::stateChanged, this, &BoolSetting::valueChanged);
return SettingWidgets{ .mLabel = nullptr, .mInput = mWidget, .mLayout = nullptr }; return SettingWidgets{ .mLabel = nullptr, .mInput = mWidget };
} }
void CSMPrefs::BoolSetting::updateWidget() void CSMPrefs::BoolSetting::updateWidget()

View File

@ -41,7 +41,7 @@ CSMPrefs::SettingWidgets CSMPrefs::ColourSetting::makeWidgets(QWidget* parent)
connect(mWidget, &CSVWidget::ColorEditor::pickingFinished, this, &ColourSetting::valueChanged); connect(mWidget, &CSVWidget::ColorEditor::pickingFinished, this, &ColourSetting::valueChanged);
return SettingWidgets{ .mLabel = label, .mInput = mWidget, .mLayout = nullptr }; return SettingWidgets{ .mLabel = label, .mInput = mWidget };
} }
void CSMPrefs::ColourSetting::updateWidget() void CSMPrefs::ColourSetting::updateWidget()

View File

@ -73,7 +73,7 @@ CSMPrefs::SettingWidgets CSMPrefs::DoubleSetting::makeWidgets(QWidget* parent)
connect(mWidget, qOverload<double>(&QDoubleSpinBox::valueChanged), this, &DoubleSetting::valueChanged); connect(mWidget, qOverload<double>(&QDoubleSpinBox::valueChanged), this, &DoubleSetting::valueChanged);
return SettingWidgets{ .mLabel = label, .mInput = mWidget, .mLayout = nullptr }; return SettingWidgets{ .mLabel = label, .mInput = mWidget };
} }
void CSMPrefs::DoubleSetting::updateWidget() void CSMPrefs::DoubleSetting::updateWidget()

View File

@ -106,7 +106,7 @@ CSMPrefs::SettingWidgets CSMPrefs::EnumSetting::makeWidgets(QWidget* parent)
connect(mWidget, qOverload<int>(&QComboBox::currentIndexChanged), this, &EnumSetting::valueChanged); connect(mWidget, qOverload<int>(&QComboBox::currentIndexChanged), this, &EnumSetting::valueChanged);
return SettingWidgets{ .mLabel = label, .mInput = mWidget, .mLayout = nullptr }; return SettingWidgets{ .mLabel = label, .mInput = mWidget };
} }
void CSMPrefs::EnumSetting::updateWidget() void CSMPrefs::EnumSetting::updateWidget()

View File

@ -65,7 +65,7 @@ CSMPrefs::SettingWidgets CSMPrefs::IntSetting::makeWidgets(QWidget* parent)
connect(mWidget, qOverload<int>(&QSpinBox::valueChanged), this, &IntSetting::valueChanged); connect(mWidget, qOverload<int>(&QSpinBox::valueChanged), this, &IntSetting::valueChanged);
return SettingWidgets{ .mLabel = label, .mInput = mWidget, .mLayout = nullptr }; return SettingWidgets{ .mLabel = label, .mInput = mWidget };
} }
void CSMPrefs::IntSetting::updateWidget() void CSMPrefs::IntSetting::updateWidget()

View File

@ -47,7 +47,7 @@ namespace CSMPrefs
connect(widget, &QPushButton::toggled, this, &ModifierSetting::buttonToggled); connect(widget, &QPushButton::toggled, this, &ModifierSetting::buttonToggled);
return SettingWidgets{ .mLabel = label, .mInput = widget, .mLayout = nullptr }; return SettingWidgets{ .mLabel = label, .mInput = widget };
} }
void ModifierSetting::updateWidget() void ModifierSetting::updateWidget()

View File

@ -23,7 +23,6 @@ namespace CSMPrefs
{ {
QLabel* mLabel; QLabel* mLabel;
QWidget* mInput; QWidget* mInput;
QGridLayout* mLayout;
}; };
class Setting : public QObject class Setting : public QObject

View File

@ -51,7 +51,7 @@ namespace CSMPrefs
connect(widget, &QPushButton::toggled, this, &ShortcutSetting::buttonToggled); connect(widget, &QPushButton::toggled, this, &ShortcutSetting::buttonToggled);
return SettingWidgets{ .mLabel = label, .mInput = widget, .mLayout = nullptr }; return SettingWidgets{ .mLabel = label, .mInput = widget };
} }
void ShortcutSetting::updateWidget() void ShortcutSetting::updateWidget()

View File

@ -36,7 +36,7 @@ CSMPrefs::SettingWidgets CSMPrefs::StringSetting::makeWidgets(QWidget* parent)
connect(mWidget, &QLineEdit::textChanged, this, &StringSetting::textChanged); connect(mWidget, &QLineEdit::textChanged, this, &StringSetting::textChanged);
return SettingWidgets{ .mLabel = nullptr, .mInput = mWidget, .mLayout = nullptr }; return SettingWidgets{ .mLabel = nullptr, .mInput = mWidget };
} }
void CSMPrefs::StringSetting::updateWidget() void CSMPrefs::StringSetting::updateWidget()

View File

@ -13,9 +13,6 @@ namespace CSMPrefs
SettingWidgets Subcategory::makeWidgets(QWidget* /*parent*/) SettingWidgets Subcategory::makeWidgets(QWidget* /*parent*/)
{ {
QGridLayout* const layout = new QGridLayout(); return SettingWidgets{ .mLabel = nullptr, .mInput = nullptr };
layout->setSizeConstraint(QLayout::SetMinAndMaxSize);
return SettingWidgets{ .mLabel = nullptr, .mInput = nullptr, .mLayout = layout };
} }
} }

View File

@ -81,12 +81,12 @@ namespace CSVPrefs
int next = mPageLayout->rowCount(); int next = mPageLayout->rowCount();
mPageLayout->addWidget(widgets.mInput, next, 0, 1, 2); mPageLayout->addWidget(widgets.mInput, next, 0, 1, 2);
} }
else if (widgets.mLayout != nullptr) else
{ {
// Create new page // Create new page
QWidget* pageWidget = new QWidget(); QWidget* pageWidget = new QWidget();
mPageLayout = widgets.mLayout; mPageLayout = new QGridLayout(pageWidget);
mPageLayout->setParent(pageWidget); mPageLayout->setSizeConstraint(QLayout::SetMinAndMaxSize);
mStackedLayout->addWidget(pageWidget); mStackedLayout->addWidget(pageWidget);