Tracing: Add context menu option to reset the flame graph

The double-clicking-on-blank-space method is really hard to discover.

Task-number: QTCREATORBUG-20732
Change-Id: I09e3189292c236fea0698e7cb68ea8340f9033fe
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Ulf Hermann
2019-01-24 10:37:02 +01:00
parent 8d6ccb0822
commit cc213dbe49
6 changed files with 32 additions and 2 deletions

View File

@@ -93,9 +93,14 @@ void FlameGraphView::contextMenuEvent(QContextMenuEvent *ev)
QAction *getGlobalStatsAction = menu.addAction(tr("Show Full Range"));
if (!m_model->modelManager()->isRestrictedToRange())
getGlobalStatsAction->setEnabled(false);
QAction *resetAction = menu.addAction(tr("Reset Flame Graph"));
resetAction->setEnabled(m_content->rootObject()->property("zoomed").toBool());
if (menu.exec(position) == getGlobalStatsAction)
const QAction *selected = menu.exec(position);
if (selected == getGlobalStatsAction)
emit showFullRange();
else if (selected == resetAction)
QMetaObject::invokeMethod(m_content->rootObject(), "resetRoot");
}
} // namespace Internal