Help: Fix handling of ampersands in open pages pane

E.g. for "Plug & Paint" example documentation. The list view may not
show double ampersands, but for the context menu they must be "quoted".

Change-Id: I773ac50f93b975504a5aff172336da77a703b52b
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Eike Ziller
2019-08-06 09:56:50 +02:00
parent babbb0a9db
commit 16b8ab2461
2 changed files with 5 additions and 6 deletions

View File

@@ -29,6 +29,7 @@
#include "openpagesmodel.h"
#include <coreplugin/coreconstants.h>
#include <utils/stringutils.h>
#include <QAbstractItemModel>
#include <QApplication>
@@ -86,10 +87,9 @@ void OpenPagesWidget::contextMenuRequested(QPoint pos)
if (index.column() == 1)
index = index.sibling(index.row(), 0);
QMenu contextMenu;
QAction *closeEditor = contextMenu.addAction(tr("Close %1").arg(index.data()
.toString()));
QAction *closeOtherEditors = contextMenu.addAction(tr("Close All Except %1")
.arg(index.data().toString()));
const QString displayString = Utils::quoteAmpersands(index.data().toString());
QAction *closeEditor = contextMenu.addAction(tr("Close %1").arg(displayString));
QAction *closeOtherEditors = contextMenu.addAction(tr("Close All Except %1").arg(displayString));
if (model()->rowCount() == 1) {
closeEditor->setEnabled(false);