X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fuisupport%2Factioncollection.cpp;h=9175eccb9bb85dbcc738fdc727b40711009d46dc;hb=9cad7696cf0ef2f58c231c7b1eaaae0c16d0273d;hp=a20d9183027bb49183f65c4ac30dbd47b4c82a73;hpb=bfc967d449565c7435aecfb007e2df6fab1f9188;p=quassel.git diff --git a/src/uisupport/actioncollection.cpp b/src/uisupport/actioncollection.cpp index a20d9183..9175eccb 100644 --- a/src/uisupport/actioncollection.cpp +++ b/src/uisupport/actioncollection.cpp @@ -21,6 +21,7 @@ ***************************************************************************/ #include +#include #include "actioncollection.h" @@ -49,7 +50,8 @@ QList ActionCollection::actions() const { } Action *ActionCollection::addAction(const QString &name, Action *action) { - QAction *act = addAction(name, action); + QAction *act = addAction(name, static_cast(action)); + Q_UNUSED(act); Q_ASSERT(act == action); return action; } @@ -73,7 +75,7 @@ QAction *ActionCollection::addAction(const QString &name, QAction *action) { else action->setObjectName(indexName); if(indexName.isEmpty()) - indexName = QString("unnamed-%1").arg((int)action, 16); + indexName = indexName.sprintf("unnamed-%p", (void *)action); // do we already have this action? if(_actionByName.value(indexName, 0) == action) @@ -206,6 +208,10 @@ void ActionCollection::clearAssociatedWidgets() { _associatedWidgets.clear(); } +void ActionCollection::associatedWidgetDestroyed(QObject *obj) { + _associatedWidgets.removeAll(static_cast(obj)); +} + bool ActionCollection::unlistAction(QAction *action) { // This might be called with a partly destroyed QAction!