[][src]Struct qt_widgets::QActionGroup

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

The QActionGroup class groups actions together.

C++ class: QActionGroup.

C++ documentation:

The QActionGroup class groups actions together.

In some situations it is useful to group QAction objects together. For example, if you have a Left Align action, a Right Align action, a Justify action, and a Center action, only one of these actions should be active at any one time. One simple way of achieving this is to group the actions together in an action group.

Here's a example (from the Menus example):

alignmentGroup = new QActionGroup(this); alignmentGroup->addAction(leftAlignAct); alignmentGroup->addAction(rightAlignAct); alignmentGroup->addAction(justifyAct); alignmentGroup->addAction(centerAct); leftAlignAct->setChecked(true);

Here we create a new action group. Since the action group is exclusive by default, only one of the actions in the group is checked at any one time.

Alignment options in a QMenu

A QActionGroup emits an triggered() signal when one of its actions is chosen. Each action in an action group emits its triggered() signal as usual.

As stated above, an action group is exclusive by default; it ensures that only one checkable action is active at any one time. If you want to group checkable actions without making them exclusive, you can turn of exclusiveness by calling setExclusive(false).

Actions can be added to an action group using addAction(), but it is usually more convenient to specify a group when creating actions; this ensures that actions are automatically created with a parent. Actions can be visually separated from each other by adding a separator action to the group; create an action and use QAction's setSeparator() function to make it considered a separator. Action groups are added to widgets with the QWidget::addActions() function.

Methods

impl QActionGroup[src]

pub fn slot_set_enabled(&self) -> Receiver<(bool,)>[src]

This property holds whether the action group is enabled

Returns a built-in Qt slot QActionGroup::setEnabled that can be passed to qt_core::Signal::connect.

C++ documentation:

This property holds whether the action group is enabled

Each action in the group will be enabled or disabled unless it has been explicitly disabled.

Access functions:

bool isEnabled() const
void setEnabled(bool)

See also QAction::setEnabled().

pub fn slot_set_disabled(&self) -> Receiver<(bool,)>[src]

This is a convenience function for the enabled property, that is useful for signals--slots connections. If b is true the action group is disabled; otherwise it is enabled.

Returns a built-in Qt slot QActionGroup::setDisabled that can be passed to qt_core::Signal::connect.

C++ documentation:

This is a convenience function for the enabled property, that is useful for signals--slots connections. If b is true the action group is disabled; otherwise it is enabled.

pub fn slot_set_visible(&self) -> Receiver<(bool,)>[src]

This property holds whether the action group is visible

Returns a built-in Qt slot QActionGroup::setVisible that can be passed to qt_core::Signal::connect.

C++ documentation:

This property holds whether the action group is visible

Each action in the action group will match the visible state of this group unless it has been explicitly hidden.

Access functions:

bool isVisible() const
void setVisible(bool)

See also QAction::setEnabled().

pub fn slot_set_exclusive(&self) -> Receiver<(bool,)>[src]

This property holds whether the action group does exclusive checking

Returns a built-in Qt slot QActionGroup::setExclusive that can be passed to qt_core::Signal::connect.

C++ documentation:

This property holds whether the action group does exclusive checking

If exclusive is true, only one checkable action in the action group can ever be active at any time. If the user chooses another checkable action in the group, the one they chose becomes active and the one that was active becomes inactive.

Access functions:

bool isExclusive() const
void setExclusive(bool)

See also QAction::checkable.

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

This signal is emitted when the given action in the action group is activated by the user; for example, when the user clicks a menu option, toolbar button, or presses an action's shortcut key combination.

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

C++ documentation:

This signal is emitted when the given action in the action group is activated by the user; for example, when the user clicks a menu option, toolbar button, or presses an action's shortcut key combination.

Connect to this signal for command actions.

See also QAction::activate().

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

This signal is emitted when the given action in the action group is highlighted by the user; for example, when the user pauses with the cursor over a menu option, toolbar button, or presses an action's shortcut key combination.

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

C++ documentation:

This signal is emitted when the given action in the action group is highlighted by the user; for example, when the user pauses with the cursor over a menu option, toolbar button, or presses an action's shortcut key combination.

See also QAction::activate().

pub unsafe fn actions(&self) -> CppBox<QListOfQAction>[src]

Returns the list of this groups's actions. This may be empty.

Calls C++ function: QList<QAction*> QActionGroup::actions() const.

C++ documentation:

Returns the list of this groups's actions. This may be empty.

pub unsafe fn add_action_q_action(
    &mut self,
    a: impl CastInto<MutPtr<QAction>>
) -> MutPtr<QAction>
[src]

Adds the action to this group, and returns it.

Calls C++ function: QAction* QActionGroup::addAction(QAction* a).

C++ documentation:

Adds the action to this group, and returns it.

Normally an action is added to a group by creating it with the group as its parent, so this function is not usually used.

See also QAction::setActionGroup().

pub unsafe fn add_action_q_string(
    &mut self,
    text: impl CastInto<Ref<QString>>
) -> MutPtr<QAction>
[src]

Creates and returns an action with text. The newly created action is a child of this action group.

Calls C++ function: QAction* QActionGroup::addAction(const QString& text).

C++ documentation:

