DolphinQt: Use qOverload where applicable

Provides the same behvaior, but in a much more concise manner.
This commit is contained in:
Lioncash
2019-07-30 09:35:46 -04:00
committed by Léo Lam
parent 58de3c59ce
commit 19115c84dd
28 changed files with 96 additions and 127 deletions

View File

@ -144,18 +144,17 @@ void EnhancementsWidget::CreateWidgets()
void EnhancementsWidget::ConnectWidgets()
{
connect(m_aa_combo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
connect(m_aa_combo, qOverload<int>(&QComboBox::currentIndexChanged),
[this](int) { SaveSettings(); });
connect(m_pp_effect, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
connect(m_pp_effect, qOverload<int>(&QComboBox::currentIndexChanged),
[this](int) { SaveSettings(); });
connect(m_3d_mode, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
[this] {
m_block_save = true;
LoadPPShaders();
m_block_save = false;
connect(m_3d_mode, qOverload<int>(&QComboBox::currentIndexChanged), [this] {
m_block_save = true;
LoadPPShaders();
m_block_save = false;
SaveSettings();
});
SaveSettings();
});
connect(m_configure_pp_effect, &QPushButton::clicked, this,
&EnhancementsWidget::ConfigurePostProcessingShader);
}

View File

@ -138,13 +138,12 @@ void GeneralWidget::CreateWidgets()
void GeneralWidget::ConnectWidgets()
{
// Video Backend
connect(m_backend_combo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
this, &GeneralWidget::SaveSettings);
connect(m_adapter_combo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
this, [](int index) {
g_Config.iAdapter = index;
Config::SetBaseOrCurrent(Config::GFX_ADAPTER, index);
});
connect(m_backend_combo, qOverload<int>(&QComboBox::currentIndexChanged), this,
&GeneralWidget::SaveSettings);
connect(m_adapter_combo, qOverload<int>(&QComboBox::currentIndexChanged), this, [](int index) {
g_Config.iAdapter = index;
Config::SetBaseOrCurrent(Config::GFX_ADAPTER, index);
});
}
void GeneralWidget::LoadSettings()

View File

@ -14,8 +14,7 @@ GraphicsChoice::GraphicsChoice(const QStringList& options, const Config::ConfigI
: m_setting(setting)
{
addItems(options);
connect(this, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
&GraphicsChoice::Update);
connect(this, qOverload<int>(&QComboBox::currentIndexChanged), this, &GraphicsChoice::Update);
setCurrentIndex(Config::Get(m_setting));
connect(&Settings::Instance(), &Settings::ConfigChanged, [this] {

View File

@ -20,9 +20,7 @@ GraphicsInteger::GraphicsInteger(int minimum, int maximum, const Config::ConfigI
setValue(Config::Get(setting));
connect(this, static_cast<void (GraphicsInteger::*)(int)>(&GraphicsInteger::valueChanged), this,
&GraphicsInteger::Update);
connect(this, qOverload<int>(&GraphicsInteger::valueChanged), this, &GraphicsInteger::Update);
connect(&Settings::Instance(), &Settings::ConfigChanged, [this] {
QFont bf = font();
bf.setBold(Config::GetActiveLayerForConfig(m_setting) != Config::LayerType::Base);

View File

@ -111,11 +111,11 @@ void SoftwareRendererWidget::CreateWidgets()
void SoftwareRendererWidget::ConnectWidgets()
{
connect(m_backend_combo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
connect(m_backend_combo, qOverload<int>(&QComboBox::currentIndexChanged),
[this](int) { SaveSettings(); });
connect(m_object_range_min, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
connect(m_object_range_min, qOverload<int>(&QSpinBox::valueChanged),
[this](int) { SaveSettings(); });
connect(m_object_range_max, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
connect(m_object_range_max, qOverload<int>(&QSpinBox::valueChanged),
[this](int) { SaveSettings(); });
}