[][src]Struct qt_widgets::QButtonGroup

#[repr(C)]
pub struct QButtonGroup { /* fields omitted */ }

The QButtonGroup class provides a container to organize groups of button widgets.

C++ class: QButtonGroup.

C++ documentation:

The QButtonGroup class provides a container to organize groups of button widgets.

QButtonGroup provides an abstract container into which button widgets can be placed. It does not provide a visual representation of this container (see QGroupBox for a container widget), but instead manages the states of each of the buttons in the group.

An exclusive button group switches off all checkable (toggle) buttons except the one that has been clicked. By default, a button group is exclusive. The buttons in a button group are usually checkable QPushButtons, QCheckBoxes (normally for non-exclusive button groups), or QRadioButtons. If you create an exclusive button group, you should ensure that one of the buttons in the group is initially checked; otherwise, the group will initially be in a state where no buttons are checked.

A button can be added to the group with addButton() and removed with removeButton(). If the group is exclusive, the currently checked button is available with checkedButton(). If a button is clicked, the buttonClicked() signal is emitted; for a checkable button in an exclusive group this means that the button has been checked. The list of buttons in the group is returned by buttons().

In addition, QButtonGroup can map between integers and buttons. You can assign an integer id to a button with setId(), and retrieve it with id(). The id of the currently checked button is available with checkedId(), and there is an overloaded signal buttonClicked() which emits the id of the button. The id -1 is reserved by QButtonGroup to mean "no such button". The purpose of the mapping mechanism is to simplify the representation of enum values in a user interface.

Methods

impl QButtonGroup[src]

pub fn button_clicked(&self) -> Signal<(*mut QAbstractButton,)>[src]

This signal is emitted when the given button is clicked. A button is clicked when it is first pressed and then released, when its shortcut key is typed, or when QAbstractButton::click() or QAbstractButton::animateClick() is programmatically called.

Returns a built-in Qt signal QButtonGroup::buttonClicked that can be passed to qt_core::Signal::connect.

C++ documentation:

This signal is emitted when the given button is clicked. A button is clicked when it is first pressed and then released, when its shortcut key is typed, or when QAbstractButton::click() or QAbstractButton::animateClick() is programmatically called.

Note: Signal buttonClicked is overloaded in this class. To connect to this one using the function pointer syntax, you must specify the signal type in a static cast, as shown in this example:

connect(buttonGroup, static_cast<void(QButtonGroup::)(QAbstractButton )>(&QButtonGroup::buttonClicked), [=](QAbstractButton button){ / ... */ });

See also checkedButton() and QAbstractButton::clicked().

pub fn button_clicked2(&self) -> Signal<(c_int,)>[src]

This signal is emitted when a button with the given id is clicked.

Returns a built-in Qt signal QButtonGroup::buttonClicked that can be passed to qt_core::Signal::connect.

C++ documentation:

This signal is emitted when a button with the given id is clicked.

Note: Signal buttonClicked is overloaded in this class. To connect to this one using the function pointer syntax, you must specify the signal type in a static cast, as shown in this example:

connect(buttonGroup, static_cast<void(QButtonGroup::)(int)>(&QButtonGroup::buttonClicked), [=](int id){ / ... */ });

See also checkedButton() and QAbstractButton::clicked().

pub fn button_pressed(&self) -> Signal<(*mut QAbstractButton,)>[src]

This signal is emitted when the given button is pressed down.

Returns a built-in Qt signal QButtonGroup::buttonPressed that can be passed to qt_core::Signal::connect.

C++ documentation:

This signal is emitted when the given button is pressed down.

Note: Signal buttonPressed is overloaded in this class. To connect to this one using the function pointer syntax, you must specify the signal type in a static cast, as shown in this example:

connect(buttonGroup, static_cast<void(QButtonGroup::)(QAbstractButton )>(&QButtonGroup::buttonPressed), [=](QAbstractButton button){ / ... */ });

This function was introduced in Qt 4.2.

See also QAbstractButton::pressed().

pub fn button_pressed2(&self) -> Signal<(c_int,)>[src]

This signal is emitted when a button with the given id is pressed down.

Returns a built-in Qt signal QButtonGroup::buttonPressed that can be passed to qt_core::Signal::connect.

C++ documentation:

This signal is emitted when a button with the given id is pressed down.

Note: Signal buttonPressed is overloaded in this class. To connect to this one using the function pointer syntax, you must specify the signal type in a static cast, as shown in this example:

connect(buttonGroup, static_cast<void(QButtonGroup::)(int)>(&QButtonGroup::buttonPressed), [=](int id){ / ... */ });

This function was introduced in Qt 4.2.

