You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
521 lines
35 KiB
521 lines
35 KiB
13 years ago
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||
|
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/widgets/qaction.cpp:52 -->
|
||
|
<html>
|
||
|
<head>
|
||
|
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||
|
<title>TQAction Class</title>
|
||
|
<style type="text/css"><!--
|
||
|
fn { margin-left: 1cm; text-indent: -1cm; }
|
||
|
a:link { color: #004faf; text-decoration: none }
|
||
|
a:visited { color: #672967; text-decoration: none }
|
||
|
body { background: #ffffff; color: black; }
|
||
|
--></style>
|
||
|
</head>
|
||
|
<body>
|
||
|
|
||
|
<table border="0" cellpadding="0" cellspacing="0" width="100%">
|
||
|
<tr bgcolor="#E5E5E5">
|
||
|
<td 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="mainclasses.html">
|
||
|
<font color="#004faf">Main Classes</font></a>
|
||
|
| <a href="annotated.html">
|
||
|
<font color="#004faf">Annotated</font></a>
|
||
|
| <a href="groups.html">
|
||
|
<font color="#004faf">Grouped Classes</font></a>
|
||
|
| <a href="functions.html">
|
||
|
<font color="#004faf">Functions</font></a>
|
||
|
</td>
|
||
|
<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>TQAction Class Reference</h1>
|
||
|
|
||
|
<p>The TQAction class provides an abstract user interface
|
||
|
action that can appear both in menus and tool bars.
|
||
|
<a href="#details">More...</a>
|
||
13 years ago
|
<p><tt>#include <<a href="qaction-h.html">ntqaction.h</a>></tt>
|
||
|
<p>Inherits <a href="ntqobject.html">TQObject</a>.
|
||
13 years ago
|
<p>Inherited by <a href="qactiongroup.html">TQActionGroup</a>.
|
||
|
<p><a href="qaction-members.html">List of all member functions.</a>
|
||
|
<h2>Public Members</h2>
|
||
|
<ul>
|
||
|
<li class=fn><a href="#TQAction"><b>TQAction</b></a> ( TQObject * parent, const char * name = 0 )</li>
|
||
|
<li class=fn><a href="#TQAction-2"><b>TQAction</b></a> ( const TQString & menuText, TQKeySequence accel, TQObject * parent, const char * name = 0 )</li>
|
||
|
<li class=fn><a href="#TQAction-3"><b>TQAction</b></a> ( const TQIconSet & icon, const TQString & menuText, TQKeySequence accel, TQObject * parent, const char * name = 0 )</li>
|
||
|
<li class=fn>TQAction ( const TQString & text, const TQIconSet & icon, const TQString & menuText, TQKeySequence accel, TQObject * parent, const char * name = 0, bool toggle = FALSE ) <em>(obsolete)</em></li>
|
||
|
<li class=fn>TQAction ( const TQString & text, const TQString & menuText, TQKeySequence accel, TQObject * parent, const char * name = 0, bool toggle = FALSE ) <em>(obsolete)</em></li>
|
||
|
<li class=fn>TQAction ( TQObject * parent, const char * name, bool toggle ) <em>(obsolete)</em></li>
|
||
|
<li class=fn><a href="#~TQAction"><b>~TQAction</b></a> ()</li>
|
||
|
<li class=fn>virtual void <a href="#setIconSet"><b>setIconSet</b></a> ( const TQIconSet & )</li>
|
||
|
<li class=fn>TQIconSet <a href="#iconSet"><b>iconSet</b></a> () const</li>
|
||
|
<li class=fn>virtual void <a href="#setText"><b>setText</b></a> ( const TQString & )</li>
|
||
|
<li class=fn>TQString <a href="#text"><b>text</b></a> () const</li>
|
||
|
<li class=fn>virtual void <a href="#setMenuText"><b>setMenuText</b></a> ( const TQString & )</li>
|
||
|
<li class=fn>TQString <a href="#menuText"><b>menuText</b></a> () const</li>
|
||
|
<li class=fn>virtual void <a href="#setToolTip"><b>setToolTip</b></a> ( const TQString & )</li>
|
||
|
<li class=fn>TQString <a href="#toolTip"><b>toolTip</b></a> () const</li>
|
||
|
<li class=fn>virtual void <a href="#setStatusTip"><b>setStatusTip</b></a> ( const TQString & )</li>
|
||
|
<li class=fn>TQString <a href="#statusTip"><b>statusTip</b></a> () const</li>
|
||
|
<li class=fn>virtual void <a href="#setWhatsThis"><b>setWhatsThis</b></a> ( const TQString & )</li>
|
||
|
<li class=fn>TQString <a href="#whatsThis"><b>whatsThis</b></a> () const</li>
|
||
|
<li class=fn>virtual void <a href="#setAccel"><b>setAccel</b></a> ( const TQKeySequence & key )</li>
|
||
|
<li class=fn>TQKeySequence <a href="#accel"><b>accel</b></a> () const</li>
|
||
|
<li class=fn>virtual void <a href="#setToggleAction"><b>setToggleAction</b></a> ( bool )</li>
|
||
|
<li class=fn>bool <a href="#isToggleAction"><b>isToggleAction</b></a> () const</li>
|
||
|
<li class=fn>bool <a href="#isOn"><b>isOn</b></a> () const</li>
|
||
|
<li class=fn>bool <a href="#isEnabled"><b>isEnabled</b></a> () const</li>
|
||
|
<li class=fn>bool <a href="#isVisible"><b>isVisible</b></a> () const</li>
|
||
|
<li class=fn>virtual bool <a href="#addTo"><b>addTo</b></a> ( TQWidget * w )</li>
|
||
|
<li class=fn>virtual bool <a href="#removeFrom"><b>removeFrom</b></a> ( TQWidget * w )</li>
|
||
|
</ul>
|
||
|
<h2>Public Slots</h2>
|
||
|
<ul>
|
||
|
<li class=fn>void <a href="#activate"><b>activate</b></a> ()</li>
|
||
|
<li class=fn>void <a href="#toggle"><b>toggle</b></a> ()</li>
|
||
|
<li class=fn>virtual void <a href="#setOn"><b>setOn</b></a> ( bool )</li>
|
||
|
<li class=fn>virtual void <a href="#setEnabled"><b>setEnabled</b></a> ( bool )</li>
|
||
|
<li class=fn>void <a href="#setDisabled"><b>setDisabled</b></a> ( bool disable )</li>
|
||
|
<li class=fn>void <a href="#setVisible"><b>setVisible</b></a> ( bool )</li>
|
||
|
</ul>
|
||
|
<h2>Signals</h2>
|
||
|
<ul>
|
||
|
<li class=fn>void <a href="#activated"><b>activated</b></a> ()</li>
|
||
|
<li class=fn>void <a href="#toggled"><b>toggled</b></a> ( bool on )</li>
|
||
|
</ul>
|
||
|
<h2>Properties</h2>
|
||
|
<ul>
|
||
|
<li class=fn>TQKeySequence <a href="#accel-prop"><b>accel</b></a> - the action's accelerator key</li>
|
||
|
<li class=fn>bool <a href="#enabled-prop"><b>enabled</b></a> - whether the action is enabled</li>
|
||
|
<li class=fn>TQIconSet <a href="#iconSet-prop"><b>iconSet</b></a> - the action's icon</li>
|
||
|
<li class=fn>TQString <a href="#menuText-prop"><b>menuText</b></a> - the action's menu text</li>
|
||
|
<li class=fn>bool <a href="#on-prop"><b>on</b></a> - whether a toggle action is on</li>
|
||
|
<li class=fn>TQString <a href="#statusTip-prop"><b>statusTip</b></a> - the action's status tip</li>
|
||
|
<li class=fn>TQString <a href="#text-prop"><b>text</b></a> - the action's descriptive text</li>
|
||
|
<li class=fn>bool <a href="#toggleAction-prop"><b>toggleAction</b></a> - whether the action is a toggle action</li>
|
||
|
<li class=fn>TQString <a href="#toolTip-prop"><b>toolTip</b></a> - the action's tool tip</li>
|
||
|
<li class=fn>bool <a href="#visible-prop"><b>visible</b></a> - whether the action can be seen (e.g. in menus and toolbars)</li>
|
||
|
<li class=fn>TQString <a href="#whatsThis-prop"><b>whatsThis</b></a> - the action's "What's This?" help text</li>
|
||
|
</ul>
|
||
|
<h2>Protected Members</h2>
|
||
|
<ul>
|
||
|
<li class=fn>virtual void <a href="#addedTo"><b>addedTo</b></a> ( TQWidget * actionWidget, TQWidget * container )</li>
|
||
|
<li class=fn>virtual void <a href="#addedTo-2"><b>addedTo</b></a> ( int index, TQPopupMenu * menu )</li>
|
||
|
</ul>
|
||
|
<hr><a name="details"></a><h2>Detailed Description</h2>
|
||
|
|
||
|
|
||
|
The TQAction class provides an abstract user interface
|
||
|
action that can appear both in menus and tool bars.
|
||
|
<p>
|
||
|
|
||
|
|
||
|
<p> In GUI applications many commands can be invoked via a menu
|
||
|
option, a toolbar button and a keyboard accelerator. Since the
|
||
|
same action must be performed regardless of how the action was
|
||
|
invoked, and since the menu and toolbar should be kept in sync, it
|
||
|
is useful to represent a command as an <em>action</em>. An action can be
|
||
|
added to a menu and a toolbar and will automatically keep them in
|
||
|
sync. For example, if the user presses a Bold toolbar button the
|
||
|
Bold menu item will automatically be checked.
|
||
|
<p> A TQAction may contain an icon, a menu text, an accelerator, a
|
||
|
status text, a whats this text and a tool tip. Most of these can
|
||
|
be set in the constructor. They can also be set independently with
|
||
|
<a href="#setIconSet">setIconSet</a>(), <a href="#setText">setText</a>(), <a href="#setMenuText">setMenuText</a>(), <a href="#setToolTip">setToolTip</a>(),
|
||
|
<a href="#setStatusTip">setStatusTip</a>(), <a href="#setWhatsThis">setWhatsThis</a>() and <a href="#setAccel">setAccel</a>().
|
||
|
<p> An action may be a toggle action e.g. a Bold toolbar button, or a
|
||
|
command action, e.g. 'Open File' to invoke an open file dialog.
|
||
|
Toggle actions emit the <a href="#toggled">toggled</a>() signal when their state changes.
|
||
|
Both command and toggle actions emit the <a href="#activated">activated</a>() signal when
|
||
|
they are invoked. Use <a href="#setToggleAction">setToggleAction</a>() to set an action's toggled
|
||
|
status. To see if an action is a toggle action use
|
||
|
<a href="#isToggleAction">isToggleAction</a>(). A toggle action may be "on", <a href="#isOn">isOn</a>() returns
|
||
|
TRUE, or "off", isOn() returns FALSE.
|
||
|
<p> Actions are added to widgets (menus or toolbars) using <a href="#addTo">addTo</a>(),
|
||
|
and removed using <a href="#removeFrom">removeFrom</a>().
|
||
|
<p> Once a TQAction has been created it should be added to the relevant
|
||
|
menu and toolbar and then connected to the slot which will perform
|
||
|
the action. For example:
|
||
|
<p>
|
||
|
|
||
|
<pre> fileOpenAction = new TQAction( TQPixmap( fileopen ), "&Open...",
|
||
|
CTRL+Key_O, this, "open" );
|
||
13 years ago
|
<a href="ntqobject.html#connect">connect</a>( fileOpenAction, SIGNAL( <a href="#activated">activated</a>() ) , this, SLOT( choose() ) );
|
||
13 years ago
|
</pre>
|
||
|
<p> We create a "File Save" action with a menu text of "&Save" and
|
||
|
<em>Ctrl+S</em> as the keyboard accelerator. We connect the
|
||
|
fileSaveAction's <a href="#activated">activated</a>() signal to our own save() slot. Note
|
||
|
that at this point there is no menu or toolbar action, we'll add
|
||
|
them next:
|
||
13 years ago
|
<p> <pre> <a href="ntqtoolbar.html">TQToolBar</a> * fileTools = new <a href="ntqtoolbar.html">TQToolBar</a>( this, "file operations" );
|
||
13 years ago
|
</pre><pre> fileSaveAction-><a href="#addTo">addTo</a>( fileTools );
|
||
13 years ago
|
</pre><pre> <a href="ntqpopupmenu.html">TQPopupMenu</a> * file = new <a href="ntqpopupmenu.html">TQPopupMenu</a>( this );
|
||
|
<a href="ntqmainwindow.html#menuBar">menuBar</a>()->insertItem( "&File", file );
|
||
13 years ago
|
</pre><pre> fileSaveAction-><a href="#addTo">addTo</a>( file );
|
||
|
</pre>
|
||
|
<p> We create a toolbar and add our fileSaveAction to it. Similarly we
|
||
|
create a menu, add a top-level menu item, and add our
|
||
|
fileSaveAction.
|
||
|
<p> We recommend that actions are created as children of the window
|
||
|
that they are used in. In most cases actions will be children of
|
||
|
the application's main window.
|
||
|
<p> To prevent recursion, don't create an action as a child of a
|
||
|
widget that the action is later added to.
|
||
|
<p>See also <a href="application.html">Main Window and Related Classes</a> and <a href="basic.html">Basic Widgets</a>.
|
||
|
|
||
|
<hr><h2>Member Function Documentation</h2>
|
||
13 years ago
|
<h3 class=fn><a name="TQAction"></a>TQAction::TQAction ( <a href="ntqobject.html">TQObject</a> * parent, const char * name = 0 )
|
||
13 years ago
|
</h3>
|
||
|
Constructs an action called <em>name</em> with parent <em>parent</em>.
|
||
|
<p> If <em>parent</em> is a <a href="qactiongroup.html">TQActionGroup</a>, the new action inserts itself into
|
||
|
<em>parent</em>.
|
||
|
<p> For accelerators and status tips to work, <em>parent</em> must either be
|
||
|
a widget, or an action group whose parent is a widget.
|
||
|
<p> <b>Warning:</b> To prevent recursion, don't create an action as a child
|
||
|
of a widget that the action is later added to.
|
||
|
|
||
13 years ago
|
<h3 class=fn><a name="TQAction-2"></a>TQAction::TQAction ( const <a href="ntqstring.html">TQString</a> & menuText, <a href="ntqkeysequence.html">TQKeySequence</a> accel, <a href="ntqobject.html">TQObject</a> * parent, const char * name = 0 )
|
||
13 years ago
|
</h3>
|
||
|
This constructor results in an icon-less action with the the menu
|
||
|
text <em>menuText</em> and keyboard accelerator <em>accel</em>. It is a child
|
||
|
of <em>parent</em> and called <em>name</em>.
|
||
|
<p> If <em>parent</em> is a <a href="qactiongroup.html">TQActionGroup</a>, the action automatically becomes
|
||
|
a member of it.
|
||
|
<p> For accelerators and status tips to work, <em>parent</em> must either be
|
||
|
a widget, or an action group whose parent is a widget.
|
||
|
<p> The action uses a stripped version of <em>menuText</em> (e.g. "&Menu
|
||
|
Option..." becomes "Menu Option") as descriptive text for
|
||
|
toolbuttons. You can override this by setting a specific
|
||
|
description with <a href="#setText">setText</a>(). The same text and <em>accel</em> will be
|
||
|
used for tool tips and status tips unless you provide text for
|
||
|
these using <a href="#setToolTip">setToolTip</a>() and <a href="#setStatusTip">setStatusTip</a>().
|
||
|
<p> Call <a href="#setToggleAction">setToggleAction</a>(TRUE) to make the action a toggle action.
|
||
|
<p> <b>Warning:</b> To prevent recursion, don't create an action as a child
|
||
|
of a widget that the action is later added to.
|
||
|
|
||
13 years ago
|
<h3 class=fn><a name="TQAction-3"></a>TQAction::TQAction ( const <a href="ntqiconset.html">TQIconSet</a> & icon, const <a href="ntqstring.html">TQString</a> & menuText, <a href="ntqkeysequence.html">TQKeySequence</a> accel, <a href="ntqobject.html">TQObject</a> * parent, const char * name = 0 )
|
||
13 years ago
|
</h3>
|
||
|
This constructor creates an action with the following properties:
|
||
|
the icon or iconset <em>icon</em>, the menu text <em>menuText</em> and
|
||
|
keyboard accelerator <em>accel</em>. It is a child of <em>parent</em> and
|
||
|
called <em>name</em>.
|
||
|
<p> If <em>parent</em> is a <a href="qactiongroup.html">TQActionGroup</a>, the action automatically becomes
|
||
|
a member of it.
|
||
|
<p> For accelerators and status tips to work, <em>parent</em> must either be
|
||
|
a widget, or an action group whose parent is a widget.
|
||
|
<p> The action uses a stripped version of <em>menuText</em> (e.g. "&Menu
|
||
|
Option..." becomes "Menu Option") as descriptive text for
|
||
|
toolbuttons. You can override this by setting a specific
|
||
|
description with <a href="#setText">setText</a>(). The same text and <em>accel</em> will be
|
||
|
used for tool tips and status tips unless you provide text for
|
||
|
these using <a href="#setToolTip">setToolTip</a>() and <a href="#setStatusTip">setStatusTip</a>().
|
||
|
<p> Call <a href="#setToggleAction">setToggleAction</a>(TRUE) to make the action a toggle action.
|
||
|
<p> <b>Warning:</b> To prevent recursion, don't create an action as a child
|
||
|
of a widget that the action is later added to.
|
||
|
|
||
13 years ago
|
<h3 class=fn><a name="TQAction-4"></a>TQAction::TQAction ( const <a href="ntqstring.html">TQString</a> & text, const <a href="ntqiconset.html">TQIconSet</a> & icon, const <a href="ntqstring.html">TQString</a> & menuText, <a href="ntqkeysequence.html">TQKeySequence</a> accel, <a href="ntqobject.html">TQObject</a> * parent, const char * name = 0, bool toggle = FALSE )
|
||
13 years ago
|
</h3> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
|
||
|
<p> This constructor creates an action with the following properties:
|
||
|
the description <em>text</em>, the icon or iconset <em>icon</em>, the menu
|
||
|
text <em>menuText</em> and keyboard accelerator <em>accel</em>. It is a child
|
||
|
of <em>parent</em> and called <em>name</em>. If <em>toggle</em> is TRUE the action
|
||
|
will be a toggle action, otherwise it will be a command action.
|
||
|
<p> If <em>parent</em> is a <a href="qactiongroup.html">TQActionGroup</a>, the action automatically becomes
|
||
|
a member of it.
|
||
|
<p> For accelerators and status tips to work, <em>parent</em> must either be
|
||
|
a widget, or an action group whose parent is a widget.
|
||
|
<p> The <em>text</em> and <em>accel</em> will be used for tool tips and status
|
||
|
tips unless you provide specific text for these using <a href="#setToolTip">setToolTip</a>()
|
||
|
and <a href="#setStatusTip">setStatusTip</a>().
|
||
|
|
||
13 years ago
|
<h3 class=fn><a name="TQAction-5"></a>TQAction::TQAction ( const <a href="ntqstring.html">TQString</a> & text, const <a href="ntqstring.html">TQString</a> & menuText, <a href="ntqkeysequence.html">TQKeySequence</a> accel, <a href="ntqobject.html">TQObject</a> * parent, const char * name = 0, bool toggle = FALSE )
|
||
13 years ago
|
</h3> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
|
||
|
<p> This constructor results in an icon-less action with the
|
||
|
description <em>text</em>, the menu text <em>menuText</em> and the keyboard
|
||
|
accelerator <em>accel</em>. Its parent is <em>parent</em> and it is called <em>name</em>. If <em>toggle</em> is TRUE the action will be a toggle action,
|
||
|
otherwise it will be a command action.
|
||
|
<p> The action automatically becomes a member of <em>parent</em> if <em>parent</em> is a <a href="qactiongroup.html">TQActionGroup</a>.
|
||
|
<p> For accelerators and status tips to work, <em>parent</em> must either be
|
||
|
a widget, or an action group whose parent is a widget.
|
||
|
<p> The <em>text</em> and <em>accel</em> will be used for tool tips and status
|
||
|
tips unless you provide specific text for these using <a href="#setToolTip">setToolTip</a>()
|
||
|
and <a href="#setStatusTip">setStatusTip</a>().
|
||
|
|
||
13 years ago
|
<h3 class=fn><a name="TQAction-6"></a>TQAction::TQAction ( <a href="ntqobject.html">TQObject</a> * parent, const char * name, bool toggle )
|
||
13 years ago
|
</h3> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
|
||
|
<p> Constructs an action called <em>name</em> with parent <em>parent</em>.
|
||
|
<p> If <em>toggle</em> is TRUE the action will be a toggle action, otherwise
|
||
|
it will be a command action.
|
||
|
<p> If <em>parent</em> is a <a href="qactiongroup.html">TQActionGroup</a>, the new action inserts itself into
|
||
|
<em>parent</em>.
|
||
|
<p> For accelerators and status tips to work, <em>parent</em> must either be
|
||
|
a widget, or an action group whose parent is a widget.
|
||
|
|
||
|
<h3 class=fn><a name="~TQAction"></a>TQAction::~TQAction ()
|
||
|
</h3>
|
||
|
Destroys the object and frees allocated resources.
|
||
|
|
||
13 years ago
|
<h3 class=fn><a href="ntqkeysequence.html">TQKeySequence</a> <a name="accel"></a>TQAction::accel () const
|
||
13 years ago
|
</h3><p>Returns the action's accelerator key.
|
||
13 years ago
|
See the <a href="ntqaction.html#accel-prop">"accel"</a> property for details.
|
||
13 years ago
|
<h3 class=fn>void <a name="activate"></a>TQAction::activate ()<tt> [slot]</tt>
|
||
|
</h3>
|
||
|
Activates the action and executes all connected slots.
|
||
|
This only works for actions that are not toggle action.
|
||
|
<p> <p>See also <a href="#toggle">toggle</a>().
|
||
|
|
||
|
<h3 class=fn>void <a name="activated"></a>TQAction::activated ()<tt> [signal]</tt>
|
||
|
</h3>
|
||
|
|
||
|
<p> This signal is emitted when an action is activated by the user,
|
||
|
e.g. when the user clicks a menu option or a toolbar button or
|
||
|
presses an action's accelerator key combination.
|
||
|
<p> Connect to this signal for command actions. Connect to the
|
||
|
<a href="#toggled">toggled</a>() signal for toggle actions.
|
||
|
|
||
|
<p>Examples: <a href="qaction-application-example.html#x1123">action/application.cpp</a>, <a href="canvas-chart-example.html#x2869">chart/chartform.cpp</a>, and <a href="themes-example.html#x316">themes/themes.cpp</a>.
|
||
13 years ago
|
<h3 class=fn>bool <a name="addTo"></a>TQAction::addTo ( <a href="ntqwidget.html">TQWidget</a> * w )<tt> [virtual]</tt>
|
||
13 years ago
|
</h3>
|
||
|
Adds this action to widget <em>w</em>.
|
||
13 years ago
|
<p> Currently actions may be added to <a href="ntqtoolbar.html">TQToolBar</a> and <a href="ntqpopupmenu.html">TQPopupMenu</a> widgets.
|
||
13 years ago
|
<p> An action added to a tool bar is automatically displayed as a tool
|
||
|
button; an action added to a pop up menu appears as a menu option.
|
||
|
<p> <a href="#addTo">addTo</a>() returns TRUE if the action was added successfully and
|
||
|
FALSE otherwise. (If <em>w</em> is not a TQToolBar or TQPopupMenu the
|
||
|
action will not be added and FALSE will be returned.)
|
||
|
<p> <p>See also <a href="#removeFrom">removeFrom</a>().
|
||
|
|
||
|
<p>Examples: <a href="qaction-application-example.html#x1124">action/application.cpp</a>, <a href="toggleaction-example.html#x2971">action/toggleaction/toggleaction.cpp</a>, and <a href="canvas-chart-example.html#x2870">chart/chartform.cpp</a>.
|
||
|
<p>Reimplemented in <a href="qactiongroup.html#addTo">TQActionGroup</a>.
|
||
13 years ago
|
<h3 class=fn>void <a name="addedTo"></a>TQAction::addedTo ( <a href="ntqwidget.html">TQWidget</a> * actionWidget, <a href="ntqwidget.html">TQWidget</a> * container )<tt> [virtual protected]</tt>
|
||
13 years ago
|
</h3>
|
||
|
This function is called from the <a href="#addTo">addTo</a>() function when it has
|
||
|
created a widget (<em>actionWidget</em>) for the action in the <em>container</em>.
|
||
|
|
||
13 years ago
|
<h3 class=fn>void <a name="addedTo-2"></a>TQAction::addedTo ( int index, <a href="ntqpopupmenu.html">TQPopupMenu</a> * menu )<tt> [virtual protected]</tt>
|
||
13 years ago
|
</h3>
|
||
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
||
|
<p> This function is called from the <a href="#addTo">addTo</a>() function when it has
|
||
|
created a menu item at the index position <em>index</em> in the popup
|
||
|
menu <em>menu</em>.
|
||
|
|
||
13 years ago
|
<h3 class=fn><a href="ntqiconset.html">TQIconSet</a> <a name="iconSet"></a>TQAction::iconSet () const
|
||
13 years ago
|
</h3><p>Returns the action's icon.
|
||
13 years ago
|
See the <a href="ntqaction.html#iconSet-prop">"iconSet"</a> property for details.
|
||
13 years ago
|
<h3 class=fn>bool <a name="isEnabled"></a>TQAction::isEnabled () const
|
||
|
</h3><p>Returns TRUE if the action is enabled; otherwise returns FALSE.
|
||
13 years ago
|
See the <a href="ntqaction.html#enabled-prop">"enabled"</a> property for details.
|
||
13 years ago
|
<h3 class=fn>bool <a name="isOn"></a>TQAction::isOn () const
|
||
|
</h3><p>Returns TRUE if a toggle action is on; otherwise returns FALSE.
|
||
13 years ago
|
See the <a href="ntqaction.html#on-prop">"on"</a> property for details.
|
||
13 years ago
|
<h3 class=fn>bool <a name="isToggleAction"></a>TQAction::isToggleAction () const
|
||
|
</h3><p>Returns TRUE if the action is a toggle action; otherwise returns FALSE.
|
||
13 years ago
|
See the <a href="ntqaction.html#toggleAction-prop">"toggleAction"</a> property for details.
|
||
13 years ago
|
<h3 class=fn>bool <a name="isVisible"></a>TQAction::isVisible () const
|
||
|
</h3><p>Returns TRUE if the action can be seen (e.g. in menus and toolbars); otherwise returns FALSE.
|
||
13 years ago
|
See the <a href="ntqaction.html#visible-prop">"visible"</a> property for details.
|
||
|
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="menuText"></a>TQAction::menuText () const
|
||
13 years ago
|
</h3><p>Returns the action's menu text.
|
||
13 years ago
|
See the <a href="ntqaction.html#menuText-prop">"menuText"</a> property for details.
|
||
|
<h3 class=fn>bool <a name="removeFrom"></a>TQAction::removeFrom ( <a href="ntqwidget.html">TQWidget</a> * w )<tt> [virtual]</tt>
|
||
13 years ago
|
</h3>
|
||
|
Removes the action from widget <em>w</em>.
|
||
|
<p> Returns TRUE if the action was removed successfully; otherwise
|
||
|
returns FALSE.
|
||
|
<p> <p>See also <a href="#addTo">addTo</a>().
|
||
|
|
||
13 years ago
|
<h3 class=fn>void <a name="setAccel"></a>TQAction::setAccel ( const <a href="ntqkeysequence.html">TQKeySequence</a> & key )<tt> [virtual]</tt>
|
||
13 years ago
|
</h3><p>Sets the action's accelerator key to <em>key</em>.
|
||
13 years ago
|
See the <a href="ntqaction.html#accel-prop">"accel"</a> property for details.
|
||
13 years ago
|
<h3 class=fn>void <a name="setDisabled"></a>TQAction::setDisabled ( bool disable )<tt> [slot]</tt>
|
||
|
</h3>
|
||
|
Disables the action if <em>disable</em> is TRUE; otherwise
|
||
|
enables the action.
|
||
|
<p> See the <a href="#enabled-prop">enabled</a> documentation for more information.
|
||
|
|
||
|
<h3 class=fn>void <a name="setEnabled"></a>TQAction::setEnabled ( bool )<tt> [virtual slot]</tt>
|
||
|
</h3><p>Sets whether the action is enabled.
|
||
13 years ago
|
See the <a href="ntqaction.html#enabled-prop">"enabled"</a> property for details.
|
||
|
<h3 class=fn>void <a name="setIconSet"></a>TQAction::setIconSet ( const <a href="ntqiconset.html">TQIconSet</a> & )<tt> [virtual]</tt>
|
||
13 years ago
|
</h3><p>Sets the action's icon.
|
||
13 years ago
|
See the <a href="ntqaction.html#iconSet-prop">"iconSet"</a> property for details.
|
||
|
<h3 class=fn>void <a name="setMenuText"></a>TQAction::setMenuText ( const <a href="ntqstring.html">TQString</a> & )<tt> [virtual]</tt>
|
||
13 years ago
|
</h3><p>Sets the action's menu text.
|
||
13 years ago
|
See the <a href="ntqaction.html#menuText-prop">"menuText"</a> property for details.
|
||
13 years ago
|
<h3 class=fn>void <a name="setOn"></a>TQAction::setOn ( bool )<tt> [virtual slot]</tt>
|
||
|
</h3><p>Sets whether a toggle action is on.
|
||
13 years ago
|
See the <a href="ntqaction.html#on-prop">"on"</a> property for details.
|
||
|
<h3 class=fn>void <a name="setStatusTip"></a>TQAction::setStatusTip ( const <a href="ntqstring.html">TQString</a> & )<tt> [virtual]</tt>
|
||
13 years ago
|
</h3><p>Sets the action's status tip.
|
||
13 years ago
|
See the <a href="ntqaction.html#statusTip-prop">"statusTip"</a> property for details.
|
||
|
<h3 class=fn>void <a name="setText"></a>TQAction::setText ( const <a href="ntqstring.html">TQString</a> & )<tt> [virtual]</tt>
|
||
13 years ago
|
</h3><p>Sets the action's descriptive text.
|
||
13 years ago
|
See the <a href="ntqaction.html#text-prop">"text"</a> property for details.
|
||
13 years ago
|
<h3 class=fn>void <a name="setToggleAction"></a>TQAction::setToggleAction ( bool )<tt> [virtual]</tt>
|
||
|
</h3><p>Sets whether the action is a toggle action.
|
||
13 years ago
|
See the <a href="ntqaction.html#toggleAction-prop">"toggleAction"</a> property for details.
|
||
|
<h3 class=fn>void <a name="setToolTip"></a>TQAction::setToolTip ( const <a href="ntqstring.html">TQString</a> & )<tt> [virtual]</tt>
|
||
13 years ago
|
</h3><p>Sets the action's tool tip.
|
||
13 years ago
|
See the <a href="ntqaction.html#toolTip-prop">"toolTip"</a> property for details.
|
||
13 years ago
|
<h3 class=fn>void <a name="setVisible"></a>TQAction::setVisible ( bool )<tt> [slot]</tt>
|
||
|
</h3><p>Sets whether the action can be seen (e.g. in menus and toolbars).
|
||
13 years ago
|
See the <a href="ntqaction.html#visible-prop">"visible"</a> property for details.
|
||
|
<h3 class=fn>void <a name="setWhatsThis"></a>TQAction::setWhatsThis ( const <a href="ntqstring.html">TQString</a> & )<tt> [virtual]</tt>
|
||
13 years ago
|
</h3><p>Sets the action's "What's This?" help text.
|
||
13 years ago
|
See the <a href="ntqaction.html#whatsThis-prop">"whatsThis"</a> property for details.
|
||
|
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="statusTip"></a>TQAction::statusTip () const
|
||
13 years ago
|
</h3><p>Returns the action's status tip.
|
||
13 years ago
|
See the <a href="ntqaction.html#statusTip-prop">"statusTip"</a> property for details.
|
||
|
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="text"></a>TQAction::text () const
|
||
13 years ago
|
</h3><p>Returns the action's descriptive text.
|
||
13 years ago
|
See the <a href="ntqaction.html#text-prop">"text"</a> property for details.
|
||
13 years ago
|
<h3 class=fn>void <a name="toggle"></a>TQAction::toggle ()<tt> [slot]</tt>
|
||
|
</h3>
|
||
|
Toggles the state of a toggle action.
|
||
|
<p> <p>See also <a href="#on-prop">on</a>, <a href="#activate">activate</a>(), <a href="#toggled">toggled</a>(), and <a href="#toggleAction-prop">toggleAction</a>.
|
||
|
|
||
|
<h3 class=fn>void <a name="toggled"></a>TQAction::toggled ( bool on )<tt> [signal]</tt>
|
||
|
</h3>
|
||
|
|
||
|
<p> This signal is emitted when a toggle action changes state; command
|
||
|
actions and <a href="qactiongroup.html">TQActionGroup</a>s don't emit <a href="#toggled">toggled</a>().
|
||
|
<p> The <em>on</em> argument denotes the new state: If <em>on</em> is TRUE the
|
||
|
toggle action is switched on, and if <em>on</em> is FALSE the toggle
|
||
|
action is switched off.
|
||
|
<p> To trigger a user command depending on whether a toggle action has
|
||
|
been switched on or off connect it to a slot that takes a bool to
|
||
|
indicate the state, e.g.
|
||
|
<p>
|
||
|
|
||
13 years ago
|
<pre> <a href="ntqmainwindow.html">TQMainWindow</a> * window = new <a href="ntqmainwindow.html">TQMainWindow</a>;
|
||
13 years ago
|
</pre><pre> TQAction * labelonoffaction = new TQAction( window, "labelonoff" );
|
||
13 years ago
|
</pre><pre> <a name="x2108"></a> TQObject::<a href="ntqobject.html#connect">connect</a>( labelonoffaction, SIGNAL( <a href="#toggled">toggled</a>( bool ) ),
|
||
|
<a name="x2109"></a> window, SLOT( <a href="ntqmainwindow.html#setUsesTextLabel">setUsesTextLabel</a>( bool ) ) );
|
||
13 years ago
|
</pre>
|
||
|
<p> <p>See also <a href="#activated">activated</a>(), <a href="#toggleAction-prop">toggleAction</a>, and <a href="#on-prop">on</a>.
|
||
|
|
||
13 years ago
|
<p>Example: <a href="ntqaction.html#x2108">action/toggleaction/toggleaction.cpp</a>.
|
||
|
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="toolTip"></a>TQAction::toolTip () const
|
||
13 years ago
|
</h3><p>Returns the action's tool tip.
|
||
13 years ago
|
See the <a href="ntqaction.html#toolTip-prop">"toolTip"</a> property for details.
|
||
|
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="whatsThis"></a>TQAction::whatsThis () const
|
||
13 years ago
|
</h3><p>Returns the action's "What's This?" help text.
|
||
13 years ago
|
See the <a href="ntqaction.html#whatsThis-prop">"whatsThis"</a> property for details.
|
||
13 years ago
|
<hr><h2>Property Documentation</h2>
|
||
13 years ago
|
<h3 class=fn><a href="ntqkeysequence.html">TQKeySequence</a> <a name="accel-prop"></a>accel</h3>
|
||
13 years ago
|
<p>This property holds the action's accelerator key.
|
||
13 years ago
|
<p>The keycodes can be found in <a href="ntqt.html#Key-enum">TQt::Key</a> and <a href="ntqt.html#Modifier-enum">TQt::Modifier</a>. There
|
||
13 years ago
|
is no default accelerator key.
|
||
|
|
||
|
<p>Set this property's value with <a href="#setAccel">setAccel</a>() and get this property's value with <a href="#accel">accel</a>().
|
||
|
<h3 class=fn>bool <a name="enabled-prop"></a>enabled</h3>
|
||
|
<p>This property holds whether the action is enabled.
|
||
|
<p>Disabled actions can't be chosen by the user. They don't disappear
|
||
|
from the menu/tool bar but are displayed in a way which indicates
|
||
|
that they are unavailable, e.g. they might be displayed grayed
|
||
|
out.
|
||
|
<p> What's this? help on disabled actions is still available provided
|
||
|
the <a href="#whatsThis-prop">TQAction::whatsThis</a> property is set.
|
||
|
|
||
|
<p>Set this property's value with <a href="#setEnabled">setEnabled</a>() and get this property's value with <a href="#isEnabled">isEnabled</a>().
|
||
13 years ago
|
<h3 class=fn><a href="ntqiconset.html">TQIconSet</a> <a name="iconSet-prop"></a>iconSet</h3>
|
||
13 years ago
|
<p>This property holds the action's icon.
|
||
|
<p>The icon is used as the tool button icon and in the menu to the
|
||
|
left of the menu text. There is no default icon.
|
||
13 years ago
|
<p> If a null icon (<a href="ntqiconset.html#isNull">TQIconSet::isNull</a>() is passed into this function,
|
||
13 years ago
|
the icon of the action is cleared.
|
||
|
<p> (See the action/toggleaction/toggleaction.cpp example.)
|
||
|
<p>
|
||
|
<p>Set this property's value with <a href="#setIconSet">setIconSet</a>() and get this property's value with <a href="#iconSet">iconSet</a>().
|
||
13 years ago
|
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="menuText-prop"></a>menuText</h3>
|
||
13 years ago
|
<p>This property holds the action's menu text.
|
||
|
<p>If the action is added to a menu the menu option will consist of
|
||
|
the icon (if there is one), the menu text and the accelerator (if
|
||
|
there is one). If the menu text is not explicitly set in the
|
||
|
constructor or by using <a href="#setMenuText">setMenuText</a>() the action's description
|
||
|
text will be used as the menu text. There is no default menu text.
|
||
|
<p> <p>See also <a href="#text-prop">text</a>.
|
||
|
|
||
|
<p>Set this property's value with <a href="#setMenuText">setMenuText</a>() and get this property's value with <a href="#menuText">menuText</a>().
|
||
|
<h3 class=fn>bool <a name="on-prop"></a>on</h3>
|
||
|
<p>This property holds whether a toggle action is on.
|
||
|
<p>This property is always on (TRUE) for command actions and
|
||
|
<a href="qactiongroup.html">TQActionGroup</a>s; <a href="#setOn">setOn</a>() has no effect on them. For action's
|
||
|
where <a href="#isToggleAction">isToggleAction</a>() is TRUE, this property's default value is
|
||
|
off (FALSE).
|
||
|
<p> <p>See also <a href="#toggleAction-prop">toggleAction</a>.
|
||
|
|
||
|
<p>Set this property's value with <a href="#setOn">setOn</a>() and get this property's value with <a href="#isOn">isOn</a>().
|
||
13 years ago
|
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="statusTip-prop"></a>statusTip</h3>
|
||
13 years ago
|
<p>This property holds the action's status tip.
|
||
|
<p>The statusTip is displayed on all status bars that this action's
|
||
|
toplevel parent widget provides.
|
||
|
<p> If no status tip is defined, the action uses the tool tip text.
|
||
|
<p> There is no default statusTip text.
|
||
|
<p> <p>See also <a href="#statusTip-prop">statusTip</a> and <a href="#toolTip-prop">toolTip</a>.
|
||
|
|
||
|
<p>Set this property's value with <a href="#setStatusTip">setStatusTip</a>() and get this property's value with <a href="#statusTip">statusTip</a>().
|
||
13 years ago
|
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="text-prop"></a>text</h3>
|
||
13 years ago
|
<p>This property holds the action's descriptive text.
|
||
13 years ago
|
<p>If <a href="ntqmainwindow.html#usesTextLabel-prop">TQMainWindow::usesTextLabel</a> is TRUE, the text appears as a
|
||
13 years ago
|
label in the relevant tool button. It also serves as the default
|
||
|
text in menus and tool tips if these have not been specifically
|
||
|
defined. There is no default text.
|
||
|
<p> <p>See also <a href="#menuText-prop">menuText</a>, <a href="#toolTip-prop">toolTip</a>, and <a href="#statusTip-prop">statusTip</a>.
|
||
|
|
||
|
<p>Set this property's value with <a href="#setText">setText</a>() and get this property's value with <a href="#text">text</a>().
|
||
|
<h3 class=fn>bool <a name="toggleAction-prop"></a>toggleAction</h3>
|
||
|
<p>This property holds whether the action is a toggle action.
|
||
|
<p>A toggle action is one which has an on/off state. For example a
|
||
|
Bold toolbar button is either on or off. An action which is not a
|
||
|
toggle action is a command action; a command action is simply
|
||
|
executed, e.g. file save. This property's default is FALSE.
|
||
|
<p> In some situations, the state of one toggle action should depend
|
||
|
on the state of others. For example, "Left Align", "Center" and
|
||
|
"Right Align" toggle actions are mutually exclusive. To achieve
|
||
|
exclusive toggling, add the relevant toggle actions to a
|
||
|
<a href="qactiongroup.html">TQActionGroup</a> with the <a href="qactiongroup.html#exclusive-prop">TQActionGroup::exclusive</a> property set to
|
||
|
TRUE.
|
||
|
|
||
|
<p>Set this property's value with <a href="#setToggleAction">setToggleAction</a>() and get this property's value with <a href="#isToggleAction">isToggleAction</a>().
|
||
13 years ago
|
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="toolTip-prop"></a>toolTip</h3>
|
||
13 years ago
|
<p>This property holds the action's tool tip.
|
||
|
<p>This text is used for the tool tip. If no status tip has been set
|
||
|
the tool tip will be used for the status tip.
|
||
|
<p> If no tool tip is specified the action's text is used, and if that
|
||
|
hasn't been specified the description text is used as the tool tip
|
||
|
text.
|
||
|
<p> There is no default tool tip text.
|
||
|
<p> <p>See also <a href="#statusTip-prop">statusTip</a> and <a href="#accel-prop">accel</a>.
|
||
|
|
||
|
<p>Set this property's value with <a href="#setToolTip">setToolTip</a>() and get this property's value with <a href="#toolTip">toolTip</a>().
|
||
|
<h3 class=fn>bool <a name="visible-prop"></a>visible</h3>
|
||
|
<p>This property holds whether the action can be seen (e.g. in menus and toolbars).
|
||
|
<p>If <em>visible</em> is TRUE the action can be seen (e.g. in menus and
|
||
|
toolbars) and chosen by the user; if <em>visible</em> is FALSE the
|
||
|
action cannot be seen or chosen by the user.
|
||
|
<p> Actions which are not visible are <em>not</em> grayed out; they do not
|
||
|
appear at all.
|
||
|
|
||
|
<p>Set this property's value with <a href="#setVisible">setVisible</a>() and get this property's value with <a href="#isVisible">isVisible</a>().
|
||
13 years ago
|
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="whatsThis-prop"></a>whatsThis</h3>
|
||
13 years ago
|
<p>This property holds the action's "What's This?" help text.
|
||
|
<p>The whats this text is used to provide a brief description of the
|
||
|
action. The text may contain rich text (HTML-like tags -- see
|
||
13 years ago
|
<a href="ntqstylesheet.html">TQStyleSheet</a> for the list of supported tags). There is no default
|
||
13 years ago
|
"What's This" text.
|
||
13 years ago
|
<p> <p>See also <a href="ntqwhatsthis.html">TQWhatsThis</a>.
|
||
13 years ago
|
|
||
|
<p>Set this property's value with <a href="#setWhatsThis">setWhatsThis</a>() and get this property's value with <a href="#whatsThis">whatsThis</a>().
|
||
|
<!-- eof -->
|
||
|
<hr><p>
|
||
|
This file is part of the <a href="index.html">TQt toolkit</a>.
|
||
|
Copyright © 1995-2007
|
||
|
<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
|
||
|
<table width=100% cellspacing=0 border=0><tr>
|
||
|
<td>Copyright © 2007
|
||
|
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
||
|
<td align=right><div align=right>TQt 3.3.8</div>
|
||
|
</table></div></address></body>
|
||
|
</html>
|