dolphin/Source/Core/DolphinQt/Config/ConfigControls/ConfigRadio.h
Dentomologist 70b0bb4fc0 ConfigControl: Fix font styling bugs
Fix two bugs with bold and italic labels when a non-Base config layer is
active.

First, when constructing a ConfigControl the label wouldn't be
bolded until the next time a ConfigChanged signal was received. This
would happen if the user started a game before opening a config window
for the first time since starting Dolphin.

Second, ConfigRadioInt would bold/italicize every radio button for that
setting instead of just the selected radio button.

Renames the IsConfigLocal function to ShouldLabelBeBold, since the
former name was inaccurate if m_layer wasn't the local layer.
2025-09-25 10:47:28 -07:00

36 lines
980 B
C++

// Copyright 2018 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include "DolphinQt/Config/ConfigControls/ConfigControl.h"
#include "DolphinQt/Config/ToolTipControls/ToolTipRadioButton.h"
#include "Common/Config/ConfigInfo.h"
class ConfigRadioInt final : public ConfigControl<ToolTipRadioButton>
{
Q_OBJECT
public:
ConfigRadioInt(const QString& label, const Config::Info<int>& setting, int value,
Config::Layer* layer = nullptr);
int GetValue() const;
signals:
// Since selecting a new radio button deselects the old one, ::toggled will generate two signals.
// These are convenience functions so you can receive only one signal if desired.
void OnSelected(int new_value);
void OnDeselected(int old_value);
protected:
void OnConfigChanged() override;
bool ShouldLabelBeBold() const override;
private:
void Update();
bool IsSelected() const;
const Config::Info<int> m_setting;
int m_value;
};