See also QAbstractButton::pressed().

pub fn button_released(&self) -> Signal<(*mut QAbstractButton,)>[src]

This signal is emitted when the given button is released.

Returns a built-in Qt signal QButtonGroup::buttonReleased that can be passed to qt_core::Signal::connect.

C++ documentation:

This signal is emitted when the given button is released.

Note: Signal buttonReleased is overloaded in this class. To connect to this one using the function pointer syntax, you must specify the signal type in a static cast, as shown in this example:

connect(buttonGroup, static_cast<void(QButtonGroup::)(QAbstractButton )>(&QButtonGroup::buttonReleased), [=](QAbstractButton button){ / ... */ });

This function was introduced in Qt 4.2.

See also QAbstractButton::released().

pub fn button_released2(&self) -> Signal<(c_int,)>[src]

This signal is emitted when a button with the given id is released.

Returns a built-in Qt signal QButtonGroup::buttonReleased that can be passed to qt_core::Signal::connect.

C++ documentation:

This signal is emitted when a button with the given id is released.

Note: Signal buttonReleased is overloaded in this class. To connect to this one using the function pointer syntax, you must specify the signal type in a static cast, as shown in this example:

connect(buttonGroup, static_cast<void(QButtonGroup::)(int)>(&QButtonGroup::buttonReleased), [=](int id){ / ... */ });

This function was introduced in Qt 4.2.

See also QAbstractButton::released().

pub fn button_toggled(&self) -> Signal<(*mut QAbstractButton, bool)>[src]

This signal is emitted when the given button is toggled. checked is true if the button is checked, or false if the button is unchecked.

Returns a built-in Qt signal QButtonGroup::buttonToggled that can be passed to qt_core::Signal::connect.

C++ documentation:

This signal is emitted when the given button is toggled. checked is true if the button is checked, or false if the button is unchecked.

Note: Signal buttonToggled is overloaded in this class. To connect to this one using the function pointer syntax, you must specify the signal type in a static cast, as shown in this example:

connect(buttonGroup, static_cast<void(QButtonGroup::)(QAbstractButton , bool)>(&QButtonGroup::buttonToggled), [=](QAbstractButton button, bool checked){ / ... */ });

This function was introduced in Qt 5.2.

See also QAbstractButton::toggled().

pub fn button_toggled2(&self) -> Signal<(c_int, bool)>[src]

This signal is emitted when a button with the given id is toggled. checked is true if the button is checked, or false if the button is unchecked.

Returns a built-in Qt signal QButtonGroup::buttonToggled that can be passed to qt_core::Signal::connect.

C++ documentation:

This signal is emitted when a button with the given id is toggled. checked is true if the button is checked, or false if the button is unchecked.

Note: Signal buttonToggled is overloaded in this class. To connect to this one using the function pointer syntax, you must specify the signal type in a static cast, as shown in this example:

connect(buttonGroup, static_cast<void(QButtonGroup::)(int, bool)>(&QButtonGroup::buttonToggled), [=](int id, bool checked){ / ... */ });

This function was introduced in Qt 5.2.

See also QAbstractButton::toggled().

pub unsafe fn add_button_2a(
    &mut self,
    arg1: impl CastInto<MutPtr<QAbstractButton>>,
    id: c_int
)
[src]

Adds the given button to the button group. If id is -1, an id will be assigned to the button. Automatically assigned ids are guaranteed to be negative, starting with -2. If you are assigning your own ids, use positive values to avoid conflicts.

Calls C++ function: void QButtonGroup::addButton(QAbstractButton* arg1, int id = …).

C++ documentation:

Adds the given button to the button group. If id is -1, an id will be assigned to the button. Automatically assigned ids are guaranteed to be negative, starting with -2. If you are assigning your own ids, use positive values to avoid conflicts.

See also removeButton() and buttons().

pub unsafe fn add_button_1a(
    &mut self,
    arg1: impl CastInto<MutPtr<QAbstractButton>>
)
[src]

Adds the given button to the button group. If id is -1, an id will be assigned to the button. Automatically assigned ids are guaranteed to be negative, starting with -2. If you are assigning your own ids, use positive values to avoid conflicts.

Calls C++ function: void QButtonGroup::addButton(QAbstractButton* arg1).

C++ documentation:

Adds the given button to the button group. If id is -1, an id will be assigned to the button. Automatically assigned ids are guaranteed to be negative, starting with -2. If you are assigning your own ids, use positive values to avoid conflicts.

See also removeButton() and buttons().

pub unsafe fn button(&self, id: c_int) -> MutPtr<QAbstractButton>[src]

Returns the button with the specified id, or 0 if no such button exists.

Calls C++ function: QAbstractButton* QButtonGroup::button(int id) const.

C++ documentation:

Returns the button with the specified id, or 0 if no such button exists.

This function was introduced in Qt 4.1.

pub unsafe fn buttons(&self) -> CppBox<QListOfQAbstractButton>[src]

Returns the button group's list of buttons. This may be empty.

Calls C++ function: QList<QAbstractButton*> QButtonGroup::buttons() const.

C++ documentation:

Returns the button group's list of buttons. This may be empty.

See also addButton() and removeButton().

pub unsafe fn checked_button(&self) -> MutPtr<QAbstractButton>[src]

Returns the button group's checked button, or 0 if no buttons are checked.

Calls C++ function: QAbstractButton* QButtonGroup::checkedButton() const.

C++ documentation:

Returns the button group's checked button, or 0 if no buttons are checked.

See also buttonClicked().

pub unsafe fn checked_id(&self) -> c_int[src]

Returns the id of the checkedButton(), or -1 if no button is checked.

Calls C++ function: int QButtonGroup::checkedId() const.

C++ documentation:

Returns the id of the checkedButton(), or -1 if no button is checked.

This function was introduced in Qt 4.1.

See also setId().

pub unsafe fn exclusive(&self) -> bool[src]

This property holds whether the button group is exclusive

Calls C++ function: bool QButtonGroup::exclusive() const.

C++ documentation:

This property holds whether the button group is exclusive

If this property is true, then only one button in the group can be checked at any given time. The user can click on any button to check it, and that button will replace the existing one as the checked button in the group.

In an exclusive group, the user cannot uncheck the currently checked button by clicking on it; instead, another button in the group must be clicked to set the new checked button for that group.

By default, this property is true.

Access functions:

bool exclusive() const
void setExclusive(bool)

pub unsafe fn id(&self, button: impl CastInto<MutPtr<QAbstractButton>>) -> c_int[src]

Returns the id for the specified button, or -1 if no such button exists.

Calls C++ function: int QButtonGroup::id(QAbstractButton* button) const.

C++ documentation:

Returns the id for the specified button, or -1 if no such button exists.

This function was introduced in Qt 4.1.

See also setId().

pub unsafe fn meta_object(&self) -> Ptr<QMetaObject>[src]

Calls C++ function: virtual const QMetaObject* QButtonGroup::metaObject() const.

pub unsafe fn new_1a(
    parent: impl CastInto<MutPtr<QObject>>
) -> CppBox<QButtonGroup>
[src]

Constructs a new, empty button group with the given parent.

Calls C++ function: [constructor] void QButtonGroup::QButtonGroup(QObject* parent = …).

C++ documentation:

Constructs a new, empty button group with the given parent.

See also addButton() and setExclusive().

pub unsafe fn new_0a() -> CppBox<QButtonGroup>[src]

The QButtonGroup class provides a container to organize groups of button widgets.

Calls C++ function: [constructor] void QButtonGroup::QButtonGroup().

C++ documentation:

The QButtonGroup class provides a container to organize groups of button widgets.

QButtonGroup provides an abstract container into which button widgets can be placed. It does not provide a visual representation of this container (see QGroupBox for a container widget), but instead manages the states of each of the buttons in the group.

An exclusive button group switches off all checkable (toggle) buttons except the one that has been clicked. By default, a button group is exclusive. The buttons in a button group are usually checkable QPushButtons, QCheckBoxes (normally for non-exclusive button groups), or QRadioButtons. If you create an exclusive button group, you should ensure that one of the buttons in the group is initially checked; otherwise, the group will initially be in a state where no buttons are checked.

A button can be added to the group with addButton() and removed with removeButton(). If the group is exclusive, the currently checked button is available with checkedButton(). If a button is clicked, the buttonClicked() signal is emitted; for a checkable button in an exclusive group this means that the button has been checked. The list of buttons in the group is returned by buttons().

In addition, QButtonGroup can map between integers and buttons. You can assign an integer id to a button with setId(), and retrieve it with id(). The id of the currently checked button is available with checkedId(), and there is an overloaded signal buttonClicked() which emits the id of the button. The id -1 is reserved by QButtonGroup to mean "no such button". The purpose of the mapping mechanism is to simplify the representation of enum values in a user interface.

pub unsafe fn qt_metacall(
    &mut self,
    arg1: Call,
    arg2: c_int,
    arg3: impl CastInto<MutPtr<*mut c_void>>
) -> c_int
[src]

Calls C++ function: virtual int QButtonGroup::qt_metacall(QMetaObject::Call arg1, int arg2, void** arg3).

