21void QActionGroup::_q_actionChanged()
24 auto action = qobject_cast<QAction*>(
sender());
25 Q_ASSERT_X(action !=
nullptr,
"QActionGroup::_q_actionChanged",
"internal error");
27 if (action->isChecked()) {
28 if (action !=
d->current) {
29 if (!
d->current.isNull())
30 d->current->setChecked(
false);
33 }
else if (action ==
d->current) {
39void QActionGroup::_q_actionTriggered()
41 auto action = qobject_cast<QAction*>(
sender());
42 Q_ASSERT_X(action !=
nullptr,
"QActionGroup::_q_actionTriggered",
"internal error");
46void QActionGroup::_q_actionHovered()
48 auto action = qobject_cast<QAction*>(
sender());
49 Q_ASSERT_X(action !=
nullptr,
"QActionGroup::_q_actionHovered",
"internal error");
129 if (!
d->actions.contains(
a)) {
130 d->actions.append(
a);
135 a->d_func()->setEnabled(
d->enabled,
true);
136 if (!
a->d_func()->forceInvisible)
137 a->d_func()->setVisible(
d->visible);
141 if (oldGroup !=
this) {
144 a->d_func()->group =
this;
145 a->d_func()->sendDataChanged();
187 if (
d->actions.removeAll(action)) {
188 if (action ==
d->current)
189 d->current =
nullptr;
193 action->d_func()->group =
nullptr;
256 return d->exclusionPolicy;
280 for (
auto action : std::as_const(
d->actions)) {
281 action->d_func()->setEnabled(
b,
true);
298 return d->current.data();
314 for (
auto action : std::as_const(
d->actions)) {
315 if (!action->d_func()->forceInvisible)
316 action->d_func()->setVisible(
b);
328#include "moc_qactiongroup.cpp"
The QActionGroup class groups actions together.
QActionGroup(QObject *parent)
Constructs an action group for the parent object.
ExclusionPolicy
This enum specifies the different policies that can be used to control how the group performs exclusi...
QAction * checkedAction() const
Returns the currently checked action in the group, or \nullptr if none are checked.
void removeAction(QAction *a)
Removes the action from this group.
QActionGroup::ExclusionPolicy exclusionPolicy
This property holds the group exclusive checking policy.
bool isExclusive() const
Returns true if the group is exclusive.
QList< QAction * > actions() const
Returns the list of this groups's actions.
~QActionGroup()
Destroys the action group.
void setExclusionPolicy(ExclusionPolicy policy)
void setExclusive(bool)
Enable or disable the group exclusion checking.
void triggered(QAction *)
QAction * addAction(QAction *a)
Adds the action to this group, and returns it.
The QAction class provides an abstraction for user commands that can be added to different user inter...
void hovered()
This signal is emitted when an action is highlighted by the user; for example, when the user pauses w...
void triggered(bool checked=false)
This signal is emitted when an action is activated by the user; for example, when the user clicks a m...
void changed()
This signal is emitted when an action has changed.
The QIcon class provides scalable icons in different modes and states.
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
QObject * sender() const
Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; othe...
static bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *member)
\threadsafe
\macro QT_RESTRICTED_CAST_FROM_ASCII
Combined button and popup list for selecting options.
GLboolean GLboolean GLboolean b
GLboolean GLboolean GLboolean GLboolean a
[7]
GLenum GLenum GLsizei const GLuint GLboolean enabled
#define Q_ASSERT_X(cond, x, msg)
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent