Sophie

Sophie

distrib > Mageia > 6 > armv5tl > media > core-updates > by-pkgid > 768f7d9f703884aa2562bf0a651086df > files > 3225

qtbase5-doc-5.9.4-1.1.mga6.noarch.rpm

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qactiongroup.cpp -->
  <title>QActionGroup Class | Qt Widgets 5.9</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td >Qt 5.9</td><td ><a href="qtwidgets-index.html">Qt Widgets</a></td><td ><a href="qtwidgets-module.html">C++ Classes</a></td><td >QActionGroup</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right">Qt 5.9.4 Reference Documentation</td>
        </tr></table>
      </div>
    </div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#properties">Properties</a></li>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#public-slots">Public Slots</a></li>
<li class="level1"><a href="#signals">Signals</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">QActionGroup Class</h1>
<!-- $$$QActionGroup-brief -->
<p>The <a href="qactiongroup.html">QActionGroup</a> class groups actions together. <a href="#details">More...</a></p>
<!-- @@@QActionGroup -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign">   <span class="preprocessor">#include &lt;QActionGroup&gt;</span>
</td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += widgets</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Inherits:</td><td class="memItemRight bottomAlign"> <a href="../qtcore/qobject.html">QObject</a></td></tr></table></div><ul>
<li><a href="qactiongroup-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="properties"></a>
<h2 id="properties">Properties</h2>
<ul>
<li class="fn"><b><a href="qactiongroup.html#enabled-prop">enabled</a></b> : bool</li>
<li class="fn"><b><a href="qactiongroup.html#exclusive-prop">exclusive</a></b> : bool</li>
<li class="fn"><b><a href="qactiongroup.html#visible-prop">visible</a></b> : bool</li>
</ul>
<ul>
<li class="fn">1 property inherited from <a href="../qtcore/qobject.html#properties">QObject</a></li>
</ul>
<a name="public-functions"></a>
<h2 id="public-functions">Public Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qactiongroup.html#QActionGroup">QActionGroup</a></b>(QObject *<i>parent</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qactiongroup.html#dtor.QActionGroup">~QActionGroup</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QList&lt;QAction *&gt; </td><td class="memItemRight bottomAlign"><b><a href="qactiongroup.html#actions">actions</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QAction *</td><td class="memItemRight bottomAlign"><b><a href="qactiongroup.html#addAction">addAction</a></b>(QAction *<i>action</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QAction *</td><td class="memItemRight bottomAlign"><b><a href="qactiongroup.html#addAction-1">addAction</a></b>(const QString &amp;<i>text</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QAction *</td><td class="memItemRight bottomAlign"><b><a href="qactiongroup.html#addAction-2">addAction</a></b>(const QIcon &amp;<i>icon</i>, const QString &amp;<i>text</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QAction *</td><td class="memItemRight bottomAlign"><b><a href="qactiongroup.html#checkedAction">checkedAction</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qactiongroup.html#enabled-prop">isEnabled</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qactiongroup.html#exclusive-prop">isExclusive</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qactiongroup.html#visible-prop">isVisible</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qactiongroup.html#removeAction">removeAction</a></b>(QAction *<i>action</i>)</td></tr>
</table></div>
<ul>
<li class="fn">32 public functions inherited from <a href="../qtcore/qobject.html#public-functions">QObject</a></li>
</ul>
<a name="public-slots"></a>
<h2 id="public-slots">Public Slots</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qactiongroup.html#setDisabled">setDisabled</a></b>(bool <i>b</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qactiongroup.html#enabled-prop">setEnabled</a></b>(<i>bool</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qactiongroup.html#exclusive-prop">setExclusive</a></b>(<i>bool</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qactiongroup.html#visible-prop">setVisible</a></b>(<i>bool</i>)</td></tr>
</table></div>
<ul>
<li class="fn">1 public slot inherited from <a href="../qtcore/qobject.html#public-slots">QObject</a></li>
</ul>
<a name="signals"></a>
<h2 id="signals">Signals</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qactiongroup.html#hovered">hovered</a></b>(QAction *<i>action</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qactiongroup.html#triggered">triggered</a></b>(QAction *<i>action</i>)</td></tr>
</table></div>
<ul>
<li class="fn">2 signals inherited from <a href="../qtcore/qobject.html#signals">QObject</a></li>
</ul>
<h3>Additional Inherited Members</h3>
<ul>
<li class="fn">1 public variable inherited from <a href="../qtcore/qobject.html#public-variables">QObject</a></li>
<li class="fn">10 static public members inherited from <a href="../qtcore/qobject.html#static-public-members">QObject</a></li>
<li class="fn">9 protected functions inherited from <a href="../qtcore/qobject.html#protected-functions">QObject</a></li>
<li class="fn">2 protected variables inherited from <a href="../qtcore/qobject.html#protected-variables">QObject</a></li>
</ul>
<a name="details"></a>
<!-- $$$QActionGroup-description -->
<div class="descr">
<h2 id="details">Detailed Description</h2>
<p>The <a href="qactiongroup.html">QActionGroup</a> class groups actions together.</p>
<p>In some situations it is useful to group <a href="qaction.html">QAction</a> objects together. For example, if you have a <b>Left Align</b> action, a <b>Right Align</b> action, a <b>Justify</b> action, and a <b>Center</b> 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.</p>
<p>Here's a example (from the <a href="qtwidgets-mainwindows-menus-example.html">Menus</a> example):</p>
<pre class="cpp">

      alignmentGroup <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qactiongroup.html#QActionGroup">QActionGroup</a></span>(<span class="keyword">this</span>);
      alignmentGroup<span class="operator">-</span><span class="operator">&gt;</span>addAction(leftAlignAct);
      alignmentGroup<span class="operator">-</span><span class="operator">&gt;</span>addAction(rightAlignAct);
      alignmentGroup<span class="operator">-</span><span class="operator">&gt;</span>addAction(justifyAct);
      alignmentGroup<span class="operator">-</span><span class="operator">&gt;</span>addAction(centerAct);
      leftAlignAct<span class="operator">-</span><span class="operator">&gt;</span>setChecked(<span class="keyword">true</span>);

