Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
3f0a4446
Commit
3f0a4446
authored
Jan 20, 2011
by
con
Browse files
Make action containers aware of deleted commands.
They need to remove them from their internal structure.
parent
06acd2cc
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/plugins/coreplugin/actionmanager/actioncontainer.cpp
View file @
3f0a4446
...
...
@@ -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
;
...
...
src/plugins/coreplugin/actionmanager/actioncontainer_p.h
View file @
3f0a4446
...
...
@@ -85,6 +85,7 @@ protected:
private
slots
:
void
scheduleUpdate
();
void
update
();
void
itemDestroyed
();
private:
QList
<
Group
>::
const_iterator
findGroup
(
const
QString
&
groupId
)
const
;
...
...
src/plugins/coreplugin/actionmanager/actionmanager.cpp
View file @
3f0a4446
...
...
@@ -247,8 +247,9 @@ ActionManagerPrivate::ActionManagerPrivate(MainWindow *mainWnd)
ActionManagerPrivate
::~
ActionManagerPrivate
()
{
qDeleteAll
(
m_idCmdMap
.
values
());
// first delete containers to avoid them reacting to command deletion
qDeleteAll
(
m_idContainerMap
.
values
());
qDeleteAll
(
m_idCmdMap
.
values
());
}
ActionManagerPrivate
*
ActionManagerPrivate
::
instance
()
...
...
@@ -382,6 +383,7 @@ void ActionManagerPrivate::unregisterAction(QAction *action, const Id &id)
a
->
removeOverrideAction
(
action
);
if
(
a
->
isEmpty
())
{
// clean up
// ActionContainers listen to the commands' destroyed signals
m_mainWnd
->
removeAction
(
a
->
action
());
delete
a
->
action
();
m_idCmdMap
.
remove
(
uid
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment