diff --git a/src/Gui/DlgToolbarsImp.cpp b/src/Gui/DlgToolbarsImp.cpp index 19e1a4270..b6f4fdca1 100644 --- a/src/Gui/DlgToolbarsImp.cpp +++ b/src/Gui/DlgToolbarsImp.cpp @@ -735,7 +735,14 @@ void DlgCustomToolbarsImp::addCustomCommand(const QString& name, const QByteArra } else { CommandManager& mgr = Application::Instance->commandManager(); - mgr.addTo(cmd, bars.front()); + if (mgr.addTo(cmd, bars.front())) { + QAction* action = action = bars.front()->actions().last(); + // See ToolBarManager::setup(ToolBarItem* , QToolBar* ) + // We have to add the user data in order to identify the command in + // removeCustomCommand(), moveUpCustomCommand() or moveDownCustomCommand() + if (action && action->data().isNull()) + action->setData(cmd); + } } } }