1
0
Fork 0

GUI: Changed call stack context menu when called on space line

This commit is contained in:
morsisko 2020-10-23 16:49:50 +02:00
parent d39b8211de
commit 8f3119ecba
2 changed files with 15 additions and 3 deletions

View File

@ -28,11 +28,17 @@ void CallStackView::setupContextMenu()
return DbgIsDebugging(); return DbgIsDebugging();
}); });
QIcon icon = DIcon(ArchValue("processor32.png", "processor64.png")); QIcon icon = DIcon(ArchValue("processor32.png", "processor64.png"));
mMenuBuilder->addAction(makeAction(icon, tr("Follow &Address"), SLOT(followAddress()))); mMenuBuilder->addAction(makeAction(icon, tr("Follow &Address"), SLOT(followAddress())), [this](QMenu*)
mMenuBuilder->addAction(makeAction(icon, tr("Follow &To"), SLOT(followTo()))); {
return isSelectionValid();
});
mMenuBuilder->addAction(makeAction(icon, tr("Follow &To"), SLOT(followTo())), [this](QMenu*)
{
return isSelectionValid();
});
QAction* mFollowFrom = mMenuBuilder->addAction(makeAction(icon, tr("Follow &From"), SLOT(followFrom())), [this](QMenu*) QAction* mFollowFrom = mMenuBuilder->addAction(makeAction(icon, tr("Follow &From"), SLOT(followFrom())), [this](QMenu*)
{ {
return !getCellContent(getInitialSelection(), ColFrom).isEmpty(); return !getCellContent(getInitialSelection(), ColFrom).isEmpty() && isSelectionValid();
}); });
mFollowFrom->setShortcutContext(Qt::WidgetShortcut); mFollowFrom->setShortcutContext(Qt::WidgetShortcut);
mFollowFrom->setShortcut(QKeySequence("enter")); mFollowFrom->setShortcut(QKeySequence("enter"));
@ -176,3 +182,8 @@ void CallStackView::showSuspectedCallStack()
updateCallStack(); updateCallStack();
emit Bridge::getBridge()->updateDump(); emit Bridge::getBridge()->updateDump();
} }
bool CallStackView::isSelectionValid()
{
return getCellContent(getInitialSelection(), ColThread).isEmpty();
}

View File

@ -34,6 +34,7 @@ private:
}; };
MenuBuilder* mMenuBuilder; MenuBuilder* mMenuBuilder;
bool isSelectionValid();
}; };
#endif // CALLSTACKVIEW_H #endif // CALLSTACKVIEW_H