<?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>QAction 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">  </td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a> · <a href="classes.html"><font color="#004faf">All Classes</font></a> · <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QAction Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QAction class provides an abstract user interface action that can be inserted into widgets. <a href="#details">More...</a></p> <p>Inherits <a href="qobject.html">QObject</a>.</p><p>Inherited by <a href="qwidgetaction.html">QWidgetAction</a>.</p><h3>Types</h3><ul><li><div class="fn" />enum <b><a href="qaction.html#ActionEvent-enum">ActionEvent</a></b> { Trigger, Hover }</li><li><div class="fn" />enum <b><a href="qaction.html#MenuRole-enum">MenuRole</a></b> { NoRole, TextHeuristicRole, ApplicationSpecificRole, AboutQtRole, ..., QuitRole }</li><li><div class="fn" />enum <b><a href="qaction.html#Priority-enum">Priority</a></b> { LowPriority, NormalPriority, HighPriority }</li><li><div class="fn" />enum <b><a href="qaction.html#SoftKeyRole-enum">SoftKeyRole</a></b> { NoSoftKey, PositiveSoftKey, NegativeSoftKey, SelectSoftKey }</li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qaction.html#QAction">__init__</a></b> (<i>self</i>, QObject <i>parent</i>)</li><li><div class="fn" /><b><a href="qaction.html#QAction-2">__init__</a></b> (<i>self</i>, QString <i>text</i>, QObject <i>parent</i>)</li><li><div class="fn" /><b><a href="qaction.html#QAction-3">__init__</a></b> (<i>self</i>, QIcon <i>icon</i>, QString <i>text</i>, QObject <i>parent</i>)</li><li><div class="fn" />QActionGroup <b><a href="qaction.html#actionGroup">actionGroup</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qaction.html#activate">activate</a></b> (<i>self</i>, ActionEvent <i>event</i>)</li><li><div class="fn" />list-of-QGraphicsWidget <b><a href="qaction.html#associatedGraphicsWidgets">associatedGraphicsWidgets</a></b> (<i>self</i>)</li><li><div class="fn" />list-of-QWidget <b><a href="qaction.html#associatedWidgets">associatedWidgets</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qaction.html#autoRepeat">autoRepeat</a></b> (<i>self</i>)</li><li><div class="fn" />QVariant <b><a href="qaction.html#data">data</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qaction.html#event">event</a></b> (<i>self</i>, QEvent)</li><li><div class="fn" />QFont <b><a href="qaction.html#font">font</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qaction.html#hover">hover</a></b> (<i>self</i>)</li><li><div class="fn" />QIcon <b><a href="qaction.html#icon">icon</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qaction.html#iconText">iconText</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qaction.html#isCheckable">isCheckable</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qaction.html#isChecked">isChecked</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qaction.html#isEnabled">isEnabled</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qaction.html#isIconVisibleInMenu">isIconVisibleInMenu</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qaction.html#isSeparator">isSeparator</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qaction.html#isVisible">isVisible</a></b> (<i>self</i>)</li><li><div class="fn" />QMenu <b><a href="qaction.html#menu">menu</a></b> (<i>self</i>)</li><li><div class="fn" />MenuRole <b><a href="qaction.html#menuRole">menuRole</a></b> (<i>self</i>)</li><li><div class="fn" />QWidget <b><a href="qaction.html#parentWidget">parentWidget</a></b> (<i>self</i>)</li><li><div class="fn" />Priority <b><a href="qaction.html#priority">priority</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qaction.html#setActionGroup">setActionGroup</a></b> (<i>self</i>, QActionGroup <i>group</i>)</li><li><div class="fn" /><b><a href="qaction.html#setAutoRepeat">setAutoRepeat</a></b> (<i>self</i>, bool)</li><li><div class="fn" /><b><a href="qaction.html#setCheckable">setCheckable</a></b> (<i>self</i>, bool)</li><li><div class="fn" /><b><a href="qaction.html#setChecked">setChecked</a></b> (<i>self</i>, bool)</li><li><div class="fn" /><b><a href="qaction.html#setData">setData</a></b> (<i>self</i>, QVariant <i>var</i>)</li><li><div class="fn" /><b><a href="qaction.html#setDisabled">setDisabled</a></b> (<i>self</i>, bool <i>b</i>)</li><li><div class="fn" /><b><a href="qaction.html#setEnabled">setEnabled</a></b> (<i>self</i>, bool)</li><li><div class="fn" /><b><a href="qaction.html#setFont">setFont</a></b> (<i>self</i>, QFont <i>font</i>)</li><li><div class="fn" /><b><a href="qaction.html#setIcon">setIcon</a></b> (<i>self</i>, QIcon <i>icon</i>)</li><li><div class="fn" /><b><a href="qaction.html#setIconText">setIconText</a></b> (<i>self</i>, QString <i>text</i>)</li><li><div class="fn" /><b><a href="qaction.html#setIconVisibleInMenu">setIconVisibleInMenu</a></b> (<i>self</i>, bool <i>visible</i>)</li><li><div class="fn" /><b><a href="qaction.html#setMenu">setMenu</a></b> (<i>self</i>, QMenu <i>menu</i>)</li><li><div class="fn" /><b><a href="qaction.html#setMenuRole">setMenuRole</a></b> (<i>self</i>, MenuRole <i>menuRole</i>)</li><li><div class="fn" /><b><a href="qaction.html#setPriority">setPriority</a></b> (<i>self</i>, Priority <i>priority</i>)</li><li><div class="fn" /><b><a href="qaction.html#setSeparator">setSeparator</a></b> (<i>self</i>, bool <i>b</i>)</li><li><div class="fn" /><b><a href="qaction.html#setShortcut">setShortcut</a></b> (<i>self</i>, QKeySequence <i>shortcut</i>)</li><li><div class="fn" /><b><a href="qaction.html#setShortcutContext">setShortcutContext</a></b> (<i>self</i>, Qt.ShortcutContext <i>context</i>)</li><li><div class="fn" /><b><a href="qaction.html#setShortcuts">setShortcuts</a></b> (<i>self</i>, list-of-QKeySequence <i>shortcuts</i>)</li><li><div class="fn" /><b><a href="qaction.html#setShortcuts-2">setShortcuts</a></b> (<i>self</i>, QKeySequence.StandardKey)</li><li><div class="fn" /><b><a href="qaction.html#setSoftKeyRole">setSoftKeyRole</a></b> (<i>self</i>, SoftKeyRole <i>softKeyRole</i>)</li><li><div class="fn" /><b><a href="qaction.html#setStatusTip">setStatusTip</a></b> (<i>self</i>, QString <i>statusTip</i>)</li><li><div class="fn" /><b><a href="qaction.html#setText">setText</a></b> (<i>self</i>, QString <i>text</i>)</li><li><div class="fn" /><b><a href="qaction.html#setToolTip">setToolTip</a></b> (<i>self</i>, QString <i>tip</i>)</li><li><div class="fn" /><b><a href="qaction.html#setVisible">setVisible</a></b> (<i>self</i>, bool)</li><li><div class="fn" /><b><a href="qaction.html#setWhatsThis">setWhatsThis</a></b> (<i>self</i>, QString <i>what</i>)</li><li><div class="fn" />QKeySequence <b><a href="qaction.html#shortcut">shortcut</a></b> (<i>self</i>)</li><li><div class="fn" />Qt.ShortcutContext <b><a href="qaction.html#shortcutContext">shortcutContext</a></b> (<i>self</i>)</li><li><div class="fn" />list-of-QKeySequence <b><a href="qaction.html#shortcuts">shortcuts</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qaction.html#showStatusText">showStatusText</a></b> (<i>self</i>, QWidget <i>widget</i> = None)</li><li><div class="fn" />SoftKeyRole <b><a href="qaction.html#softKeyRole">softKeyRole</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qaction.html#statusTip">statusTip</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qaction.html#text">text</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qaction.html#toggle">toggle</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qaction.html#toolTip">toolTip</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qaction.html#trigger">trigger</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qaction.html#whatsThis">whatsThis</a></b> (<i>self</i>)</li></ul><h3>Qt Signals</h3><ul><li><div class="fn" />void <b><a href="qaction.html#changed">changed</a></b> ()</li><li><div class="fn" />void <b><a href="qaction.html#hovered">hovered</a></b> ()</li><li><div class="fn" />void <b><a href="qaction.html#toggled">toggled</a></b> (bool)</li><li><div class="fn" />void <b><a href="qaction.html#triggered">triggered</a></b> (bool = 0)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QAction class provides an abstract user interface action that can be inserted into widgets.</p> <p>In applications many common commands can be invoked via menus, toolbar buttons, and keyboard shortcuts. Since the user expects each command to be performed in the same way, regardless of the user interface used, it is useful to represent each command as an <i>action</i>.</p> <p>Actions can be added to menus and toolbars, and will automatically keep them in sync. For example, in a word processor, if the user presses a Bold toolbar button, the Bold menu item will automatically be checked.</p> <p>Actions can be created as independent objects, but they may also be created during the construction of menus; the <a href="qmenu.html">QMenu</a> class contains convenience functions for creating actions suitable for use as menu items.</p> <p>A QAction may contain an icon, menu text, a shortcut, status text, "What's This?" text, and a tooltip. Most of these can be set in the constructor. They can also be set independently with <a href="qaction.html#icon-prop">setIcon</a>(), <a href="qaction.html#text-prop">setText</a>(), <a href="qaction.html#iconText-prop">setIconText</a>(), <a href="qaction.html#shortcut-prop">setShortcut</a>(), <a href="qaction.html#statusTip-prop">setStatusTip</a>(), <a href="qaction.html#whatsThis-prop">setWhatsThis</a>(), and <a href="qaction.html#toolTip-prop">setToolTip</a>(). For menu items, it is possible to set an individual font with <a href="qaction.html#font-prop">setFont</a>().</p> <p>Actions are added to widgets using <a href="qwidget.html#addAction">QWidget.addAction</a>() or <a href="qgraphicswidget.html#addAction">QGraphicsWidget.addAction</a>(). Note that an action must be added to a widget before it can be used; this is also true when the shortcut should be global (i.e., <a href="qt.html#ShortcutContext-enum">Qt.ApplicationShortcut</a> as <a href="qt.html#ShortcutContext-enum">Qt.ShortcutContext</a>).</p> <p>Once a QAction has been created it should be added to the relevant menu and toolbar, then connected to the slot which will perform the action. For example:</p> <pre class="cpp"> openAct <span class="operator">=</span> <span class="keyword">new</span> <span class="type">QAction</span>(<span class="type"><a href="qicon.html">QIcon</a></span>(<span class="string">":/images/open.png"</span>)<span class="operator">,</span> tr(<span class="string">"&Open..."</span>)<span class="operator">,</span> <span class="keyword">this</span>); openAct<span class="operator">-</span><span class="operator">></span>setShortcuts(<span class="type"><a href="qkeysequence.html">QKeySequence</a></span><span class="operator">.</span>Open); openAct<span class="operator">-</span><span class="operator">></span>setStatusTip(tr(<span class="string">"Open an existing file"</span>)); connect(openAct<span class="operator">,</span> SIGNAL(triggered())<span class="operator">,</span> <span class="keyword">this</span><span class="operator">,</span> SLOT(open())); fileMenu<span class="operator">-</span><span class="operator">></span>addAction(openAct); fileToolBar<span class="operator">-</span><span class="operator">></span>addAction(openAct); </pre> <p>We recommend that actions are created as children of the window they are used in. In most cases actions will be children of the application's main window.</p> <hr /><h2>Type Documentation</h2><h3 class="fn"><a name="ActionEvent-enum" />QAction.ActionEvent</h3><p>This enum type is used when calling <a href="qaction.html#activate">QAction.activate</a>()</p> <table class="valuelist"> <tr class="odd" valign="top"> <th class="tblConst">Constant</th> <th class="tblval">Value</th> <th class="tbldscr">Description</th> </tr> <tr> <td class="topAlign"><tt>QAction.Trigger</tt></td> <td class="topAlign"><tt>0</tt></td> <td class="topAlign">this will cause the <a href="qaction.html#triggered">QAction.triggered</a>() signal to be emitted.</td> </tr> <tr> <td class="topAlign"><tt>QAction.Hover</tt></td> <td class="topAlign"><tt>1</tt></td> <td class="topAlign">this will cause the <a href="qaction.html#hovered">QAction.hovered</a>() signal to be emitted.</td> </tr> </table> <h3 class="fn"><a name="MenuRole-enum" />QAction.MenuRole</h3><p>This enum describes how an action should be moved into the application menu on Mac OS X.</p> <table class="valuelist"> <tr class="odd" valign="top"> <th class="tblConst">Constant</th> <th class="tblval">Value</th> <th class="tbldscr">Description</th> </tr> <tr> <td class="topAlign"><tt>QAction.NoRole</tt></td> <td class="topAlign"><tt>0</tt></td> <td class="topAlign">This action should not be put into the application menu</td> </tr> <tr> <td class="topAlign"><tt>QAction.TextHeuristicRole</tt></td> <td class="topAlign"><tt>1</tt></td> <td class="topAlign">This action should be put in the application menu based on the action's text as described in the <a href="qmenubar.html">QMenuBar</a> documentation.</td> </tr> <tr> <td class="topAlign"><tt>QAction.ApplicationSpecificRole</tt></td> <td class="topAlign"><tt>2</tt></td> <td class="topAlign">This action should be put in the application menu with an application specific role</td> </tr> <tr> <td class="topAlign"><tt>QAction.AboutQtRole</tt></td> <td class="topAlign"><tt>3</tt></td> <td class="topAlign">This action matches handles the "About Qt" menu item.</td> </tr> <tr> <td class="topAlign"><tt>QAction.AboutRole</tt></td> <td class="topAlign"><tt>4</tt></td> <td class="topAlign">This action should be placed where the "About" menu item is in the application menu. The text of the menu item will be set to "About <application name>". The application name is fetched from the <tt>Info.plist</tt> file in the application's bundle (See <a href="deployment-mac.html">Deploying an Application on Mac OS X</a>).</td> </tr> <tr> <td class="topAlign"><tt>QAction.PreferencesRole</tt></td> <td class="topAlign"><tt>5</tt></td> <td class="topAlign">This action should be placed where the "Preferences..." menu item is in the application menu.</td> </tr> <tr> <td class="topAlign"><tt>QAction.QuitRole</tt></td> <td class="topAlign"><tt>6</tt></td> <td class="topAlign">This action should be placed where the Quit menu item is in the application menu.</td> </tr> </table> <p>Setting this value only has effect on items that are in the immediate menus of the menubar, not the submenus of those menus. For example, if you have File menu in your menubar and the File menu has a submenu, setting the MenuRole for the actions in that submenu have no effect. They will never be moved.</p> <h3 class="fn"><a name="Priority-enum" />QAction.Priority</h3><p>This enum defines priorities for actions in user interface.</p> <table class="valuelist"> <tr class="odd" valign="top"> <th class="tblConst">Constant</th> <th class="tblval">Value</th> <th class="tbldscr">Description</th> </tr> <tr> <td class="topAlign"><tt>QAction.LowPriority</tt></td> <td class="topAlign"><tt>0</tt></td> <td class="topAlign">The action should not be prioritized in the user interface.</td> </tr> <tr> <td class="topAlign"><tt>QAction.NormalPriority</tt></td> <td class="topAlign"><tt>128</tt></td> <td class="topAlign"> </td> </tr> <tr> <td class="topAlign"><tt>QAction.HighPriority</tt></td> <td class="topAlign"><tt>256</tt></td> <td class="topAlign">The action should be prioritized in the user interface.</td> </tr> </table> <p>This enum was introduced or modified in Qt 4.6.</p> <p><b>See also</b> <a href="qaction.html#priority-prop">priority</a>.</p> <h3 class="fn"><a name="SoftKeyRole-enum" />QAction.SoftKeyRole</h3><p>This enum describes how an action should be placed in the softkey bar. Currently this enum only has an effect on the Symbian platform.</p> <table class="valuelist"> <tr class="odd" valign="top"> <th class="tblConst">Constant</th> <th class="tblval">Value</th> <th class="tbldscr">Description</th> </tr> <tr> <td class="topAlign"><tt>QAction.NoSoftKey</tt></td> <td class="topAlign"><tt>0</tt></td> <td class="topAlign">This action should not be used as a softkey</td> </tr> <tr> <td class="topAlign"><tt>QAction.PositiveSoftKey</tt></td> <td class="topAlign"><tt>1</tt></td> <td class="topAlign">This action is used to describe a softkey with a positive or non-destructive role such as Ok, Select, or Options.</td> </tr> <tr> <td class="topAlign"><tt>QAction.NegativeSoftKey</tt></td> <td class="topAlign"><tt>2</tt></td> <td class="topAlign">This action is used to describe a soft ey with a negative or destructive role role such as Cancel, Discard, or Close.</td> </tr> <tr> <td class="topAlign"><tt>QAction.SelectSoftKey</tt></td> <td class="topAlign"><tt>3</tt></td> <td class="topAlign">This action is used to describe a role that selects a particular item or widget in the application.</td> </tr> </table> <p>Actions with a softkey role defined are only visible in the softkey bar when the widget containing the action has focus. If no widget currently has focus, the softkey framework will traverse up the widget parent hierarchy looking for a widget containing softkey actions.</p> <p>This enum was introduced or modified in Qt 4.6.</p> <hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QAction" />QAction.__init__ (<i>self</i>, <a href="qobject.html">QObject</a> <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 with <i>parent</i>. If <i>parent</i> is an action group the action will be automatically inserted into the group.</p> <h3 class="fn"><a name="QAction-2" />QAction.__init__ (<i>self</i>, QString <i>text</i>, <a href="qobject.html">QObject</a> <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 with some <i>text</i> and <i>parent</i>. If <i>parent</i> is an action group the action will be automatically inserted into the group.</p> <p>The action uses a stripped version of <i>text</i> (e.g. "&Menu Option..." becomes "Menu Option") as descriptive text for tool buttons. You can override this by setting a specific description with <a href="qaction.html#text-prop">setText</a>(). The same text will be used for tooltips unless you specify a different text using <a href="qaction.html#toolTip-prop">setToolTip</a>().</p> <h3 class="fn"><a name="QAction-3" />QAction.__init__ (<i>self</i>, <a href="qicon.html">QIcon</a> <i>icon</i>, QString <i>text</i>, <a href="qobject.html">QObject</a> <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 with an <i>icon</i> and some <i>text</i> and <i>parent</i>. If <i>parent</i> is an action group the action will be automatically inserted into the group.</p> <p>The action uses a stripped version of <i>text</i> (e.g. "&Menu Option..." becomes "Menu Option") as descriptive text for tool buttons. You can override this by setting a specific description with <a href="qaction.html#text-prop">setText</a>(). The same text will be used for tooltips unless you specify a different text using <a href="qaction.html#toolTip-prop">setToolTip</a>().</p> <h3 class="fn"><a name="actionGroup" /><a href="qactiongroup.html">QActionGroup</a> QAction.actionGroup (<i>self</i>)</h3><p>Returns the action group for this action. If no action group manages this action then 0 will be returned.</p> <p><b>See also</b> <a href="qactiongroup.html">QActionGroup</a> and <a href="qaction.html#setActionGroup">QAction.setActionGroup</a>().</p> <h3 class="fn"><a name="activate" />QAction.activate (<i>self</i>, <a href="qaction.html#ActionEvent-enum">ActionEvent</a> <i>event</i>)</h3><p>Sends the relevant signals for <a href="qaction.html#ActionEvent-enum">ActionEvent</a> <i>event</i>.</p> <p>Action based widgets use this API to cause the <a href="qaction.html">QAction</a> to emit signals as well as emitting their own.</p> <h3 class="fn"><a name="associatedGraphicsWidgets" />list-of-QGraphicsWidget QAction.associatedGraphicsWidgets (<i>self</i>)</h3><p>Returns a list of widgets this action has been added to.</p> <p>This function was introduced in Qt 4.5.</p> <p><b>See also</b> <a href="qwidget.html#addAction">QWidget.addAction</a>() and <a href="qaction.html#associatedWidgets">associatedWidgets</a>().</p> <h3 class="fn"><a name="associatedWidgets" />list-of-QWidget QAction.associatedWidgets (<i>self</i>)</h3><p>Returns a list of widgets this action has been added to.</p> <p>This function was introduced in Qt 4.2.</p> <p><b>See also</b> <a href="qwidget.html#addAction">QWidget.addAction</a>() and <a href="qaction.html#associatedGraphicsWidgets">associatedGraphicsWidgets</a>().</p> <h3 class="fn"><a name="autoRepeat" />bool QAction.autoRepeat (<i>self</i>)</h3><h3 class="fn"><a name="data" />QVariant QAction.data (<i>self</i>)</h3><p>Returns the user data as set in QAction.setData.</p> <p><b>See also</b> <a href="qaction.html#setData">setData</a>().</p> <h3 class="fn"><a name="event" />bool QAction.event (<i>self</i>, <a href="qevent.html">QEvent</a>)</h3><p>Reimplemented from <a href="qobject.html#event">QObject.event</a>().</p> <h3 class="fn"><a name="font" /><a href="qfont.html">QFont</a> QAction.font (<i>self</i>)</h3><h3 class="fn"><a name="hover" />QAction.hover (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void hover()</tt>.</p><p>This is a convenience slot that calls activate(Hover).</p> <h3 class="fn"><a name="icon" /><a href="qicon.html">QIcon</a> QAction.icon (<i>self</i>)</h3><h3 class="fn"><a name="iconText" />QString QAction.iconText (<i>self</i>)</h3><h3 class="fn"><a name="isCheckable" />bool QAction.isCheckable (<i>self</i>)</h3><h3 class="fn"><a name="isChecked" />bool QAction.isChecked (<i>self</i>)</h3><h3 class="fn"><a name="isEnabled" />bool QAction.isEnabled (<i>self</i>)</h3><h3 class="fn"><a name="isIconVisibleInMenu" />bool QAction.isIconVisibleInMenu (<i>self</i>)</h3><h3 class="fn"><a name="isSeparator" />bool QAction.isSeparator (<i>self</i>)</h3><p>Returns true if this action is a separator action; otherwise it returns false.</p> <p><b>See also</b> <a href="qaction.html#setSeparator">QAction.setSeparator</a>().</p> <h3 class="fn"><a name="isVisible" />bool QAction.isVisible (<i>self</i>)</h3><h3 class="fn"><a name="menu" /><a href="qmenu.html">QMenu</a> QAction.menu (<i>self</i>)</h3><p>Returns the menu contained by this action. Actions that contain menus can be used to create menu items with submenus, or inserted into toolbars to create buttons with popup menus.</p> <p><b>See also</b> <a href="qaction.html#setMenu">setMenu</a>() and <a href="qmenu.html#addAction">QMenu.addAction</a>().</p> <h3 class="fn"><a name="menuRole" /><a href="qaction.html#MenuRole-enum">MenuRole</a> QAction.menuRole (<i>self</i>)</h3><h3 class="fn"><a name="parentWidget" /><a href="qwidget.html">QWidget</a> QAction.parentWidget (<i>self</i>)</h3><p>Returns the parent widget.</p> <h3 class="fn"><a name="priority" /><a href="qaction.html#Priority-enum">Priority</a> QAction.priority (<i>self</i>)</h3><h3 class="fn"><a name="setActionGroup" />QAction.setActionGroup (<i>self</i>, <a href="qactiongroup.html">QActionGroup</a> <i>group</i>)</h3><p>Sets this action group to <i>group</i>. The action will be automatically added to the group's list of actions.</p> <p>Actions within the group will be mutually exclusive.</p> <p><b>See also</b> <a href="qactiongroup.html">QActionGroup</a> and <a href="qaction.html#actionGroup">QAction.actionGroup</a>().</p> <h3 class="fn"><a name="setAutoRepeat" />QAction.setAutoRepeat (<i>self</i>, bool)</h3><h3 class="fn"><a name="setCheckable" />QAction.setCheckable (<i>self</i>, bool)</h3><h3 class="fn"><a name="setChecked" />QAction.setChecked (<i>self</i>, bool)</h3><p>This method is also a Qt slot with the C++ signature <tt>void setChecked(bool)</tt>.</p><h3 class="fn"><a name="setData" />QAction.setData (<i>self</i>, QVariant <i>var</i>)</h3><p>Sets the action's internal data to the given <i>userData</i>.</p> <p><b>See also</b> <a href="qaction.html#data">data</a>().</p> <h3 class="fn"><a name="setDisabled" />QAction.setDisabled (<i>self</i>, bool <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="qaction.html#enabled-prop">enabled</a> property, that is useful for signals--slots connections. If <i>b</i> is true the action is disabled; otherwise it is enabled.</p> <h3 class="fn"><a name="setEnabled" />QAction.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="setFont" />QAction.setFont (<i>self</i>, <a href="qfont.html">QFont</a> <i>font</i>)</h3><h3 class="fn"><a name="setIcon" />QAction.setIcon (<i>self</i>, <a href="qicon.html">QIcon</a> <i>icon</i>)</h3><h3 class="fn"><a name="setIconText" />QAction.setIconText (<i>self</i>, QString <i>text</i>)</h3><h3 class="fn"><a name="setIconVisibleInMenu" />QAction.setIconVisibleInMenu (<i>self</i>, bool <i>visible</i>)</h3><h3 class="fn"><a name="setMenu" />QAction.setMenu (<i>self</i>, <a href="qmenu.html">QMenu</a> <i>menu</i>)</h3><p>Sets the menu contained by this action to the specified <i>menu</i>.</p> <p><b>See also</b> <a href="qaction.html#menu">menu</a>().</p> <h3 class="fn"><a name="setMenuRole" />QAction.setMenuRole (<i>self</i>, <a href="qaction.html#MenuRole-enum">MenuRole</a> <i>menuRole</i>)</h3><h3 class="fn"><a name="setPriority" />QAction.setPriority (<i>self</i>, <a href="qaction.html#Priority-enum">Priority</a> <i>priority</i>)</h3><h3 class="fn"><a name="setSeparator" />QAction.setSeparator (<i>self</i>, bool <i>b</i>)</h3><p>If <i>b</i> is true then this action will be considered a separator.</p> <p>How a separator is represented depends on the widget it is inserted into. Under most circumstances the text, submenu, and icon will be ignored for separator actions.</p> <p><b>See also</b> <a href="qaction.html#isSeparator">QAction.isSeparator</a>().</p> <h3 class="fn"><a name="setShortcut" />QAction.setShortcut (<i>self</i>, <a href="qkeysequence.html">QKeySequence</a> <i>shortcut</i>)</h3><h3 class="fn"><a name="setShortcutContext" />QAction.setShortcutContext (<i>self</i>, <a href="qt.html#ShortcutContext-enum">Qt.ShortcutContext</a> <i>context</i>)</h3><h3 class="fn"><a name="setShortcuts" />QAction.setShortcuts (<i>self</i>, list-of-QKeySequence <i>shortcuts</i>)</h3><p>Sets <i>shortcuts</i> as the list of shortcuts that trigger the action. The first element of the list is the primary shortcut.</p> <p>This function was introduced in Qt 4.2.</p> <p><b>See also</b> <a href="qaction.html#shortcuts">shortcuts</a>() and <a href="qaction.html#shortcut-prop">shortcut</a>.</p> <h3 class="fn"><a name="setShortcuts-2" />QAction.setShortcuts (<i>self</i>, <a href="qkeysequence.html#StandardKey-enum">QKeySequence.StandardKey</a>)</h3><p>Sets a platform dependent list of shortcuts based on the <i>key</i>. The result of calling this function will depend on the currently running platform. Note that more than one shortcut can assigned by this action. If only the primary shortcut is required, use setShortcut instead.</p> <p>This function was introduced in Qt 4.2.</p> <p><b>See also</b> <a href="qkeysequence.html#keyBindings">QKeySequence.keyBindings</a>().</p> <h3 class="fn"><a name="setSoftKeyRole" />QAction.setSoftKeyRole (<i>self</i>, <a href="qaction.html#SoftKeyRole-enum">SoftKeyRole</a> <i>softKeyRole</i>)</h3><h3 class="fn"><a name="setStatusTip" />QAction.setStatusTip (<i>self</i>, QString <i>statusTip</i>)</h3><h3 class="fn"><a name="setText" />QAction.setText (<i>self</i>, QString <i>text</i>)</h3><h3 class="fn"><a name="setToolTip" />QAction.setToolTip (<i>self</i>, QString <i>tip</i>)</h3><h3 class="fn"><a name="setVisible" />QAction.setVisible (<i>self</i>, bool)</h3><p>This method is also a Qt slot with the C++ signature <tt>void setVisible(bool)</tt>.</p><h3 class="fn"><a name="setWhatsThis" />QAction.setWhatsThis (<i>self</i>, QString <i>what</i>)</h3><h3 class="fn"><a name="shortcut" /><a href="qkeysequence.html">QKeySequence</a> QAction.shortcut (<i>self</i>)</h3><h3 class="fn"><a name="shortcutContext" /><a href="qt.html#ShortcutContext-enum">Qt.ShortcutContext</a> QAction.shortcutContext (<i>self</i>)</h3><h3 class="fn"><a name="shortcuts" />list-of-QKeySequence QAction.shortcuts (<i>self</i>)</h3><p>Returns the list of shortcuts, with the primary shortcut as the first element of the list.</p> <p>This function was introduced in Qt 4.2.</p> <p><b>See also</b> <a href="qaction.html#setShortcuts">setShortcuts</a>().</p> <h3 class="fn"><a name="showStatusText" />bool QAction.showStatusText (<i>self</i>, <a href="qwidget.html">QWidget</a> <i>widget</i> = None)</h3><p>Updates the relevant status bar for the <i>widget</i> specified by sending a <a href="qstatustipevent.html">QStatusTipEvent</a> to its parent widget. Returns true if an event was sent; otherwise returns false.</p> <p>If a null widget is specified, the event is sent to the action's parent.</p> <p><b>See also</b> <a href="qaction.html#statusTip-prop">statusTip</a>.</p> <h3 class="fn"><a name="softKeyRole" /><a href="qaction.html#SoftKeyRole-enum">SoftKeyRole</a> QAction.softKeyRole (<i>self</i>)</h3><h3 class="fn"><a name="statusTip" />QString QAction.statusTip (<i>self</i>)</h3><h3 class="fn"><a name="text" />QString QAction.text (<i>self</i>)</h3><h3 class="fn"><a name="toggle" />QAction.toggle (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void toggle()</tt>.</p><p>This is a convenience function for the <a href="qaction.html#checked-prop">checked</a> property. Connect to it to change the checked state to its opposite state.</p> <h3 class="fn"><a name="toolTip" />QString QAction.toolTip (<i>self</i>)</h3><h3 class="fn"><a name="trigger" />QAction.trigger (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void trigger()</tt>.</p><p>This is a convenience slot that calls activate(Trigger).</p> <h3 class="fn"><a name="whatsThis" />QString QAction.whatsThis (<i>self</i>)</h3><hr /><h2>Qt Signal Documentation</h2><h3 class="fn"><a name="changed" />void changed ()</h3><p>This is the default overload of this signal.</p><p>This signal is emitted when an action has changed. If you are only interested in actions in a given widget, you can watch for <a href="qwidget.html#actionEvent">QWidget.actionEvent</a>() sent with an <a href="qevent.html#Type-enum">QEvent.ActionChanged</a>.</p> <p><b>See also</b> <a href="qwidget.html#actionEvent">QWidget.actionEvent</a>().</p> <h3 class="fn"><a name="hovered" />void hovered ()</h3><p>This is the default overload of this signal.</p><p>This signal is emitted when an action 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> <h3 class="fn"><a name="toggled" />void toggled (bool)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted whenever a checkable action changes its <a href="qaction.html#checked-prop">isChecked</a>() status. This can be the result of a user interaction, or because <a href="qaction.html#checked-prop">setChecked</a>() was called.</p> <p><i>checked</i> is true if the action is checked, or false if the action is unchecked.</p> <p><b>See also</b> <a href="qaction.html#activate">QAction.activate</a>(), <a href="qaction.html#triggered">QAction.triggered</a>(), and <a href="qaction.html#checked-prop">checked</a>.</p> <h3 class="fn"><a name="triggered" />void triggered (bool = 0)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted when an action is activated by the user; for example, when the user clicks a menu option, toolbar button, or presses an action's shortcut key combination, or when <a href="qaction.html#trigger">trigger</a>() was called. Notably, it is <i>not</i> emitted when <a href="qaction.html#checked-prop">setChecked</a>() or <a href="qaction.html#toggle">toggle</a>() is called.</p> <p>If the action is checkable, <i>checked</i> is true if the action is checked, or false if the action is unchecked.</p> <p><b>See also</b> <a href="qaction.html#activate">QAction.activate</a>(), <a href="qaction.html#toggled">QAction.toggled</a>(), and <a href="qaction.html#checked-prop">checked</a>.</p> <address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt 4.10.3 for X11</td><td align="center" width="50%">Copyright © <a href="http://www.riverbankcomputing.com">Riverbank Computing Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt 4.8.5</td></tr></table></div></address></body></html>