pub unsafe fn qt_metacast(
    &mut self,
    arg1: impl CastInto<Ptr<c_char>>
) -> MutPtr<c_void>
[src]

Calls C++ function: virtual void* QButtonGroup::qt_metacast(const char* arg1).

pub unsafe fn remove_button(
    &mut self,
    arg1: impl CastInto<MutPtr<QAbstractButton>>
)
[src]

Removes the given button from the button group.

Calls C++ function: void QButtonGroup::removeButton(QAbstractButton* arg1).

C++ documentation:

Removes the given button from the button group.

See also addButton() and buttons().

pub unsafe fn set_exclusive(&mut self, arg1: bool)[src]

This property holds whether the button group is exclusive

Calls C++ function: void QButtonGroup::setExclusive(bool arg1).

C++ documentation:

This property holds whether the button group is exclusive

If this property is true, then only one button in the group can be checked at any given time. The user can click on any button to check it, and that button will replace the existing one as the checked button in the group.

In an exclusive group, the user cannot uncheck the currently checked button by clicking on it; instead, another button in the group must be clicked to set the new checked button for that group.

By default, this property is true.

Access functions:

bool exclusive() const
void setExclusive(bool)

pub unsafe fn set_id(
    &mut self,
    button: impl CastInto<MutPtr<QAbstractButton>>,
    id: c_int
)
[src]

Sets the id for the specified button. Note that id cannot be -1.

Calls C++ function: void QButtonGroup::setId(QAbstractButton* button, int id).

C++ documentation:

Sets the id for the specified button. Note that id cannot be -1.

This function was introduced in Qt 4.1.

See also id().

pub unsafe fn static_meta_object() -> Ref<QMetaObject>[src]

Returns a reference to the staticMetaObject field.

pub unsafe fn tr(
    s: impl CastInto<Ptr<c_char>>,
    c: impl CastInto<Ptr<c_char>>,
    n: c_int
) -> CppBox<QString>
[src]

Calls C++ function: static QString QButtonGroup::tr(const char* s, const char* c, int n).

pub unsafe fn tr_utf8(
    s: impl CastInto<Ptr<c_char>>,
    c: impl CastInto<Ptr<c_char>>,
    n: c_int
) -> CppBox<QString>
[src]

Calls C++ function: static QString QButtonGroup::trUtf8(const char* s, const char* c, int n).

Trait Implementations

impl CppDeletable for QButtonGroup[src]

unsafe fn delete(&mut self)[src]

Destroys the button group.

Calls C++ function: virtual [destructor] void QButtonGroup::~QButtonGroup().

C++ documentation:

Destroys the button group.

impl Deref for QButtonGroup[src]

type Target = QObject

The resulting type after dereferencing.

fn deref(&self) -> &QObject[src]

Calls C++ function: QObject* static_cast<QObject*>(QButtonGroup* ptr).

impl DerefMut for QButtonGroup[src]

fn deref_mut(&mut self) -> &mut QObject[src]

Calls C++ function: QObject* static_cast<QObject*>(QButtonGroup* ptr).

impl DynamicCast<QButtonGroup> for QObject[src]

unsafe fn dynamic_cast(ptr: Ptr<QObject>) -> Ptr<QButtonGroup>[src]

Calls C++ function: QButtonGroup* dynamic_cast<QButtonGroup*>(QObject* ptr).

unsafe fn dynamic_cast_mut(ptr: MutPtr<QObject>) -> MutPtr<QButtonGroup>[src]

Calls C++ function: QButtonGroup* dynamic_cast<QButtonGroup*>(QObject* ptr).

impl StaticDowncast<QButtonGroup> for QObject[src]

unsafe fn static_downcast(ptr: Ptr<QObject>) -> Ptr<QButtonGroup>[src]

Calls C++ function: QButtonGroup* static_cast<QButtonGroup*>(QObject* ptr).

unsafe fn static_downcast_mut(ptr: MutPtr<QObject>) -> MutPtr<QButtonGroup>[src]

Calls C++ function: QButtonGroup* static_cast<QButtonGroup*>(QObject* ptr).

impl StaticUpcast<QObject> for QButtonGroup[src]

unsafe fn static_upcast(ptr: Ptr<QButtonGroup>) -> Ptr<QObject>[src]

Calls C++ function: QObject* static_cast<QObject*>(QButtonGroup* ptr).

unsafe fn static_upcast_mut(ptr: MutPtr<QButtonGroup>) -> MutPtr<QObject>[src]

Calls C++ function: QObject* static_cast<QObject*>(QButtonGroup* ptr).

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> CastInto<U> for T where
    U: CastFrom<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> StaticUpcast<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.