</pre>
<p>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.</p>
<p class="centerAlign"><img src="images/qactiongroup-align.png" alt="Alignment options in a QMenu" /></p><p>A <a href="qactiongroup.html">QActionGroup</a> emits an <a href="qactiongroup.html#triggered">triggered</a>() signal when one of its actions is chosen. Each action in an action group emits its <a href="qactiongroup.html#triggered">triggered</a>() signal as usual.</p>
<p>As stated above, an action group is <a href="qactiongroup.html#exclusive-prop">exclusive</a> 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 <a href="qactiongroup.html#exclusive-prop">setExclusive</a>(false).</p>
<p>Actions can be added to an action group using <a href="qactiongroup.html#addAction">addAction</a>(), 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 <a href="qaction.html">QAction</a>'s <a href="qaction.html#setSeparator">setSeparator()</a> function to make it considered a separator. Action groups are added to widgets with the <a href="qwidget.html#addActions">QWidget::addActions</a>() function.</p>
</div>
<p><b>See also </b><a href="qaction.html">QAction</a>.</p>
<!-- @@@QActionGroup -->
<div class="prop">
<h2>Property Documentation</h2>
<!-- $$$enabled-prop$$$isEnabled$$$setEnabledbool -->
<h3 class="fn" id="enabled-prop"><a name="enabled-prop"></a><span class="name">enabled</span> : <span class="type">bool</span></h3>
<p>This property holds whether the action group is enabled</p>
<p>Each action in the group will be enabled or disabled unless it has been explicitly disabled.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> bool </td><td class="memItemRight bottomAlign"><span class="name"><b>isEnabled</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setEnabled</b></span>(<i>bool</i>)</td></tr>
</table></div>
<p><b>See also </b><a href="qaction.html#enabled-prop">QAction::setEnabled</a>().</p>
<!-- @@@enabled -->
<!-- $$$exclusive-prop$$$isExclusive$$$setExclusivebool -->
<h3 class="fn" id="exclusive-prop"><a name="exclusive-prop"></a><span class="name">exclusive</span> : <span class="type">bool</span></h3>
<p>This property holds whether the action group does exclusive checking</p>
<p>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.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> bool </td><td class="memItemRight bottomAlign"><span class="name"><b>isExclusive</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setExclusive</b></span>(<i>bool</i>)</td></tr>
</table></div>
<p><b>See also </b><a href="qaction.html#checkable-prop">QAction::checkable</a>.</p>
<!-- @@@exclusive -->
<!-- $$$visible-prop$$$isVisible$$$setVisiblebool -->
<h3 class="fn" id="visible-prop"><a name="visible-prop"></a><span class="name">visible</span> : <span class="type">bool</span></h3>
<p>This property holds whether the action group is visible</p>
<p>Each action in the action group will match the visible state of this group unless it has been explicitly hidden.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> bool </td><td class="memItemRight bottomAlign"><span class="name"><b>isVisible</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setVisible</b></span>(<i>bool</i>)</td></tr>
</table></div>
<p><b>See also </b><a href="qaction.html#enabled-prop">QAction::setEnabled</a>().</p>
<!-- @@@visible -->
</div>
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QActionGroup[overload1]$$$QActionGroupQObject* -->
<h3 class="fn" id="QActionGroup"><a name="QActionGroup"></a>QActionGroup::<span class="name">QActionGroup</span>(<span class="type"><a href="../qtcore/qobject.html#QObject">QObject</a></span> *<i>parent</i>)</h3>
<p>Constructs an action group for the <i>parent</i> object.</p>
<p>The action group is exclusive by default. Call <a href="qactiongroup.html#exclusive-prop">setExclusive</a>(false) to make the action group non-exclusive.</p>
<!-- @@@QActionGroup -->
<!-- $$$~QActionGroup[overload1]$$$~QActionGroup -->
<h3 class="fn" id="dtor.QActionGroup"><a name="dtor.QActionGroup"></a>QActionGroup::<span class="name">~QActionGroup</span>()</h3>
<p>Destroys the action group.</p>
<!-- @@@~QActionGroup -->
<!-- $$$actions[overload1]$$$actions -->
<h3 class="fn" id="actions"><a name="actions"></a><span class="type"><a href="../qtcore/qlist.html">QList</a></span>&lt;<span class="type"><a href="qaction.html">QAction</a></span> *&gt; QActionGroup::<span class="name">actions</span>() const</h3>
<p>Returns the list of this groups's actions. This may be empty.</p>
<!-- @@@actions -->
<!-- $$$addAction[overload1]$$$addActionQAction* -->
<h3 class="fn" id="addAction"><a name="addAction"></a><span class="type"><a href="qaction.html">QAction</a></span> *QActionGroup::<span class="name">addAction</span>(<span class="type"><a href="qaction.html">QAction</a></span> *<i>action</i>)</h3>
<p>Adds the <i>action</i> to this group, and returns it.</p>
<p>Normally an action is added to a group by creating it with the group as its parent, so this function is not usually used.</p>
<p><b>See also </b><a href="qaction.html#setActionGroup">QAction::setActionGroup</a>().</p>
<!-- @@@addAction -->
<!-- $$$addAction$$$addActionconstQString& -->
<h3 class="fn" id="addAction-1"><a name="addAction-1"></a><span class="type"><a href="qaction.html">QAction</a></span> *QActionGroup::<span class="name">addAction</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>text</i>)</h3>
<p>Creates and returns an action with <i>text</i>. The newly created action is a child of this action group.</p>
<p>Normally an action is added to a group by creating it with the group as parent, so this function is not usually used.</p>
<p><b>See also </b><a href="qaction.html#setActionGroup">QAction::setActionGroup</a>().</p>
<!-- @@@addAction -->
<!-- $$$addAction$$$addActionconstQIcon&constQString& -->
<h3 class="fn" id="addAction-2"><a name="addAction-2"></a><span class="type"><a href="qaction.html">QAction</a></span> *QActionGroup::<span class="name">addAction</span>(const <span class="type"><a href="../qtgui/qicon.html">QIcon</a></span> &amp;<i>icon</i>, const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>text</i>)</h3>
<p>Creates and returns an action with <i>text</i> and an <i>icon</i>. The newly created action is a child of this action group.</p>
<p>Normally an action is added to a group by creating it with the group as its parent, so this function is not usually used.</p>
<p><b>See also </b><a href="qaction.html#setActionGroup">QAction::setActionGroup</a>().</p>
<!-- @@@addAction -->
<!-- $$$checkedAction[overload1]$$$checkedAction -->
<h3 class="fn" id="checkedAction"><a name="checkedAction"></a><span class="type"><a href="qaction.html">QAction</a></span> *QActionGroup::<span class="name">checkedAction</span>() const</h3>
<p>Returns the currently checked action in the group, or 0 if none are checked.</p>
<!-- @@@checkedAction -->
<!-- $$$hovered[overload1]$$$hoveredQAction* -->
<h3 class="fn" id="hovered"><a name="hovered"></a><code>[signal] </code><span class="type">void</span> QActionGroup::<span class="name">hovered</span>(<span class="type"><a href="qaction.html">QAction</a></span> *<i>action</i>)</h3>
<p>This signal is emitted when the given <i>action</i> 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.</p>
<p><b>See also </b><a href="qaction.html#activate">QAction::activate</a>().</p>
<!-- @@@hovered -->
<!-- $$$removeAction[overload1]$$$removeActionQAction* -->
<h3 class="fn" id="removeAction"><a name="removeAction"></a><span class="type">void</span> QActionGroup::<span class="name">removeAction</span>(<span class="type"><a href="qaction.html">QAction</a></span> *<i>action</i>)</h3>
<p>Removes the <i>action</i> from this group. The action will have no parent as a result.</p>
<p><b>See also </b><a href="qaction.html#setActionGroup">QAction::setActionGroup</a>().</p>
<!-- @@@removeAction -->
<!-- $$$setDisabled[overload1]$$$setDisabledbool -->
<h3 class="fn" id="setDisabled"><a name="setDisabled"></a><code>[slot] </code><span class="type">void</span> QActionGroup::<span class="name">setDisabled</span>(<span class="type">bool</span> <i>b</i>)</h3>
<p>This is a convenience function for the <a href="qactiongroup.html#enabled-prop">enabled</a> property, that is useful for signals--slots connections. If <i>b</i> is true the action group is disabled; otherwise it is enabled.</p>
<!-- @@@setDisabled -->
<!-- $$$triggered[overload1]$$$triggeredQAction* -->
<h3 class="fn" id="triggered"><a name="triggered"></a><code>[signal] </code><span class="type">void</span> QActionGroup::<span class="name">triggered</span>(<span class="type"><a href="qaction.html">QAction</a></span> *<i>action</i>)</h3>
<p>This signal is emitted when the given <i>action</i> 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.</p>
<p>Connect to this signal for command actions.</p>
<p><b>See also </b><a href="qaction.html#activate">QAction::activate</a>().</p>
<!-- @@@triggered -->
</div>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2017 The Qt Company Ltd.
   Documentation contributions included herein are the copyrights of
   their respective owners.<br>    The documentation provided herein is licensed under the terms of the    <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation    License version 1.3</a> as published by the Free Software Foundation.<br>    Qt and respective logos are trademarks of The Qt Company Ltd.     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>