forked from qt-creator/qt-creator
Update tool tip text for "Show / Hide Sidebar" wrt current state.
This commit is contained in:
@@ -716,6 +716,7 @@ void MainWindow::registerDefaultActions()
|
|||||||
tr("Show Sidebar"), this);
|
tr("Show Sidebar"), this);
|
||||||
m_toggleSideBarAction->setCheckable(true);
|
m_toggleSideBarAction->setCheckable(true);
|
||||||
cmd = am->registerAction(m_toggleSideBarAction, Constants::TOGGLE_SIDEBAR, m_globalContext);
|
cmd = am->registerAction(m_toggleSideBarAction, Constants::TOGGLE_SIDEBAR, m_globalContext);
|
||||||
|
cmd->setAttribute(Command::CA_UpdateText);
|
||||||
#ifdef Q_WS_MAC
|
#ifdef Q_WS_MAC
|
||||||
cmd->setDefaultKeySequence(QKeySequence("Ctrl+0"));
|
cmd->setDefaultKeySequence(QKeySequence("Ctrl+0"));
|
||||||
#else
|
#else
|
||||||
|
@@ -163,10 +163,19 @@ int NavigationWidget::storedWidth()
|
|||||||
return m_width;
|
return m_width;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NavigationWidget::updateToggleText()
|
||||||
|
{
|
||||||
|
if (isShown())
|
||||||
|
m_toggleSideBarAction->setText(tr("Hide Sidebar"));
|
||||||
|
else
|
||||||
|
m_toggleSideBarAction->setText(tr("Show Sidebar"));
|
||||||
|
}
|
||||||
|
|
||||||
void NavigationWidget::placeHolderChanged(NavigationWidgetPlaceHolder *holder)
|
void NavigationWidget::placeHolderChanged(NavigationWidgetPlaceHolder *holder)
|
||||||
{
|
{
|
||||||
m_toggleSideBarAction->setEnabled(holder);
|
m_toggleSideBarAction->setEnabled(holder);
|
||||||
m_toggleSideBarAction->setChecked(holder && isShown());
|
m_toggleSideBarAction->setChecked(holder && isShown());
|
||||||
|
updateToggleText();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NavigationWidget::resizeEvent(QResizeEvent *re)
|
void NavigationWidget::resizeEvent(QResizeEvent *re)
|
||||||
@@ -307,6 +316,7 @@ void NavigationWidget::setShown(bool b)
|
|||||||
} else {
|
} else {
|
||||||
m_toggleSideBarAction->setChecked(false);
|
m_toggleSideBarAction->setChecked(false);
|
||||||
}
|
}
|
||||||
|
updateToggleText();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NavigationWidget::isShown() const
|
bool NavigationWidget::isShown() const
|
||||||
|
@@ -107,6 +107,7 @@ private slots:
|
|||||||
void closeSubWidget();
|
void closeSubWidget();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void updateToggleText();
|
||||||
NavigationSubWidget *insertSubItem(int position);
|
NavigationSubWidget *insertSubItem(int position);
|
||||||
QList<NavigationSubWidget *> m_subWidgets;
|
QList<NavigationSubWidget *> m_subWidgets;
|
||||||
QHash<QShortcut *, QString> m_shortcutMap;
|
QHash<QShortcut *, QString> m_shortcutMap;
|
||||||
|
Reference in New Issue
Block a user