NewBreakpointDialog: Fix improperly behaving radio buttons

This commit is contained in:
Pokechu22 2022-01-31 10:12:55 -08:00
parent a05dd6b7e6
commit 99b3ac21e4

View File

@ -3,6 +3,7 @@
#include "DolphinQt/Debugger/NewBreakpointDialog.h" #include "DolphinQt/Debugger/NewBreakpointDialog.h"
#include <QButtonGroup>
#include <QCheckBox> #include <QCheckBox>
#include <QDialogButtonBox> #include <QDialogButtonBox>
#include <QGridLayout> #include <QGridLayout>
@ -31,10 +32,12 @@ NewBreakpointDialog::NewBreakpointDialog(BreakpointWidget* parent)
void NewBreakpointDialog::CreateWidgets() void NewBreakpointDialog::CreateWidgets()
{ {
m_buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); m_buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
auto* type_group = new QButtonGroup(this);
// Instruction BP // Instruction BP
m_instruction_bp = new QRadioButton(tr("Instruction Breakpoint")); m_instruction_bp = new QRadioButton(tr("Instruction Breakpoint"));
m_instruction_bp->setChecked(true); m_instruction_bp->setChecked(true);
type_group->addButton(m_instruction_bp);
m_instruction_box = new QGroupBox; m_instruction_box = new QGroupBox;
m_instruction_address = new QLineEdit; m_instruction_address = new QLineEdit;
@ -45,11 +48,15 @@ void NewBreakpointDialog::CreateWidgets()
// Memory BP // Memory BP
m_memory_bp = new QRadioButton(tr("Memory Breakpoint")); m_memory_bp = new QRadioButton(tr("Memory Breakpoint"));
type_group->addButton(m_memory_bp);
m_memory_box = new QGroupBox; m_memory_box = new QGroupBox;
auto* memory_type_group = new QButtonGroup(this);
m_memory_use_address = new QRadioButton(tr("Address")); m_memory_use_address = new QRadioButton(tr("Address"));
m_memory_use_address->setChecked(true); m_memory_use_address->setChecked(true);
memory_type_group->addButton(m_memory_use_address);
// i18n: A range of memory addresses // i18n: A range of memory addresses
m_memory_use_range = new QRadioButton(tr("Range")); m_memory_use_range = new QRadioButton(tr("Range"));
memory_type_group->addButton(m_memory_use_range);
m_memory_address_from = new QLineEdit; m_memory_address_from = new QLineEdit;
m_memory_address_to = new QLineEdit; m_memory_address_to = new QLineEdit;
m_memory_address_from_label = new QLabel; // Set by OnAddressTypeChanged m_memory_address_from_label = new QLabel; // Set by OnAddressTypeChanged