Commit edcce9c1 authored by hjk's avatar hjk

Do not show accelerators in dock window titles

The dock widget's togglViewActions text is tied to the widget title,
but the view headers should not display a potential "&" accelerator.

So stash the &'d string away when setting up the title and retrieve
it when re-creating the view menu.

Task-number: QTCREATORBUG-19378
Change-Id: I6bf49ca526d12ddd57dfa33a94327a83baeaa6b4
Reviewed-by: Eike Ziller's avatarEike Ziller <eike.ziller@qt.io>
parent 9488b7e6
......@@ -251,13 +251,17 @@ DockWidget::DockWidget(QWidget *inner, FancyMainWindow *parent, bool immutable)
setWidget(inner);
setFeatures(QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetFloatable);
setObjectName(inner->objectName() + QLatin1String("DockWidget"));
setWindowTitle(inner->windowTitle());
setMouseTracking(true);
QString title = inner->windowTitle();
toggleViewAction()->setProperty("original_title", title);
title = Utils::stripAccelerator(title);
setWindowTitle(title);
QStyleOptionDockWidget opt;
initStyleOption(&opt);
m_titleBar = new TitleBarWidget(this, opt);
m_titleBar->m_titleLabel->setText(inner->windowTitle());
m_titleBar->m_titleLabel->setText(title);
setTitleBarWidget(m_titleBar);
if (immutable)
......@@ -527,7 +531,9 @@ void FancyMainWindow::addDockActionsToMenu(QMenu *menu)
QDockWidget *dockWidget = dockwidgets.at(i);
if (dockWidget->property("managed_dockwidget").isNull()
&& dockWidget->parentWidget() == this) {
actions.append(dockwidgets.at(i)->toggleViewAction());
QAction *action = dockWidget->toggleViewAction();
action->setText(action->property("original_title").toString());
actions.append(action);
}
}
Utils::sort(actions, [](const QAction *action1, const QAction *action2) {
......
Markdown is supported
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