Qt/MemoryViewWidget: Detect row breakpoint cell by cell data instead of cell position.

This commit is contained in:
Admiral H. Curtiss 2022-04-24 06:49:10 +02:00
parent 6920a24f1d
commit 787e3efeb8
No known key found for this signature in database
GPG Key ID: F051B4C4044F33FB
1 changed files with 10 additions and 16 deletions

View File

@ -549,25 +549,19 @@ void MemoryViewWidget::wheelEvent(QWheelEvent* event)
void MemoryViewWidget::mousePressEvent(QMouseEvent* event)
{
auto* item_selected = itemAt(event->pos());
if (item_selected == nullptr)
if (event->button() != Qt::LeftButton)
return;
const u32 address = item(row(item_selected), 1)->data(USER_ROLE_CELL_ADDRESS).toUInt();
auto* item = itemAt(event->pos());
if (!item)
return;
switch (event->button())
{
case Qt::LeftButton:
if (column(item_selected) == 0)
ToggleBreakpoint(address, true);
else
SetAddress(address);
Update();
break;
default:
break;
}
const u32 address = item->data(USER_ROLE_CELL_ADDRESS).toUInt();
if (item->data(USER_ROLE_IS_ROW_BREAKPOINT_CELL).toBool())
ToggleBreakpoint(address, true);
else
SetAddress(address);
Update();
}
void MemoryViewWidget::OnCopyAddress(u32 addr)