Skip to content

Commit

Permalink
Gui: plugin grouping or label may contain "&"
Browse files Browse the repository at this point in the history
  • Loading branch information
devernay committed Mar 21, 2018
1 parent b8551e8 commit 1655a06
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions Gui/Gui20.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -876,17 +876,22 @@ Gui::findOrCreateToolButton(const boost::shared_ptr<PluginGroupNode> & plugin)
plugin->getLabel(), toolButtonIcon, menuIcon);

if (isLeaf) {
QString label = plugin->getNotHighestMajorVersion() ? plugin->getLabelVersionMajorEncoded() : plugin->getLabel();
QString pluginLabelText = plugin->getNotHighestMajorVersion() ? plugin->getLabelVersionMajorEncoded() : plugin->getLabel();
// see doc of QMenubar: convert & to &&
pluginLabelText.replace(QString::fromUtf8("&"), QString::fromUtf8("&&"));
assert(parentToolButton);
QAction* action = new QAction(this);
action->setText(label);
action->setText(pluginLabelText);
action->setIcon( pluginsToolButton->getMenuIcon() );
QObject::connect( action, SIGNAL(triggered()), pluginsToolButton, SLOT(onTriggered()) );
pluginsToolButton->setAction(action);
} else {
Menu* menu = new Menu(this);
//menu->setFont( QFont(appFont,appFontSize) );
menu->setTitle( pluginsToolButton->getLabel() );
QString pluginsToolButtonTitle = pluginsToolButton->getLabel();
// see doc of QMenubar: convert & to &&
pluginsToolButtonTitle.replace(QString::fromUtf8("&"), QString::fromUtf8("&&"));
menu->setTitle(pluginsToolButtonTitle);
menu->setIcon(menuIcon);
pluginsToolButton->setMenu(menu);
pluginsToolButton->setAction( menu->menuAction() );
Expand Down

0 comments on commit 1655a06

Please sign in to comment.