QActionGroup(3qt)
π QActionGroup π
okay bestie, welcome to the QActionGroup(3qt) glow-up page β yes it's a man page, no it does not have to be boring π
this is the whole thing, all the details, just... cuter. no cap.
β¨ NAME β¨
QActionGroup β groups actions together π«Ά
πΈ SYNOPSIS πΈ
#include <qaction.h>
Inherits QAction.
π Public Members
QActionGroup ( QObject * parent, const char * name = 0 )QActionGroup ( QObject * parent, const char * name, bool exclusive )~QActionGroup ()void setExclusive ( bool )bool isExclusive () constvoid add ( QAction * action )void addSeparator ()virtual bool addTo ( QWidget * w )void setUsesDropDown ( bool enable )bool usesDropDown () constvoid insert ( QAction * a )β obsolete π
π¦ Signals
void selected ( QAction * )
π Properties
bool exclusiveβ whether the action group does exclusive togglingbool usesDropDownβ whether the group's actions are displayed in a subwidget of the widgets the action group is added to
π DESCRIPTION π
The QActionGroup class groups actions together. fr fr that's the whole vibe.
Sometimes you literally need to group actions together, bestie. Say you've got a left justify action, a right justify action and a center action β only one of those should be active at any one time, right? And one simple way of achieving this is to group the actions together in an action group. iconic behavior. β¨
An action group can also be added to a menu or a toolbar as a single unit, with all the actions within the action group appearing as separate menu options and toolbar buttons. it's giving β¨group project where everyone actually shows upβ¨.
Here's an example from examples/textedit:
QActionGroup *grp = new QActionGroup( this );
connect( grp, SIGNAL( selected( QAction* ) ), this, SLOT( textAlign( QAction* ) ) );
Here we create a new action group. Since the action group is exclusive by default, only one of the actions in the group is ever active at any one time. We then connect the group's selected() signal to our textAlign() slot. slay. π«Ά
actionAlignLeft = new QAction( QPixmap::fromMimeSource( "textleft.xpm" ), tr( "&Left" ), CTRL + Key_L, grp, "textLeft" );
actionAlignLeft->setToggleAction( TRUE );
We create a left align action, add it to the toolbar and the menu and make it a toggle action. We create center and right align actions in exactly the same way. (copy-paste queens π)
The actions in an action group emit their activated() (and for toggle actions, toggled()) signals as usual.
The setExclusive() function is used to ensure that only one action is active at any one time: it should be used with actions which have their toggleAction set to TRUE. π₯
Action group actions appear as individual menu options and toolbar buttons. For exclusive action groups use setUsesDropDown() to display the actions in a subwidget of any widget the action group is added to. For example, the actions would appear in a combobox in a toolbar or as a submenu in a menu. so versatile, honestly.
Actions can be added to an action group using add(), but normally they are added by creating the action with the action group as parent. Actions can have separators dividing them using addSeparator(). Action groups are added to widgets with addTo().
See also Main Window and Related Classes and Basic Widgets.
π MEMBER FUNCTION DOCUMENTATION π
QActionGroup::QActionGroup ( QObject * parent, const char * name = 0 )
Constructs an action group called name, with parent parent.
The action group is exclusive by default. Call setExclusive(FALSE) to make the action group non-exclusive. (letting it be free, we love that for it π¦)
QActionGroup::QActionGroup ( QObject * parent, const char * name, bool exclusive )
Constructs an action group called name, with parent parent.
If exclusive is TRUE only one toggle action in the group will ever be active.
See also exclusive.
QActionGroup::~QActionGroup ()
Destroys the object and frees allocated resources. clean up, clean up π§Ήβ¨
void QActionGroup::add ( QAction * action )
Adds action action to this group.
Normally an action is added to a group by creating it with the group as parent, so this function is not usually used. (it's the backup plan bestie)
See also addTo().
void QActionGroup::addSeparator ()
Adds a separator to the group. βοΈ tiny lil divider moment
bool QActionGroup::addTo ( QWidget * w ) [virtual]
Adds this action group to the widget w.
If isExclusive() is FALSE or usesDropDown() is FALSE, the actions within the group are added to the widget individually. For example, if the widget is a menu, the actions will appear as individual menu options, and if the widget is a toolbar, the actions will appear as toolbar buttons.
If both isExclusive() and usesDropDown() are TRUE, the actions are presented either in a combobox (if w is a toolbar) or in a submenu (if w is a menu). π₯
β οΈ All actions should be added to the action group before the action group is added to the widget. If actions are added to the action group after the action group has been added to the widget, these later actions will not appear. not me getting ghosted by my own action π»
See also exclusive, usesDropDown, and removeFrom().
Example: themes/themes.cpp.
Reimplemented from QAction.
void QActionGroup::insert ( QAction * a )
π This function is obsolete. It is provided to keep old source working. We strongly advise against using it in new code.
Use add() instead, or better still create the action with the action group as its parent. trust, bestie, the new way eats π
bool QActionGroup::isExclusive () const
Returns TRUE if the action group does exclusive toggling; otherwise returns FALSE. See the "exclusive" property for details.
void QActionGroup::selected ( QAction * ) [signal]
This signal is emitted from exclusive groups when toggle actions change state.
The argument is the action whose state changed to "on". π’
See also exclusive, on, and QAction::toggled().
Examples: (that's it β the original lists nothing here, no cap, that's just how the page is)
void QActionGroup::setExclusive ( bool )
Sets whether the action group does exclusive toggling. See the "exclusive" property for details.
void QActionGroup::setUsesDropDown ( bool enable )
Sets whether the group's actions are displayed in a subwidget of the widgets the action group is added to to enable. See the "usesDropDown" property for details.
bool QActionGroup::usesDropDown () const
Returns TRUE if the group's actions are displayed in a subwidget of the widgets the action group is added to; otherwise returns FALSE. See the "usesDropDown" property for details.
π Property Documentation π
bool exclusive
This property holds whether the action group does exclusive toggling.
If exclusive is TRUE only one toggle action in the action group can ever be active at any one time. If the user chooses another toggle action in the group the one they chose becomes active and the one that was active becomes inactive. π main character energy, only one of y'all at a time.
See also QAction::toggleAction.
Set this property's value with setExclusive() and get this property's value with isExclusive().
bool usesDropDown
This property holds whether the group's actions are displayed in a subwidget of the widgets the action group is added to.
Exclusive action groups added to a toolbar display their actions in a combobox with the action's QAction::text and QAction::iconSet properties shown. Non-exclusive groups are represented by a tool button showing their QAction::iconSet and β depending on QMainWindow::usesTextLabel() β text() property.
In a popup menu the member actions are displayed in a submenu.
Changing usesDropDown only affects subsequent calls to addTo(). (no time travel, sorry π°οΈ)
π Note that setting this property for actions in a combobox causes calls to theirQAction::setVisible(),QAction::setEnabled(), andQAction::setDisabled()functions to have no effect. they're literally muted.
This property's default is FALSE.
Set this property's value with setUsesDropDown() and get this property's value with usesDropDown().
π¦ SEE ALSO π¦
π COPYRIGHT π
Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the license file included in the distribution for a complete license statement.
β AUTHOR β
Generated automatically from the source code. (a bot did this. respect. π€)
π BUGS π
If you find a bug in Qt, please report it as described in http://doc.trolltech.com/bughowto.html. Good bug reports help us to help you. Thank you. π«Ά
The definitive Qt documentation is provided in HTML format; it is located at $QTDIR/doc/html and can be read using Qt Assistant or with a web browser. This man page is provided as a convenience for those users who prefer man pages, although this format is not officially supported by Trolltech.
If you find errors in this manual page, please report them to qt-bugs@trolltech.com. Please include the name of the manual page (qactiongroup.3qt) and the Qt version (3.3.8).
and that's the whole page bestie β this lil man page came from Trolltech AS, dated 2 February 2007, and it's for Qt 3.3.8 (you can tell from the 3qt in QActionGroup(3qt) up top, iykyk). go group some actions. periodt. π
β¨
π¦ where this page comes from
- fedora 43: qt3-devel-docs 3.3.8b-102.fc43 Β· QPL-1.0 OR GPL-2.0-only OR GPL-3.0-only
- fedora 44: qt3-devel-docs 3.3.8b-103.fc44 Β· QPL-1.0 OR GPL-2.0-only OR GPL-3.0-only
- Copyright 1992-2007 Trolltech ASA. All rights reserved. See the
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms