Skip to content

Commit

Permalink
Debugger: Make check box widgets in the symbol tree more responsive
Browse files Browse the repository at this point in the history
  • Loading branch information
chaoticgd authored and F0bes committed Sep 15, 2024
1 parent d9c5f22 commit 93b1841
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
8 changes: 8 additions & 0 deletions pcsx2-qt/Debugger/SymbolTree/SymbolTreeDelegates.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ QWidget* SymbolTreeValueDelegate::createEditor(QWidget* parent, const QStyleOpti
{
QCheckBox* editor = new QCheckBox(parent);
editor->setChecked(value.toBool());
connect(editor, &QCheckBox::checkStateChanged, this, &SymbolTreeValueDelegate::onCheckBoxStateChanged);
result = editor;

break;
Expand Down Expand Up @@ -276,6 +277,13 @@ void SymbolTreeValueDelegate::setModelData(QWidget* editor, QAbstractItemModel*
model->setData(index, value, SymbolTreeModel::EDIT_ROLE);
}

void SymbolTreeValueDelegate::onCheckBoxStateChanged(Qt::CheckState state)
{
QCheckBox* check_box = qobject_cast<QCheckBox*>(sender());
if (check_box)
commitData(check_box);
}

void SymbolTreeValueDelegate::onComboBoxIndexChanged(int index)
{
QComboBox* combo_box = qobject_cast<QComboBox*>(sender());
Expand Down
6 changes: 4 additions & 2 deletions pcsx2-qt/Debugger/SymbolTree/SymbolTreeDelegates.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ class SymbolTreeValueDelegate : public QStyledItemDelegate
void setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const override;

protected:
// Without this, setModelData would only be called when a combo box was
// deselected rather than when an option was picked.
// These make it so the values inputted are written back to memory
// immediately when the widgets are interacted with rather than when they
// are deselected.
void onCheckBoxStateChanged(Qt::CheckState state);
void onComboBoxIndexChanged(int index);

DebugInterface& m_cpu;
Expand Down

0 comments on commit 93b1841

Please sign in to comment.