130QAction *QActionGroup::addAction(QAction* a)
133 if (!d->actions.contains(a)) {
134 d->actions.append(a);
135 QObject::connect(a, &QAction::triggered,
this, &QActionGroup::_q_actionTriggered);
136 QObject::connect(a, &QAction::changed,
this, &QActionGroup::_q_actionChanged);
137 QObject::connect(a, &QAction::hovered,
this, &QActionGroup::_q_actionHovered);
139 a->d_func()->setEnabled(d->enabled,
true);
140 if (!a->d_func()->forceInvisible)
141 a->d_func()->setVisible(d->visible);
144 QActionGroup *oldGroup = a->d_func()->group;
145 if (oldGroup !=
this) {
147 oldGroup->removeAction(a);
148 a->d_func()->group =
this;
149 a->d_func()->sendDataChanged();
188void QActionGroup::removeAction(QAction *action)
191 if (d->actions.removeAll(action)) {
192 if (action == d->current)
193 d->current =
nullptr;
194 QObject::disconnect(action, &QAction::triggered,
this, &QActionGroup::_q_actionTriggered);
195 QObject::disconnect(action, &QAction::changed,
this, &QActionGroup::_q_actionChanged);
196 QObject::disconnect(action, &QAction::hovered,
this, &QActionGroup::_q_actionHovered);
197 action->d_func()->group =
nullptr;