Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Qt: Fix some options not changing enabled status on game start. #13259

Merged
merged 1 commit into from
Jan 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ void ConfigStringChoice::Load()
const int index = m_text_is_data ? findText(setting_value) : findData(setting_value);

// This can be called publicly.
const QSignalBlocker block(this);
setCurrentIndex(index);
}

Expand Down Expand Up @@ -145,6 +144,7 @@ void ConfigComplexChoice::UpdateComboIndex()
auto it = std::find(m_options.begin(), m_options.end(), values);
int index = static_cast<int>(std::distance(m_options.begin(), it));

// Will crash if not blocked
const QSignalBlocker blocker(this);
setCurrentIndex(index);
}
Expand Down
11 changes: 9 additions & 2 deletions Source/Core/DolphinQt/Config/ConfigControls/ConfigControl.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

#include <QFont>
#include <QMouseEvent>
#include <QSignalBlocker>

#include "Common/Config/Enums.h"
#include "Common/Config/Layer.h"
Expand Down Expand Up @@ -49,14 +48,21 @@ class ConfigControl : public Derived
bf.setBold(IsConfigLocal());
Derived::setFont(bf);

const QSignalBlocker blocker(this);
// This isn't signal blocked because the UI may need to be updated.
m_updating = true;
OnConfigChanged();
m_updating = false;
});
}

template <typename T>
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)
{
m_layer->Set(m_location, value);
Expand Down Expand Up @@ -100,6 +106,7 @@ class ConfigControl : public Derived
}
}

bool m_updating = false;
const Config::Location m_location;
Config::Layer* m_layer;
};
5 changes: 4 additions & 1 deletion Source/Core/DolphinQt/Config/Graphics/GeneralWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,10 @@ void GeneralWidget::OnEmulationStateChanged(bool running)
std::string current_backend = m_backend_combo->currentData().toString().toStdString();
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)));
}
}
Expand Down