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

Debugger: Improve the responsiveness of some symbol tree widgets #11813

Merged
merged 2 commits into from
Sep 15, 2024
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
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
3 changes: 3 additions & 0 deletions pcsx2-qt/Debugger/SymbolTree/SymbolTreeModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,9 @@ std::vector<std::unique_ptr<SymbolTreeNode>> SymbolTreeModel::populateChildren(
}
}

for (std::unique_ptr<SymbolTreeNode>& child : children)
child->readFromVM(cpu, database);

return children;
}

Expand Down