Mercurial > hg > svgui
diff widgets/KeyReference.cpp @ 740:a31c8ee2e17e tonioni
Allow registering an alternative shortcut using QKeySequence so as to get the right native string
author | Chris Cannam |
---|---|
date | Thu, 06 Mar 2014 14:27:59 +0000 |
parents | dfe543438d52 |
children | 394caa98d21a |
line wrap: on
line diff
--- a/widgets/KeyReference.cpp Thu Mar 06 14:03:42 2014 +0000 +++ b/widgets/KeyReference.cpp Thu Mar 06 14:27:59 2014 +0000 @@ -87,6 +87,13 @@ } void +KeyReference::registerAlternativeShortcut(QAction *action, QKeySequence shortcut) +{ + QString name = action->text(); + registerAlternativeShortcut(name, shortcut.toString(QKeySequence::NativeText)); +} + +void KeyReference::registerAlternativeShortcut(QString name, QString alternative) { name.replace(tr("&"), ""); @@ -102,6 +109,12 @@ } void +KeyReference::registerAlternativeShortcut(QString name, QKeySequence shortcut) +{ + registerAlternativeShortcut(name, shortcut.toString(QKeySequence::NativeText)); +} + +void KeyReference::show() { if (m_dialog) { @@ -147,7 +160,7 @@ altdesc = tr("</b> (%1)<b>").arg(altdesc); } - text += QString("<tr><td> <b>%1%2</b></td><td> %3</td><td>%4</td></tr>\n") + text += QString("<tr><td width=\"12%\"> <b>%1%2</b></td><td> %3</td><td>%4</td></tr>\n") .arg(shortcut).arg(altdesc).arg(actionName).arg(tip); } }