analyze: create a top level menu entry

Change-Id: I17c4d17583d401fb537d5956f5b07a1dc12906e1
Reviewed-on: http://codereview.qt.nokia.com/893
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
hjk
2011-06-28 19:58:19 +02:00
committed by hjk
parent e9a7ec271d
commit c43f3c848f
4 changed files with 33 additions and 12 deletions

View File

@@ -272,6 +272,29 @@ void ActionContainerPrivate::addMenu(ActionContainer *menu, const QString &group
scheduleUpdate();
}
void ActionContainerPrivate::addMenu(ActionContainer *before, ActionContainer *menu, const QString &groupId)
{
ActionContainerPrivate *containerPrivate = static_cast<ActionContainerPrivate *>(menu);
if (!containerPrivate->canBeAddedToMenu())
return;
MenuActionContainer *container = static_cast<MenuActionContainer *>(containerPrivate);
QString actualGroupId;
if (groupId.isEmpty())
actualGroupId = QLatin1String(Constants::G_DEFAULT_TWO);
else
actualGroupId = groupId;
QList<Group>::const_iterator groupIt = findGroup(actualGroupId);
QTC_ASSERT(groupIt != m_groups.constEnd(), return);
QAction *beforeAction = before->menu()->menuAction();
m_groups[groupIt-m_groups.constBegin()].items.append(menu);
connect(menu, SIGNAL(destroyed()), this, SLOT(itemDestroyed()));
insertMenu(beforeAction, container->menu());
scheduleUpdate();
}
void ActionContainerPrivate::clear()
{
QMutableListIterator<Group> it(m_groups);