From 52957ffcb537378f9c7466e168871df6778e11ba Mon Sep 17 00:00:00 2001 From: wmayer Date: Thu, 8 Oct 2015 11:13:10 +0200 Subject: [PATCH] + When adding new commands to custom toolbar set user data if required in order to move them up/down --- src/Gui/DlgToolbarsImp.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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); + } } } }