File: qactiongroup.html

package info (click to toggle)
python-qt4 4.0.1-5
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 18,632 kB
  • ctags: 2,639
  • sloc: python: 29,409; sh: 5,646; cpp: 3,168; xml: 149; makefile: 109
file content (50 lines) | stat: -rw-r--r-- 10,805 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QActionGroup Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="../pyqt4ref.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QActionGroup Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QActionGroup class groups actions together. <a href="#details">More...</a></p>
<p>Inherits <a href="qobject.html">QObject</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qactiongroup.html#QActionGroup">__init__</a></b> (<i>self</i>, QObject&#160;<i>parent</i>)</li><li><div class="fn" />QAction-list <b><a href="qactiongroup.html#actions">actions</a></b> (<i>self</i>)</li><li><div class="fn" />QAction <b><a href="qactiongroup.html#addAction">addAction</a></b> (<i>self</i>, QAction&#160;<i>a</i>)</li><li><div class="fn" />QAction <b><a href="qactiongroup.html#addAction-2">addAction</a></b> (<i>self</i>, QString&#160;<i>text</i>)</li><li><div class="fn" />QAction <b><a href="qactiongroup.html#addAction-3">addAction</a></b> (<i>self</i>, QIcon&#160;<i>icon</i>, QString&#160;<i>text</i>)</li><li><div class="fn" />QAction <b><a href="qactiongroup.html#checkedAction">checkedAction</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qactiongroup.html#isEnabled">isEnabled</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qactiongroup.html#isExclusive">isExclusive</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qactiongroup.html#isVisible">isVisible</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qactiongroup.html#removeAction">removeAction</a></b> (<i>self</i>, QAction&#160;<i>a</i>)</li><li><div class="fn" /><b><a href="qactiongroup.html#setDisabled">setDisabled</a></b> (<i>self</i>, bool&#160;<i>b</i>)</li><li><div class="fn" /><b><a href="qactiongroup.html#setEnabled">setEnabled</a></b> (<i>self</i>, bool)</li><li><div class="fn" /><b><a href="qactiongroup.html#setExclusive">setExclusive</a></b> (<i>self</i>, bool)</li><li><div class="fn" /><b><a href="qactiongroup.html#setVisible">setVisible</a></b> (<i>self</i>, bool)</li></ul><h3>Qt Signals</h3><ul><li><div class="fn" />void <b><a href="qactiongroup.html#hovered">hovered</a></b> (QAction *)</li><li><div class="fn" />void <b><a href="qactiongroup.html#selected">selected</a></b> (QAction *)</li><li><div class="fn" />void <b><a href="qactiongroup.html#triggered">triggered</a></b> (QAction *)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QActionGroup class groups actions together.</p>
<p>In some situations it is useful to group actions together. For example, if you have a left justify action, a right 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.</p>
<p>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 or toolbar buttons.</p>
<p>Here's a example (from the <a href="mainwindows-menus.html">Menus</a> example):</p>
<pre>
        alignmentGroup = new QActionGroup(this);
        alignmentGroup-&gt;addAction(leftAlignAct);
        alignmentGroup-&gt;addAction(rightAlignAct);
        alignmentGroup-&gt;addAction(justifyAct);
        alignmentGroup-&gt;addAction(centerAct);
        leftAlignAct-&gt;setChecked(true);
