![]() |
Qt 6.x
The Qt SDK
|
Mutually-exclusive group of checkable buttons. More...
Static Public Member Functions | |
static void | buttons_append (QQmlListProperty< QQuickAbstractButton > *prop, QQuickAbstractButton *obj) |
static qsizetype | buttons_count (QQmlListProperty< QQuickAbstractButton > *prop) |
static QQuickAbstractButton * | buttons_at (QQmlListProperty< QQuickAbstractButton > *prop, qsizetype index) |
static void | buttons_clear (QQmlListProperty< QQuickAbstractButton > *prop) |
![]() | |
static bool | removeConnection (Connection *c) |
static QObjectPrivate * | get (QObject *o) |
static const QObjectPrivate * | get (const QObject *o) |
template<typename Func1 , typename Func2 > | |
static QMetaObject::Connection | connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiverPrivate, Func2 slot, Qt::ConnectionType type=Qt::AutoConnection) |
template<typename Func1 , typename Func2 > | |
static bool | disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiverPrivate, Func2 slot) |
static QMetaObject::Connection | connectImpl (const QObject *sender, int signal_index, const QObject *receiver, void **slot, QtPrivate::QSlotObjectBase *slotObj, int type, const int *types, const QMetaObject *senderMetaObject) |
static QMetaObject::Connection | connect (const QObject *sender, int signal_index, QtPrivate::QSlotObjectBase *slotObj, Qt::ConnectionType type) |
static QMetaObject::Connection | connect (const QObject *sender, int signal_index, const QObject *receiver, QtPrivate::QSlotObjectBase *slotObj, Qt::ConnectionType type) |
static bool | disconnect (const QObject *sender, int signal_index, void **slot) |
static bool | disconnect (const QObject *sender, int signal_index, const QObject *receiver, void **slot) |
Public Attributes | ||
bool | complete = true | |
bool | exclusive = true | |
bool | settingCheckState = false | |
Qt::CheckState | checkState = Qt::Unchecked | |
QPointer< QQuickAbstractButton > | checkedButton | |
QList< QQuickAbstractButton * > | buttons | |
![]() | ||
ExtraData * | extraData | |
QAtomicPointer< QThreadData > | threadData | |
QAtomicPointer< ConnectionData > | connections | |
union { | ||
QObject * currentChildBeingDeleted | ||
QAbstractDeclarativeData * declarativeData | ||
}; | ||
QAtomicPointer< QtSharedPointer::ExternalRefCountData > | sharedRefcount | |
![]() | ||
QObject * | q_ptr | |
QObject * | parent | |
QObjectList | children | |
uint | isWidget: 1 | |
uint | blockSig: 1 | |
uint | wasDeleted: 1 | |
uint | isDeletingChildren: 1 | |
uint | sendChildEvents: 1 | |
uint | receiveChildEvents: 1 | |
uint | isWindow: 1 | |
uint | deleteLaterCalled: 1 | |
uint | isQuickItem: 1 | |
uint | willBeWidget: 1 | |
uint | wasWidget: 1 | |
uint | unused: 21 | |
QAtomicInt | postedEvents | |
QDynamicMetaObjectData * | metaObject | |
QBindingStorage | bindingStorage | |
Additional Inherited Members | |
![]() | |
typedef void(* | StaticMetaCallFunction) (QObject *, QMetaObject::Call, int, void **) |
using | ConnectionDataPointer = QExplicitlySharedDataPointer< ConnectionData > |
Mutually-exclusive group of checkable buttons.
\qmltype ButtonGroup \inherits QtObject
! \instantiates QQuickButtonGroup \inqmlmodule QtQuick.Controls
ButtonGroup is a non-visual, mutually exclusive group of buttons. It is used with controls such as RadioButton, where only one of the options can be selected at a time.
The most straight-forward way to use ButtonGroup is to assign a list of buttons. For example, the list of children of a \l{Item Positioners}{positioner} or a \l{Qt Quick Layouts}{layout} that manages a group of mutually exclusive buttons.
Mutually exclusive buttons do not always share the same parent item, or the parent layout may sometimes contain items that should not be included in the button group. Such cases are best handled using the \l group attached property.
More advanced use cases can be handled using the addButton()
and removeButton()
methods.
\qmlsignal QtQuick.Controls::ButtonGroup::clicked(AbstractButton button)
This signal is emitted when a button in the group has been clicked.
This signal is convenient for implementing a common signal handler for all buttons in the same group.
Definition at line 119 of file qquickbuttongroup.cpp.
void QQuickButtonGroupPrivate::_q_updateCurrent | ( | ) |
Definition at line 167 of file qquickbuttongroup.cpp.
References button, buttons, checkedButton, QListSpecialMethodsBase< T >::contains(), exclusive, QAbstractButton::isChecked(), and updateCheckState().
Referenced by QQuickButtonGroup::addButton(), clear(), and QQuickButtonGroup::removeButton().
void QQuickButtonGroupPrivate::buttonClicked | ( | ) |
Definition at line 159 of file qquickbuttongroup.cpp.
Referenced by QQuickButtonGroup::addButton(), clear(), and QQuickButtonGroup::removeButton().
|
static |
Definition at line 205 of file qquickbuttongroup.cpp.
References QQuickButtonGroup::addButton(), and QQmlListProperty< T >::object.
|
static |
Definition at line 217 of file qquickbuttongroup.cpp.
References buttons, QQmlListProperty< T >::data, and QList< T >::value().
|
static |
Definition at line 223 of file qquickbuttongroup.cpp.
References clear(), QQmlListProperty< T >::data, emit, QMetaObject::invokeMethod(), QQmlListProperty< T >::object, and Qt::QueuedConnection.
|
static |
Definition at line 211 of file qquickbuttongroup.cpp.
References buttons, QQmlListProperty< T >::data, and QList< T >::size().
void QQuickButtonGroupPrivate::clear | ( | ) |
Definition at line 143 of file qquickbuttongroup.cpp.
References _q_updateCurrent(), button, buttonClicked(), buttons, QQuickAbstractButton::checkedChanged(), QList< T >::clear(), QQuickAbstractButton::clicked(), QObjectPrivate::disconnect(), QQuickAbstractButtonPrivate::get(), and QQuickAbstractButtonPrivate::group.
Referenced by buttons_clear().
void QQuickButtonGroupPrivate::setCheckState | ( | Qt::CheckState | state | ) |
Definition at line 195 of file qquickbuttongroup.cpp.
References checkState, emit, and state.
Referenced by updateCheckState().
void QQuickButtonGroupPrivate::updateCheckState | ( | ) |
Definition at line 180 of file qquickbuttongroup.cpp.
References button, buttons, complete, QAbstractButton::isChecked(), QList< T >::isEmpty(), setCheckState(), and settingCheckState.
Referenced by _q_updateCurrent().
QList<QQuickAbstractButton*> QQuickButtonGroupPrivate::buttons |
Definition at line 140 of file qquickbuttongroup.cpp.
Referenced by _q_updateCurrent(), buttons_at(), buttons_count(), clear(), and updateCheckState().
QPointer<QQuickAbstractButton> QQuickButtonGroupPrivate::checkedButton |
Definition at line 139 of file qquickbuttongroup.cpp.
Referenced by _q_updateCurrent().
Qt::CheckState QQuickButtonGroupPrivate::checkState = Qt::Unchecked |
Definition at line 138 of file qquickbuttongroup.cpp.
Referenced by setCheckState().
bool QQuickButtonGroupPrivate::complete = true |
Definition at line 135 of file qquickbuttongroup.cpp.
Referenced by updateCheckState().
bool QQuickButtonGroupPrivate::exclusive = true |
Definition at line 136 of file qquickbuttongroup.cpp.
Referenced by _q_updateCurrent().
bool QQuickButtonGroupPrivate::settingCheckState = false |
Definition at line 137 of file qquickbuttongroup.cpp.
Referenced by updateCheckState().