Skip to content

Commit

Permalink
Qt/MemoryViewWidget: Remove the behavior that clicking anywhere in th…
Browse files Browse the repository at this point in the history
…e table centers the table on that row.
  • Loading branch information
AdmiralCurtiss committed Apr 26, 2022
1 parent a07c079 commit 1087225
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions Source/Core/DolphinQt/Debugger/MemoryViewWidget.cpp
Expand Up @@ -51,6 +51,7 @@ class MemoryViewTable final : public QTableWidget
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setShowGrid(false);
setContextMenuPolicy(Qt::CustomContextMenu);
setSelectionMode(SingleSelection);

connect(this, &MemoryViewTable::customContextMenuRequested, m_view,
&MemoryViewWidget::OnContextMenu);
Expand Down Expand Up @@ -105,12 +106,16 @@ class MemoryViewTable final : public QTableWidget
if (!item)
return;

const u32 address = item->data(USER_ROLE_CELL_ADDRESS).toUInt();
if (item->data(USER_ROLE_IS_ROW_BREAKPOINT_CELL).toBool())
{
const u32 address = item->data(USER_ROLE_CELL_ADDRESS).toUInt();
m_view->ToggleBreakpoint(address, true);
m_view->Update();
}
else
m_view->SetAddress(address);
m_view->Update();
{
QTableWidget::mousePressEvent(event);
}
}

private:
Expand Down Expand Up @@ -284,7 +289,7 @@ void MemoryViewWidget::Update()
for (int c = 2; c < m_table->columnCount(); c++)
{
auto* item = new QTableWidgetItem(QStringLiteral("-"));
item->setFlags(Qt::ItemIsEnabled);
item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
item->setData(USER_ROLE_IS_ROW_BREAKPOINT_CELL, false);
item->setData(USER_ROLE_CELL_ADDRESS, row_address);
item->setData(USER_ROLE_HAS_VALUE, false);
Expand Down Expand Up @@ -378,7 +383,6 @@ void MemoryViewWidget::UpdateColumns(Type type, int first_column)
}
else
{
cell_item->setFlags({});
cell_item->setText(QStringLiteral("-"));
cell_item->setData(USER_ROLE_IS_ROW_BREAKPOINT_CELL, false);
cell_item->setData(USER_ROLE_CELL_ADDRESS, cell_address);
Expand Down

0 comments on commit 1087225

Please sign in to comment.