Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QQuickButtonGroupPrivate Class Reference

Mutually-exclusive group of checkable buttons. More...

+ Inheritance diagram for QQuickButtonGroupPrivate:
+ Collaboration diagram for QQuickButtonGroupPrivate:

Public Member Functions

void clear ()
 
void buttonClicked ()
 
void _q_updateCurrent ()
 
void updateCheckState ()
 
void setCheckState (Qt::CheckState state)
 
- Public Member Functions inherited from QObjectPrivate
void ensureExtraData ()
 
 QObjectPrivate (int version=QObjectPrivateVersion)
 
virtual ~QObjectPrivate ()
 
void deleteChildren ()
 
void clearBindingStorage ()
 
void checkForIncompatibleLibraryVersion (int version) const
 
void setParent_helper (QObject *)
 
void moveToThread_helper ()
 
void setThreadData_helper (QThreadData *currentData, QThreadData *targetData, QBindingStatus *status)
 
QObjectList receiverList (const char *signal) const
 
void ensureConnectionData ()
 
void addConnection (int signal, Connection *c)
 
int signalIndex (const char *signalName, const QMetaObject **meta=nullptr) const
 
bool isSignalConnected (uint signalIdx, bool checkDeclarative=true) const
 
bool maybeSignalConnected (uint signalIndex) const
 
bool isDeclarativeSignalConnected (uint signalIdx) const
 
void connectNotify (const QMetaMethod &signal)
 
void disconnectNotify (const QMetaMethod &signal)
 
void reinitBindingStorageAfterThreadMove ()
 
virtual std::string flagsForDumping () const
 
virtual void writeToDebugStream (QDebug &) const
 
QtPrivate::QPropertyAdaptorSlotObjectgetPropertyAdaptorSlotObject (const QMetaProperty &property)
 
- Public Member Functions inherited from QObjectData
 QObjectData ()=default
 
virtual ~QObjectData ()=0
 
QMetaObjectdynamicMetaObject () const
 

Static Public Member Functions

static void buttons_append (QQmlListProperty< QQuickAbstractButton > *prop, QQuickAbstractButton *obj)
 
static qsizetype buttons_count (QQmlListProperty< QQuickAbstractButton > *prop)
 
static QQuickAbstractButtonbuttons_at (QQmlListProperty< QQuickAbstractButton > *prop, qsizetype index)
 
static void buttons_clear (QQmlListProperty< QQuickAbstractButton > *prop)
 
- Static Public Member Functions inherited from QObjectPrivate
static bool removeConnection (Connection *c)
 
static QObjectPrivateget (QObject *o)
 
static const QObjectPrivateget (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< QQuickAbstractButtoncheckedButton
 
QList< QQuickAbstractButton * > buttons
 
- Public Attributes inherited from QObjectPrivate
ExtraDataextraData
 
QAtomicPointer< QThreadDatathreadData
 
QAtomicPointer< ConnectionDataconnections
 
union { 
 
   QObject *   currentChildBeingDeleted 
 
   QAbstractDeclarativeData *   declarativeData 
 
};  
 
QAtomicPointer< QtSharedPointer::ExternalRefCountDatasharedRefcount
 
- Public Attributes inherited from QObjectData
QObjectq_ptr
 
QObjectparent
 
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 receiveParentEvents: 1
 
uint unused: 20
 
QAtomicInt postedEvents
 
QDynamicMetaObjectDatametaObject
 
QBindingStorage bindingStorage
 

Additional Inherited Members

- Public Types inherited from QObjectPrivate
typedef void(* StaticMetaCallFunction) (QObject *, QMetaObject::Call, int, void **)
 
using ConnectionDataPointer = QExplicitlySharedDataPointer<ConnectionData>
 

Detailed Description

Mutually-exclusive group of checkable buttons.

\qmltype ButtonGroup
\inherits QtObject

! \instantiates QQuickButtonGroup \inqmlmodule QtQuick.Controls

Since
5.7

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.

ButtonGroup {
buttons: column.children
}
Column {
RadioButton {
checked: true
text: qsTr("DAB")
}
RadioButton {
text: qsTr("FM")
}
RadioButton {
text: qsTr("AM")
}
}
QList< QQuickAbstractButton * > buttons
QString text
GLenum GLuint id
[7]
GLenum GLenum GLsizei void GLsizei void * column

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.

ButtonGroup { id: radioGroup }
Column {
Label {
text: qsTr("Radio:")
}
RadioButton {
checked: true
text: qsTr("DAB")
ButtonGroup.group: radioGroup
}
RadioButton {
text: qsTr("FM")
ButtonGroup.group: radioGroup
}
RadioButton {
text: qsTr("AM")
ButtonGroup.group: radioGroup
}
}
GLboolean GLuint group

More advanced use cases can be handled using the addButton() and removeButton() methods.

See also
RadioButton, {Button Controls}

\qmlsignal QtQuick.Controls::ButtonGroup::clicked(AbstractButton button)

Since
QtQuick.Controls 2.1 (Qt 5.8)

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.

ButtonGroup {
buttons: column.children
onClicked: console.log("clicked:", button.text)
}
Column {
Button { text: "First" }
Button { text: "Second" }
Button { text: "Third" }
}
QString text
the text shown on the button
QPushButton * button
[2]
Button
See also
AbstractButton::clicked()

Definition at line 119 of file qquickbuttongroup.cpp.

Member Function Documentation

◆ _q_updateCurrent()

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buttonClicked()

void QQuickButtonGroupPrivate::buttonClicked ( )

Definition at line 159 of file qquickbuttongroup.cpp.

References button, and emit.

Referenced by QQuickButtonGroup::addButton(), clear(), and QQuickButtonGroup::removeButton().

+ Here is the caller graph for this function:

◆ buttons_append()

void QQuickButtonGroupPrivate::buttons_append ( QQmlListProperty< QQuickAbstractButton > * prop,
QQuickAbstractButton * obj )
static

Definition at line 205 of file qquickbuttongroup.cpp.

References QQuickButtonGroup::addButton().

+ Here is the call graph for this function:

◆ buttons_at()

QQuickAbstractButton * QQuickButtonGroupPrivate::buttons_at ( QQmlListProperty< QQuickAbstractButton > * prop,
qsizetype index )
static

Definition at line 217 of file qquickbuttongroup.cpp.

References buttons, and QList< T >::value().

+ Here is the call graph for this function:

◆ buttons_clear()

void QQuickButtonGroupPrivate::buttons_clear ( QQmlListProperty< QQuickAbstractButton > * prop)
static

Definition at line 223 of file qquickbuttongroup.cpp.

References clear(), emit, QMetaObject::invokeMethod(), and Qt::QueuedConnection.

+ Here is the call graph for this function:

◆ buttons_count()

qsizetype QQuickButtonGroupPrivate::buttons_count ( QQmlListProperty< QQuickAbstractButton > * prop)
static

Definition at line 211 of file qquickbuttongroup.cpp.

References buttons, and QList< T >::size().

+ Here is the call graph for this function:

◆ clear()

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(), and QQuickAbstractButtonPrivate::get().

Referenced by buttons_clear().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setCheckState()

void QQuickButtonGroupPrivate::setCheckState ( Qt::CheckState state)

Definition at line 195 of file qquickbuttongroup.cpp.

References checkState, emit, and state.

Referenced by updateCheckState().

+ Here is the caller graph for this function:

◆ 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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ buttons

QList<QQuickAbstractButton*> QQuickButtonGroupPrivate::buttons

◆ checkedButton

QPointer<QQuickAbstractButton> QQuickButtonGroupPrivate::checkedButton

Definition at line 139 of file qquickbuttongroup.cpp.

Referenced by _q_updateCurrent().

◆ checkState

Qt::CheckState QQuickButtonGroupPrivate::checkState = Qt::Unchecked

Definition at line 138 of file qquickbuttongroup.cpp.

Referenced by setCheckState().

◆ complete

bool QQuickButtonGroupPrivate::complete = true

Definition at line 135 of file qquickbuttongroup.cpp.

Referenced by updateCheckState().

◆ exclusive

bool QQuickButtonGroupPrivate::exclusive = true

Definition at line 136 of file qquickbuttongroup.cpp.

Referenced by _q_updateCurrent().

◆ settingCheckState

bool QQuickButtonGroupPrivate::settingCheckState = false

Definition at line 137 of file qquickbuttongroup.cpp.

Referenced by updateCheckState().


The documentation for this class was generated from the following file: