Skip to content

Commit

Permalink
Also add the "reset view" action into the flamegraph toolbar
Browse files Browse the repository at this point in the history
There's now enough space there and it fits well into the overall
scope of this control in my opinion.
  • Loading branch information
milianw committed Sep 29, 2023
1 parent 0bfbee5 commit fb22403
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/flamegraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -788,11 +788,16 @@ FlameGraph::FlameGraph(QWidget* parent, Qt::WindowFlags flags)
m_forwardAction = KStandardAction::forward(this, &FlameGraph::navigateForward, this);
m_forwardAction->setToolTip(QStringLiteral("Go forward in symbol view history"));

m_resetAction = new QAction(QIcon::fromTheme(QStringLiteral("go-first")), tr("Reset View"), this);
m_resetAction->setShortcut(tr("Escape"));
connect(m_resetAction, &QAction::triggered, this, [this]() { selectItem(0); });

// use a QToolBar to automatically hide widgets in a menu that don't fit into the window
auto controls = new QToolBar(this);
controls->layout()->setContentsMargins(0, 0, 0, 0);

// these control widgets can stay as they are, since they should always be visible
controls->addAction(m_resetAction);
controls->addAction(m_backAction);
controls->addAction(m_forwardAction);
controls->addWidget(m_costSource);
Expand Down Expand Up @@ -821,12 +826,7 @@ FlameGraph::FlameGraph(QWidget* parent, Qt::WindowFlags flags)
layout()->addWidget(m_searchResultsLabel);

addAction(m_backAction);

addAction(m_forwardAction);

m_resetAction = new QAction(QIcon::fromTheme(QStringLiteral("go-first")), tr("Reset View"), this);
m_resetAction->setShortcut(tr("Escape"));
connect(m_resetAction, &QAction::triggered, this, [this]() { selectItem(0); });
addAction(m_resetAction);
updateNavigationActions();
}
Expand Down

0 comments on commit fb22403

Please sign in to comment.