Commit 36b3e3c8 authored by Jochen Becher's avatar Jochen Becher

ModelEditor: Sort toolbars by priority

Change-Id: I7b8adca90cb0956c0af7aec454b9e62df98e8ba5
Reviewed-by: default avatarTobias Hunger <tobias.hunger@theqtcompany.com>
parent eb38644e
......@@ -95,6 +95,8 @@
#include <QUndoStack>
#include <QVBoxLayout>
#include <algorithm>
namespace ModelEditor {
namespace Internal {
......@@ -861,10 +863,12 @@ void ModelEditor::onToolbarSelectionChanged()
void ModelEditor::initToolbars()
{
QHash<QString, QWidget *> toolBars;
// TODO add toolbars sorted by prio
qmt::DocumentController *documentController = d->document->documentController();
qmt::StereotypeController *stereotypeController = documentController->stereotypeController();
foreach (const qmt::Toolbar &toolbar, stereotypeController->toolbars()) {
QList<qmt::Toolbar> toolbars = stereotypeController->toolbars();
std::stable_sort(toolbars.begin(), toolbars.end(),
[=](const qmt::Toolbar &lhs, const qmt::Toolbar &rhs) { return lhs.priority() > rhs.priority(); });
foreach (const qmt::Toolbar &toolbar, toolbars) {
QWidget *toolBar = toolBars.value(toolbar.id());
QLayout *toolBarLayout = 0;
if (!toolBar) {
......
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