Skip to content

Commit

Permalink
Open the register value in a new pane when the register is middle-cli…
Browse files Browse the repository at this point in the history
…cked. Fix Vector35#317
  • Loading branch information
xusheng6 committed Mar 8, 2023
1 parent 6481f13 commit 0b510f9
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
32 changes: 32 additions & 0 deletions ui/registerswidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,38 @@ void DebugRegistersWidget::onDoubleClicked()
}


void DebugRegistersWidget::mousePressEvent(QMouseEvent *event)
{
if (event->button() == Qt::MiddleButton)
{
QModelIndexList sel = selectionModel()->selectedIndexes();
if (sel.empty())
return;

auto sourceIndex = m_filter->mapToSource(sel[0]);
if (!sourceIndex.isValid())
return;

auto reg = m_model->getRow(sourceIndex.row());
uint64_t value = reg.value();

UIContext* context = UIContext::contextForWidget(this);
if (!context)
return;

View* view = context->getCurrentView();
if (!view)
return;

view->navigateOnOtherPane(value);
}
else
{
QTableView::mousePressEvent(event);
}
}


void DebugRegistersWidget::editValue()
{
QModelIndexList sel = selectionModel()->selectedIndexes();
Expand Down
3 changes: 3 additions & 0 deletions ui/registerswidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,9 @@ private slots:
public slots:
void updateContent();
void showContextMenu();

protected:
virtual void mousePressEvent(QMouseEvent* event) override;
};


Expand Down

0 comments on commit 0b510f9

Please sign in to comment.