Update tool tip text for "Show / Hide Sidebar" wrt current state.

This commit is contained in:
con
2009-12-08 18:29:44 +01:00
parent fec9dc0e80
commit 6e1832d55d
3 changed files with 12 additions and 0 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -107,6 +107,7 @@ private slots:
void closeSubWidget();
private:
void updateToggleText();
NavigationSubWidget *insertSubItem(int position);
QList<NavigationSubWidget *> m_subWidgets;
QHash<QShortcut *, QString> m_shortcutMap;