Commit 1513e0e1 authored by finetjul's avatar finetjul
Browse files

ENH: Display the Modules in the same order than ModuleToolBarList is

git-svn-id: http://svn.slicer.org/Slicer4/trunk@15612 3bd1e089-480b-0410-8dfb-8563597acbee
parent 2b22029e
......@@ -416,10 +416,21 @@ void qSlicerMainWindow::onModuleLoaded(qSlicerAbstractCoreModule* coreModule)
Q_ASSERT(action->data().toString() == module->name());
Q_ASSERT(action->text() == module->title());
// Add action to ToolBar
if (d->ModuleToolBarList.contains(module->title()))
// Add action to ToolBar if it's an "allowed" action
int index = d->ModuleToolBarList.indexOf(module->title());
if (index > 0)
{
d->ModuleToolBar->addAction(action);
// find the location of where to add the action. ModelToolBarList is sorted
QAction* beforeAction = 0;
foreach(QAction* toolBarAction, d->ModuleToolBar->actions())
{
Q_ASSERT(d->ModuleToolBarList.contains(toolBarAction->text()));
if (d->ModuleToolBarList.indexOf(toolBarAction->text()) > index)
{
beforeAction = toolBarAction;
}
}
d->ModuleToolBar->insertAction(beforeAction, action);
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment