mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 13:20:27 -06:00
Merge pull request #13259 from TryTwo/PR_Config_signals
Qt: Fix some options not changing enabled status on game start.
This commit is contained in:
@ -63,7 +63,6 @@ void ConfigStringChoice::Load()
|
|||||||
const int index = m_text_is_data ? findText(setting_value) : findData(setting_value);
|
const int index = m_text_is_data ? findText(setting_value) : findData(setting_value);
|
||||||
|
|
||||||
// This can be called publicly.
|
// This can be called publicly.
|
||||||
const QSignalBlocker block(this);
|
|
||||||
setCurrentIndex(index);
|
setCurrentIndex(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,6 +144,7 @@ void ConfigComplexChoice::UpdateComboIndex()
|
|||||||
auto it = std::find(m_options.begin(), m_options.end(), values);
|
auto it = std::find(m_options.begin(), m_options.end(), values);
|
||||||
int index = static_cast<int>(std::distance(m_options.begin(), it));
|
int index = static_cast<int>(std::distance(m_options.begin(), it));
|
||||||
|
|
||||||
|
// Will crash if not blocked
|
||||||
const QSignalBlocker blocker(this);
|
const QSignalBlocker blocker(this);
|
||||||
setCurrentIndex(index);
|
setCurrentIndex(index);
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
#include <QFont>
|
#include <QFont>
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
#include <QSignalBlocker>
|
|
||||||
|
|
||||||
#include "Common/Config/Enums.h"
|
#include "Common/Config/Enums.h"
|
||||||
#include "Common/Config/Layer.h"
|
#include "Common/Config/Layer.h"
|
||||||
@ -49,14 +48,21 @@ protected:
|
|||||||
bf.setBold(IsConfigLocal());
|
bf.setBold(IsConfigLocal());
|
||||||
Derived::setFont(bf);
|
Derived::setFont(bf);
|
||||||
|
|
||||||
const QSignalBlocker blocker(this);
|
// This isn't signal blocked because the UI may need to be updated.
|
||||||
|
m_updating = true;
|
||||||
OnConfigChanged();
|
OnConfigChanged();
|
||||||
|
m_updating = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void SaveValue(const Config::Info<T>& setting, const T& value)
|
void SaveValue(const Config::Info<T>& setting, const T& value)
|
||||||
{
|
{
|
||||||
|
// Avoid OnConfigChanged -> option changed to current config's value -> unnecessary save ->
|
||||||
|
// ConfigChanged.
|
||||||
|
if (m_updating)
|
||||||
|
return;
|
||||||
|
|
||||||
if (m_layer != nullptr)
|
if (m_layer != nullptr)
|
||||||
{
|
{
|
||||||
m_layer->Set(m_location, value);
|
m_layer->Set(m_location, value);
|
||||||
@ -100,6 +106,7 @@ private:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool m_updating = false;
|
||||||
const Config::Location m_location;
|
const Config::Location m_location;
|
||||||
Config::Layer* m_layer;
|
Config::Layer* m_layer;
|
||||||
};
|
};
|
||||||
|
@ -232,7 +232,10 @@ void GeneralWidget::OnEmulationStateChanged(bool running)
|
|||||||
std::string current_backend = m_backend_combo->currentData().toString().toStdString();
|
std::string current_backend = m_backend_combo->currentData().toString().toStdString();
|
||||||
if (Config::Get(Config::MAIN_GFX_BACKEND) != current_backend)
|
if (Config::Get(Config::MAIN_GFX_BACKEND) != current_backend)
|
||||||
{
|
{
|
||||||
m_backend_combo->Load();
|
{
|
||||||
|
const QSignalBlocker blocker(m_backend_combo);
|
||||||
|
m_backend_combo->Load();
|
||||||
|
}
|
||||||
emit BackendChanged(QString::fromStdString(Config::Get(Config::MAIN_GFX_BACKEND)));
|
emit BackendChanged(QString::fromStdString(Config::Get(Config::MAIN_GFX_BACKEND)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user