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);
|
||||
m_toggleSideBarAction->setCheckable(true);
|
||||
cmd = am->registerAction(m_toggleSideBarAction, Constants::TOGGLE_SIDEBAR, m_globalContext);
|
||||
cmd->setAttribute(Command::CA_UpdateText);
|
||||
#ifdef Q_WS_MAC
|
||||
cmd->setDefaultKeySequence(QKeySequence("Ctrl+0"));
|
||||
#else
|
||||
|
@@ -163,10 +163,19 @@ int NavigationWidget::storedWidth()
|
||||
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)
|
||||
{
|
||||
m_toggleSideBarAction->setEnabled(holder);
|
||||
m_toggleSideBarAction->setChecked(holder && isShown());
|
||||
updateToggleText();
|
||||
}
|
||||
|
||||
void NavigationWidget::resizeEvent(QResizeEvent *re)
|
||||
@@ -307,6 +316,7 @@ void NavigationWidget::setShown(bool b)
|
||||
} else {
|
||||
m_toggleSideBarAction->setChecked(false);
|
||||
}
|
||||
updateToggleText();
|
||||
}
|
||||
|
||||
bool NavigationWidget::isShown() const
|
||||
|
@@ -107,6 +107,7 @@ private slots:
|
||||
void closeSubWidget();
|
||||
|
||||
private:
|
||||
void updateToggleText();
|
||||
NavigationSubWidget *insertSubItem(int position);
|
||||
QList<NavigationSubWidget *> m_subWidgets;
|
||||
QHash<QShortcut *, QString> m_shortcutMap;
|
||||
|
Reference in New Issue
Block a user