</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 ever active at any one time.</p>
<p>A QActionGroup emits an <a href="qactiongroup.html#triggered">triggered</a>() signal when one of its actions is activated. 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 setExclusive(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 using <a href="qactiongroup-qt3.html#addSeparator">addSeparator</a>(). Action groups are added to widgets with the <a href="qwidget.html#addActions">QWidget.addActions</a>() function.</p>
<p>See also <a href="qaction.html">QAction</a>.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QActionGroup" />QActionGroup.__init__ (<i>self</i>, <a href="qobject.html">QObject</a>&#160;<i>parent</i>)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs an action group for the <i>parent</i> object.</p>
<p>The action group is exclusive by default. Call setExclusive(false) to make the action group non-exclusive.</p>
<h3 class="fn"><a name="actions" />QAction-list QActionGroup.actions (<i>self</i>)</h3><p>Returns the list of this groups's actions. This may be empty.</p>
<h3 class="fn"><a name="addAction" /><a href="qaction.html">QAction</a> QActionGroup.addAction (<i>self</i>, <a href="qaction.html">QAction</a>&#160;<i>a</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>See also <a href="qaction.html#setActionGroup">QAction.setActionGroup</a>().</p>
<h3 class="fn"><a name="addAction-2" /><a href="qaction.html">QAction</a> QActionGroup.addAction (<i>self</i>, <a href="qstring.html">QString</a>&#160;<i>text</i>)</h3><p>This is an overloaded member function, provided for convenience.</p>
<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>See also <a href="qaction.html#setActionGroup">QAction.setActionGroup</a>().</p>
<h3 class="fn"><a name="addAction-3" /><a href="qaction.html">QAction</a> QActionGroup.addAction (<i>self</i>, <a href="qicon.html">QIcon</a>&#160;<i>icon</i>, <a href="qstring.html">QString</a>&#160;<i>text</i>)</h3><p>This is an overloaded member function, provided for convenience.</p>
<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>See also <a href="qaction.html#setActionGroup">QAction.setActionGroup</a>().</p>
<h3 class="fn"><a name="checkedAction" /><a href="qaction.html">QAction</a> QActionGroup.checkedAction (<i>self</i>)</h3><p>Returns the currently checked action in the group, or 0 if none are checked.</p>
<h3 class="fn"><a name="isEnabled" />bool QActionGroup.isEnabled (<i>self</i>)</h3><h3 class="fn"><a name="isExclusive" />bool QActionGroup.isExclusive (<i>self</i>)</h3><h3 class="fn"><a name="isVisible" />bool QActionGroup.isVisible (<i>self</i>)</h3><h3 class="fn"><a name="removeAction" />QActionGroup.removeAction (<i>self</i>, <a href="qaction.html">QAction</a>&#160;<i>a</i>)</h3><p>Removes the <i>action</i> from this group. The action will have no parent as a result.</p>
<p>See also <a href="qaction.html#setActionGroup">QAction.setActionGroup</a>().</p>
<h3 class="fn"><a name="setDisabled" />QActionGroup.setDisabled (<i>self</i>, bool&#160;<i>b</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void setDisabled(bool)</tt>.</p><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>
<h3 class="fn"><a name="setEnabled" />QActionGroup.setEnabled (<i>self</i>, bool)</h3><p>This method is also a Qt slot with the C++ signature <tt>void setEnabled(bool)</tt>.</p><h3 class="fn"><a name="setExclusive" />QActionGroup.setExclusive (<i>self</i>, bool)</h3><p>This method is also a Qt slot with the C++ signature <tt>void setExclusive(bool)</tt>.</p><h3 class="fn"><a name="setVisible" />QActionGroup.setVisible (<i>self</i>, bool)</h3><p>This method is also a Qt slot with the C++ signature <tt>void setVisible(bool)</tt>.</p><hr /><h2>Qt Signal Documentation</h2><h3 class="fn"><a name="hovered" />void hovered (QAction *)</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>See also <a href="qaction.html#activate">QAction.activate</a>().</p>
<h3 class="fn"><a name="selected" />void selected (QAction *)</h3><h3 class="fn"><a name="triggered" />void triggered (QAction *)</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>See also <a href="qaction.html#activate">QAction.activate</a>().</p>
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td width="25%">PyQt&#160;4.0.1 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.trolltech.com">Trolltech&#160;AS</a> 2006</td><td align="right" width="25%">Qt&#160;4.1.4</td></tr></table></div></address></body></html>