forked from qt-creator/qt-creator
Fixes: - Make the "Toggle Sidebar" button be a toggle button
Task: - 235542
This commit is contained in:
@@ -625,6 +625,7 @@ void MainWindow::registerDefaultActions()
|
|||||||
// Toggle Sidebar Action
|
// Toggle Sidebar Action
|
||||||
m_toggleSideBarAction = new QAction(QIcon(Constants::ICON_TOGGLE_SIDEBAR),
|
m_toggleSideBarAction = new QAction(QIcon(Constants::ICON_TOGGLE_SIDEBAR),
|
||||||
tr("Toggle Sidebar"), this);
|
tr("Toggle Sidebar"), this);
|
||||||
|
m_toggleSideBarAction->setCheckable(true);
|
||||||
cmd = am->registerAction(m_toggleSideBarAction, Constants::TOGGLE_SIDEBAR, m_globalContext);
|
cmd = am->registerAction(m_toggleSideBarAction, Constants::TOGGLE_SIDEBAR, m_globalContext);
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
cmd->setDefaultKeySequence(QKeySequence("Ctrl+0"));
|
cmd->setDefaultKeySequence(QKeySequence("Ctrl+0"));
|
||||||
|
|||||||
@@ -166,6 +166,7 @@ int NavigationWidget::storedWidth()
|
|||||||
void NavigationWidget::placeHolderChanged(NavigationWidgetPlaceHolder *holder)
|
void NavigationWidget::placeHolderChanged(NavigationWidgetPlaceHolder *holder)
|
||||||
{
|
{
|
||||||
m_toggleSideBarAction->setEnabled(holder);
|
m_toggleSideBarAction->setEnabled(holder);
|
||||||
|
m_toggleSideBarAction->setChecked(holder && isShown());
|
||||||
}
|
}
|
||||||
|
|
||||||
void NavigationWidget::resizeEvent(QResizeEvent *re)
|
void NavigationWidget::resizeEvent(QResizeEvent *re)
|
||||||
@@ -281,8 +282,12 @@ void NavigationWidget::setShown(bool b)
|
|||||||
if (m_shown == b)
|
if (m_shown == b)
|
||||||
return;
|
return;
|
||||||
m_shown = b;
|
m_shown = b;
|
||||||
if (NavigationWidgetPlaceHolder::m_current)
|
if (NavigationWidgetPlaceHolder::m_current) {
|
||||||
NavigationWidgetPlaceHolder::m_current->setVisible(m_shown && !m_suppressed);
|
NavigationWidgetPlaceHolder::m_current->setVisible(m_shown && !m_suppressed);
|
||||||
|
m_toggleSideBarAction->setChecked(m_shown);
|
||||||
|
} else {
|
||||||
|
m_toggleSideBarAction->setChecked(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NavigationWidget::isShown() const
|
bool NavigationWidget::isShown() const
|
||||||
|
|||||||
Reference in New Issue
Block a user