+ When adding new commands to custom toolbar set user data if required in order to move them up/down

This commit is contained in:
wmayer
2015-10-08 11:13:10 +02:00
parent 5b08fa453b
commit 60cffb685e

View File

@@ -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);
}
}
}
}