Use common functions for handling ampersands/accelerators

Change-Id: I4c74a041a656ed547db0a7406f4306008a513879
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Eike Ziller
2019-08-06 10:07:19 +02:00
parent 16b8ab2461
commit 63c9c5124e
2 changed files with 7 additions and 6 deletions

View File

@@ -25,6 +25,8 @@
#include "proxyaction.h"
#include "stringutils.h"
using namespace Utils;
ProxyAction::ProxyAction(QObject *parent) :
@@ -167,10 +169,9 @@ void ProxyAction::updateToolTipWithKeySequence()
QString ProxyAction::stringWithAppendedShortcut(const QString &str, const QKeySequence &shortcut)
{
QString s = str;
s.replace(QLatin1String("&&"), QLatin1String("&"));
return QString::fromLatin1("%1 <span style=\"color: gray; font-size: small\">%2</span>").
arg(s, shortcut.toString(QKeySequence::NativeText));
const QString s = stripAccelerator(str);
return QString::fromLatin1("%1 <span style=\"color: gray; font-size: small\">%2</span>")
.arg(s, shortcut.toString(QKeySequence::NativeText));
}
ProxyAction *ProxyAction::proxyActionWithIcon(QAction *original, const QIcon &newIcon)