forked from qt-creator/qt-creator
Make action containers aware of deleted commands.
They need to remove them from their internal structure.
This commit is contained in:
@@ -245,6 +245,7 @@ void ActionContainerPrivate::addAction(Command *command, const QString &groupId)
|
||||
m_groups[groupIt-m_groups.constBegin()].items.append(command);
|
||||
|
||||
connect(command, SIGNAL(activeStateChanged()), this, SLOT(scheduleUpdate()));
|
||||
connect(command, SIGNAL(destroyed()), this, SLOT(itemDestroyed()));
|
||||
insertAction(beforeAction, command->action());
|
||||
scheduleUpdate();
|
||||
}
|
||||
@@ -271,6 +272,17 @@ void ActionContainerPrivate::addMenu(ActionContainer *menu, const QString &group
|
||||
scheduleUpdate();
|
||||
}
|
||||
|
||||
void ActionContainerPrivate::itemDestroyed()
|
||||
{
|
||||
QObject *obj = sender();
|
||||
QMutableListIterator<Group> it(m_groups);
|
||||
while (it.hasNext()) {
|
||||
Group &group = it.next();
|
||||
if (group.items.removeAll(obj) > 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int ActionContainerPrivate::id() const
|
||||
{
|
||||
return m_id;
|
||||
|
||||
Reference in New Issue
Block a user