Creates and returns an action with text. The newly created action is a child of this action group.

Normally an action is added to a group by creating it with the group as parent, so this function is not usually used.

See also QAction::setActionGroup().

pub unsafe fn add_action_q_icon_q_string(
    &mut self,
    icon: impl CastInto<Ref<QIcon>>,
    text: impl CastInto<Ref<QString>>
) -> MutPtr<QAction>
[src]

Creates and returns an action with text and an icon. The newly created action is a child of this action group.

Calls C++ function: QAction* QActionGroup::addAction(const QIcon& icon, const QString& text).

C++ documentation:

Creates and returns an action with text and an icon. The newly created action is a child of this action group.

Normally an action is added to a group by creating it with the group as its parent, so this function is not usually used.

See also QAction::setActionGroup().

pub unsafe fn checked_action(&self) -> MutPtr<QAction>[src]

Returns the currently checked action in the group, or 0 if none are checked.

Calls C++ function: QAction* QActionGroup::checkedAction() const.

C++ documentation:

Returns the currently checked action in the group, or 0 if none are checked.

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

This property holds whether the action group is enabled

Calls C++ function: bool QActionGroup::isEnabled() const.

C++ documentation:

This property holds whether the action group is enabled

Each action in the group will be enabled or disabled unless it has been explicitly disabled.

Access functions:

bool isEnabled() const
void setEnabled(bool)

See also QAction::setEnabled().

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

This property holds whether the action group does exclusive checking

Calls C++ function: bool QActionGroup::isExclusive() const.

C++ documentation:

This property holds whether the action group does exclusive checking

If exclusive is true, only one checkable action in the action group can ever be active at any time. If the user chooses another checkable action in the group, the one they chose becomes active and the one that was active becomes inactive.

Access functions:

bool isExclusive() const
void setExclusive(bool)

See also QAction::checkable.

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

This property holds whether the action group is visible

Calls C++ function: bool QActionGroup::isVisible() const.

C++ documentation:

This property holds whether the action group is visible

Each action in the action group will match the visible state of this group unless it has been explicitly hidden.

Access functions:

bool isVisible() const
void setVisible(bool)

See also QAction::setEnabled().

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

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

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

Constructs an action group for the parent object.

Calls C++ function: [constructor] void QActionGroup::QActionGroup(QObject* parent).

C++ documentation:

Constructs an action group for the parent object.

The action group is exclusive by default. Call setExclusive(false) to make the action group non-exclusive.

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 QActionGroup::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* QActionGroup::qt_metacast(const char* arg1).

pub unsafe fn remove_action(&mut self, a: impl CastInto<MutPtr<QAction>>)[src]

Removes the action from this group. The action will have no parent as a result.

Calls C++ function: void QActionGroup::removeAction(QAction* a).

C++ documentation:

Removes the action from this group. The action will have no parent as a result.

See also QAction::setActionGroup().

pub unsafe fn set_disabled(&mut self, b: bool)[src]

This is a convenience function for the enabled property, that is useful for signals--slots connections. If b is true the action group is disabled; otherwise it is enabled.

Calls C++ function: [slot] void QActionGroup::setDisabled(bool b).

C++ documentation:

This is a convenience function for the enabled property, that is useful for signals--slots connections. If b is true the action group is disabled; otherwise it is enabled.

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

This property holds whether the action group is enabled

Calls C++ function: [slot] void QActionGroup::setEnabled(bool arg1).

C++ documentation:

This property holds whether the action group is enabled

Each action in the group will be enabled or disabled unless it has been explicitly disabled.

Access functions:

bool isEnabled() const
void setEnabled(bool)

See also QAction::setEnabled().

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

This property holds whether the action group does exclusive checking

Calls C++ function: [slot] void QActionGroup::setExclusive(bool arg1).

C++ documentation:

This property holds whether the action group does exclusive checking

If exclusive is true, only one checkable action in the action group can ever be active at any time. If the user chooses another checkable action in the group, the one they chose becomes active and the one that was active becomes inactive.

Access functions:

bool isExclusive() const
void setExclusive(bool)

See also QAction::checkable.

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

This property holds whether the action group is visible

Calls C++ function: [slot] void QActionGroup::setVisible(bool arg1).

C++ documentation:

This property holds whether the action group is visible

Each action in the action group will match the visible state of this group unless it has been explicitly hidden.

Access functions:

bool isVisible() const
void setVisible(bool)

See also QAction::setEnabled().

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 QActionGroup::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 QActionGroup::trUtf8(const char* s, const char* c, int n).

Trait Implementations

impl Deref for QActionGroup[src]

type Target = QObject

The resulting type after dereferencing.

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

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

impl DerefMut for QActionGroup[src]

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

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

impl StaticUpcast<QObject> for QActionGroup[src]

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

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

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

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

impl StaticDowncast<QActionGroup> for QObject[src]

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

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

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

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

impl DynamicCast<QActionGroup> for QObject[src]

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

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

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

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

impl CppDeletable for QActionGroup[src]

unsafe fn delete(&mut self)[src]

Destroys the action group.

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

C++ documentation:

Destroys the action group.

Auto Trait Implementations

Blanket Implementations

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

impl<T, U> Into<U> for T where
    U: From<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.

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

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

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

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

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