aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/help
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@qt.io>2019-08-06 09:56:50 +0200
committerEike Ziller <eike.ziller@qt.io>2019-08-09 12:45:20 +0000
commit16b8ab2461fb5172b001271024331ca28e2be344 (patch)
tree1b4a1ad9ecfefa2c02635c31c24634f901e53b90 /src/plugins/help
parentbabbb0a9dbae053b50493b4ed18c3134f291c675 (diff)
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>
Diffstat (limited to 'src/plugins/help')
-rw-r--r--src/plugins/help/openpagesmodel.cpp3
-rw-r--r--src/plugins/help/openpageswidget.cpp8
2 files changed, 5 insertions, 6 deletions
diff --git a/src/plugins/help/openpagesmodel.cpp b/src/plugins/help/openpagesmodel.cpp
index d00600737e..3587acfc09 100644
--- a/src/plugins/help/openpagesmodel.cpp
+++ b/src/plugins/help/openpagesmodel.cpp
@@ -56,8 +56,7 @@ QVariant OpenPagesModel::data(const QModelIndex &index, int role) const
case Qt::ToolTipRole:
return m_pages.at(index.row())->source().toString();
case Qt::DisplayRole: {
- QString title = m_pages.at(index.row())->title();
- title.replace('&', "&&");
+ const QString title = m_pages.at(index.row())->title();
return title.isEmpty() ? tr("(Untitled)") : title;
}
default:
diff --git a/src/plugins/help/openpageswidget.cpp b/src/plugins/help/openpageswidget.cpp
index a6d98bbb70..55b55353f2 100644
--- a/src/plugins/help/openpageswidget.cpp
+++ b/src/plugins/help/openpageswidget.cpp
@@ -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);