Commit f1ac0c58 authored by Eric Armbruster's avatar Eric Armbruster Committed by Christoph Cullmann
Browse files

Add action to hide all tool views

This action is useful when you quickly want to enlarge the main content
area, e.g. after user presses Meta + Left Arrow the toolviews often take
too much space on a small screen.
parent e7b9cc2d
Pipeline #182392 passed with stage
in 6 minutes and 31 seconds
......@@ -100,7 +100,11 @@ GUIClient::GUIClient(MainWindow *mw)
m_showSidebarsAction->setChecked(m_mw->sidebarsVisible());
connect(m_showSidebarsAction, &KToggleAction::toggled, m_mw, &MainWindow::setSidebarsVisible);
m_hideToolViews = actionCollection()->addAction(QStringLiteral("kate_mdi_hide_toolviews"), m_mw, &MainWindow::hideToolViews);
m_hideToolViews->setText(i18n("Hide All Tool Views"));
m_toolMenu->addAction(m_showSidebarsAction);
m_toolMenu->addAction(m_hideToolViews);
QAction *sep_act = new QAction(this);
sep_act->setSeparator(true);
m_toolMenu->addAction(sep_act);
......@@ -1117,6 +1121,16 @@ bool MainWindow::hideToolView(ToolView *widget)
return ret;
}
void MainWindow::hideToolViews()
{
for (const auto &tv : m_toolviews) {
if (tv) {
tv->sidebar()->hideWidget(tv);
}
}
m_centralWidget->setFocus();
}
void MainWindow::startRestore(KConfigBase *config, const QString &group)
{
// first save this stuff
......
......@@ -78,6 +78,7 @@ private:
std::vector<QAction *> m_toolViewActions;
std::unordered_map<ToolView *, QAction *> m_toolToAction;
KActionMenu *m_toolMenu;
QAction *m_hideToolViews;
};
class ToolView : public QFrame
......@@ -350,6 +351,11 @@ public Q_SLOTS:
setSidebarsVisibleInternal(visible, false);
}
/**
* hide all tool views
*/
void hideToolViews();
protected:
/**
* called by toolview destructor
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment