| 225 | } |
| 226 | |
| 227 | void ActionContainer::clear() |
| 228 | { |
| 229 | for (Group &group : d->groupList) { |
| 230 | for (QObject *item : std::as_const(group.items)) { |
| 231 | if (auto command = qobject_cast<Command *>(item)) { |
| 232 | removeAction(command); |
| 233 | disconnect(command, &Command::activeStateChanged, |
| 234 | d, &ActionContainerPrivate::scheduleUpdate); |
| 235 | disconnect(command, &QObject::destroyed, d, &ActionContainerPrivate::itemDestroyed); |
| 236 | } else if (auto container = qobject_cast<ActionContainer *>(item)) { |
| 237 | container->clear(); |
| 238 | disconnect(container, &QObject::destroyed, |
| 239 | d, &ActionContainerPrivate::itemDestroyed); |
| 240 | removeMenu(container); |
| 241 | } |
| 242 | } |
| 243 | group.items.clear(); |
| 244 | } |
| 245 | |
| 246 | d->scheduleUpdate(); |
| 247 | } |
| 248 | |
| 249 | QAction *ActionContainer::actionForItem(QObject *item) const |
| 250 | { |
no test coverage detected