debugger(CallStack): Make Return act as double click

This commit is contained in:
Eladash 2023-06-05 10:53:11 +03:00 committed by Ivan
parent 0c0f63a2a8
commit e75c0dbaa1
2 changed files with 8 additions and 3 deletions

View File

@ -13,7 +13,7 @@ call_stack_list::call_stack_list(QWidget* parent) : QListWidget(parent)
setSelectionMode(QAbstractItemView::ExtendedSelection); setSelectionMode(QAbstractItemView::ExtendedSelection);
// connects // connects
connect(this, &QListWidget::itemDoubleClicked, this, &call_stack_list::OnCallStackListDoubleClicked); connect(this, &QListWidget::itemDoubleClicked, this, &call_stack_list::ShowItemAddress);
// Hide until used in order to allow as much space for registers panel as possible // Hide until used in order to allow as much space for registers panel as possible
hide(); hide();
@ -23,6 +23,11 @@ void call_stack_list::keyPressEvent(QKeyEvent* event)
{ {
QListWidget::keyPressEvent(event); QListWidget::keyPressEvent(event);
event->ignore(); // Propagate the event to debugger_frame event->ignore(); // Propagate the event to debugger_frame
if (!event->modifiers() && event->key() == Qt::Key_Return)
{
ShowItemAddress();
}
} }
void call_stack_list::HandleUpdate(const std::vector<std::pair<u32, u32>>& call_stack) void call_stack_list::HandleUpdate(const std::vector<std::pair<u32, u32>>& call_stack)
@ -40,7 +45,7 @@ void call_stack_list::HandleUpdate(const std::vector<std::pair<u32, u32>>& call_
setVisible(!call_stack.empty()); setVisible(!call_stack.empty());
} }
void call_stack_list::OnCallStackListDoubleClicked() void call_stack_list::ShowItemAddress()
{ {
if (QListWidgetItem* call_stack_item = currentItem()) if (QListWidgetItem* call_stack_item = currentItem())
{ {

View File

@ -20,7 +20,7 @@ Q_SIGNALS:
public Q_SLOTS: public Q_SLOTS:
void HandleUpdate(const std::vector<std::pair<u32, u32>>& call_stack); void HandleUpdate(const std::vector<std::pair<u32, u32>>& call_stack);
private Q_SLOTS: private Q_SLOTS:
void OnCallStackListDoubleClicked(); void ShowItemAddress();
private: private:
void keyPressEvent(QKeyEvent* event) override; void keyPressEvent(QKeyEvent* event) override;
}; };