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.
tqt3/doc/html/ntqradiobutton.html

279 lines
18 KiB

<!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/qradiobutton.cpp:50 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>TQRadioButton 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&nbsp;Classes</font></a>
| <a href="mainclasses.html">
<font color="#004faf">Main&nbsp;Classes</font></a>
| <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
| <a href="groups.html">
<font color="#004faf">Grouped&nbsp;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>TQRadioButton Class Reference</h1>
<p>The TQRadioButton widget provides a radio button with a text or pixmap label.
<a href="#details">More...</a>
<p><tt>#include &lt;<a href="qradiobutton-h.html">ntqradiobutton.h</a>&gt;</tt>
<p>Inherits <a href="ntqbutton.html">TQButton</a>.
<p><a href="qradiobutton-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li class=fn><a href="#TQRadioButton"><b>TQRadioButton</b></a> ( TQWidget&nbsp;*&nbsp;parent, const&nbsp;char&nbsp;*&nbsp;name = 0 )</li>
<li class=fn><a href="#TQRadioButton-2"><b>TQRadioButton</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;text, TQWidget&nbsp;*&nbsp;parent, const&nbsp;char&nbsp;*&nbsp;name = 0 )</li>
<li class=fn>bool <a href="#isChecked"><b>isChecked</b></a> () const</li>
</ul>
<h2>Public Slots</h2>
<ul>
<li class=fn>virtual void <a href="#setChecked"><b>setChecked</b></a> ( bool&nbsp;check )</li>
</ul>
<h2>Important Inherited Members</h2>
<ul>
<li class=fn>TQString <a href="#text"><b>text</b></a> () const</li>
<li class=fn>virtual void <a href="#setText"><b>setText</b></a> ( const TQString &amp; )</li>
<li class=fn>const TQPixmap * <a href="#pixmap"><b>pixmap</b></a> () const</li>
<li class=fn>virtual void <a href="#setPixmap"><b>setPixmap</b></a> ( const TQPixmap &amp; )</li>
<li class=fn>TQKeySequence <a href="#accel"><b>accel</b></a> () const</li>
<li class=fn>virtual void <a href="#setAccel"><b>setAccel</b></a> ( const TQKeySequence &amp; )</li>
<li class=fn>bool <a href="#isToggleButton"><b>isToggleButton</b></a> () const</li>
<li class=fn>virtual void <a href="#setDown"><b>setDown</b></a> ( bool )</li>
<li class=fn>bool <a href="#isDown"><b>isDown</b></a> () const</li>
<li class=fn>bool <a href="#isOn"><b>isOn</b></a> () const</li>
<li class=fn>ToggleState <a href="#state"><b>state</b></a> () const</li>
<li class=fn>bool <a href="#autoRepeat"><b>autoRepeat</b></a> () const</li>
<li class=fn>virtual void <a href="#setAutoRepeat"><b>setAutoRepeat</b></a> ( bool )</li>
<li class=fn>bool <a href="#isExclusiveToggle"><b>isExclusiveToggle</b></a> () const</li>
<li class=fn>TQButtonGroup * <a href="#group"><b>group</b></a> () const</li>
<li class=fn>void <a href="#toggle"><b>toggle</b></a> ()</li>
<li class=fn>void <a href="#pressed"><b>pressed</b></a> ()</li>
<li class=fn>void <a href="#released"><b>released</b></a> ()</li>
<li class=fn>void <a href="#clicked"><b>clicked</b></a> ()</li>
<li class=fn>void <a href="#toggled"><b>toggled</b></a> ( bool&nbsp;on )</li>
<li class=fn>void <a href="#stateChanged"><b>stateChanged</b></a> ( int&nbsp;state )</li>
</ul>
<h2>Properties</h2>
<ul>
<li class=fn>bool <a href="#autoMask-prop"><b>autoMask</b></a>&nbsp;- whether the radio button is automatically masked &nbsp;<em>(read only)</em></li>
<li class=fn>bool <a href="#checked-prop"><b>checked</b></a>&nbsp;- whether the radio button is checked</li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>
The TQRadioButton widget provides a radio button with a text or pixmap label.
<p>
<p> TQRadioButton and <a href="ntqcheckbox.html">TQCheckBox</a> are both option buttons. That is, they
can be switched on (checked) or off (unchecked). The classes
differ in how the choices for the user are restricted. Check boxes
define "many of many" choices, whereas radio buttons provide a
"one of many" choice. In a group of radio buttons only one radio
button at a time can be checked; if the user selects another
button, the previously selected button is switched off.
<p> The easiest way to implement a "one of many" choice is simply to
put the radio buttons into <a href="ntqbuttongroup.html">TQButtonGroup</a>.
<p> Whenever a button is switched on or off it emits the signal
<a href="ntqbutton.html#toggled">toggled</a>(). Connect to this signal if you want to trigger an action
each time the button changes state. Otherwise, use <a href="#isChecked">isChecked</a>() to
see if a particular button is selected.
<p> Just like <a href="ntqpushbutton.html">TQPushButton</a>, a radio button can display text or a
pixmap. The text can be set in the constructor or with <a href="ntqbutton.html#setText">setText</a>();
the pixmap is set with <a href="ntqbutton.html#setPixmap">setPixmap</a>().
<p> <img src=qradiobt-m.png> <img src=qradiobt-w.png>
<p>
<p> <p>See also <a href="ntqpushbutton.html">TQPushButton</a>, <a href="ntqtoolbutton.html">TQToolButton</a>, <a href="guibooks.html#fowler">GUI Design Handbook: Radio Button</a>, and <a href="basic.html">Basic Widgets</a>.
<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="TQRadioButton"></a>TQRadioButton::TQRadioButton ( <a href="ntqwidget.html">TQWidget</a>&nbsp;*&nbsp;parent, const&nbsp;char&nbsp;*&nbsp;name = 0 )
</h3>
Constructs a radio button with no text.
<p> The <em>parent</em> and <em>name</em> arguments are sent on to the <a href="ntqwidget.html">TQWidget</a>
constructor.
<h3 class=fn><a name="TQRadioButton-2"></a>TQRadioButton::TQRadioButton ( const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;text, <a href="ntqwidget.html">TQWidget</a>&nbsp;*&nbsp;parent, const&nbsp;char&nbsp;*&nbsp;name = 0 )
</h3>
Constructs a radio button with the text <em>text</em>.
<p> The <em>parent</em> and <em>name</em> arguments are sent on to the <a href="ntqwidget.html">TQWidget</a>
constructor.
<h3 class=fn><a href="ntqkeysequence.html">TQKeySequence</a> <a name="accel"></a>TQButton::accel () const
</h3><p>Returns the accelerator associated with the button.
See the <a href="ntqbutton.html#accel-prop">"accel"</a> property for details.
<h3 class=fn>bool <a name="autoRepeat"></a>TQButton::autoRepeat () const
</h3><p>Returns TRUE if autoRepeat is enabled; otherwise returns FALSE.
See the <a href="ntqbutton.html#autoRepeat-prop">"autoRepeat"</a> property for details.
<h3 class=fn>void <a name="clicked"></a>TQButton::clicked ()<tt> [signal]</tt>
</h3>
<p> This signal is emitted when the button is activated (i.e. first
pressed down and then released when the mouse cursor is inside the
button), when the accelerator key is typed or when <a href="ntqbutton.html#animateClick">animateClick</a>()
is called. This signal is <em>not</em> emitted if you call <a href="ntqbutton.html#setDown">setDown</a>().
<p> The <a href="ntqbuttongroup.html#clicked">TQButtonGroup::clicked</a>() signal does the same job, if you want
to connect several buttons to the same slot.
<p> <b>Warning:</b> Don't launch a model dialog in response to this signal
for a button that has <a href="ntqbutton.html#autoRepeat-prop">autoRepeat</a> turned on.
<p> <p>See also <a href="ntqbutton.html#pressed">pressed</a>(), <a href="ntqbutton.html#released">released</a>(), <a href="ntqbutton.html#toggled">toggled</a>(), <a href="ntqbutton.html#autoRepeat-prop">autoRepeat</a>, and <a href="ntqbutton.html#down-prop">down</a>.
<p>Examples: <a href="tutorial2-08.html#x2596">chart/setdataform.cpp</a>, <a href="listbox-example.html#x1426">listbox/listbox.cpp</a>, <a href="clientserver-example.html#x792">network/clientserver/client/client.cpp</a>, <a href="progressbar-example.html#x962">progressbar/progressbar.cpp</a>, <a href="richtext-example.html#x462">richtext/richtext.cpp</a>, <a href="tutorial1-02.html#x2290">t2/main.cpp</a>, and <a href="tutorial1-04.html#x2306">t4/main.cpp</a>.
<h3 class=fn><a href="ntqbuttongroup.html">TQButtonGroup</a>&nbsp;* <a name="group"></a>TQButton::group () const
</h3>
Returns the group that this button belongs to.
<p> If the button is not a member of any <a href="ntqbuttongroup.html">TQButtonGroup</a>, this function
returns 0.
<p> <p>See also <a href="ntqbuttongroup.html">TQButtonGroup</a>.
<h3 class=fn>bool <a name="isChecked"></a>TQRadioButton::isChecked () const
</h3><p>Returns TRUE if the radio button is checked; otherwise returns FALSE.
See the <a href="ntqradiobutton.html#checked-prop">"checked"</a> property for details.
<h3 class=fn>bool <a name="isDown"></a>TQButton::isDown () const
</h3><p>Returns TRUE if the button is pressed; otherwise returns FALSE.
See the <a href="ntqbutton.html#down-prop">"down"</a> property for details.
<h3 class=fn>bool <a name="isExclusiveToggle"></a>TQButton::isExclusiveToggle () const
</h3><p>Returns TRUE if the button is an exclusive toggle; otherwise returns FALSE.
See the <a href="ntqbutton.html#exclusiveToggle-prop">"exclusiveToggle"</a> property for details.
<h3 class=fn>bool <a name="isOn"></a>TQButton::isOn () const
</h3><p>Returns TRUE if the button is toggled; otherwise returns FALSE.
See the <a href="ntqbutton.html#on-prop">"on"</a> property for details.
<h3 class=fn>bool <a name="isToggleButton"></a>TQButton::isToggleButton () const
</h3><p>Returns TRUE if the button is a toggle button; otherwise returns FALSE.
See the <a href="ntqbutton.html#toggleButton-prop">"toggleButton"</a> property for details.
<h3 class=fn>const&nbsp;<a href="ntqpixmap.html">TQPixmap</a>&nbsp;* <a name="pixmap"></a>TQButton::pixmap () const
</h3><p>Returns the pixmap shown on the button.
See the <a href="ntqbutton.html#pixmap-prop">"pixmap"</a> property for details.
<h3 class=fn>void <a name="pressed"></a>TQButton::pressed ()<tt> [signal]</tt>
</h3>
<p> This signal is emitted when the button is pressed down.
<p> <p>See also <a href="ntqbutton.html#released">released</a>() and <a href="ntqbutton.html#clicked">clicked</a>().
<p>Examples: <a href="httpd-example.html#x724">network/httpd/httpd.cpp</a> and <a href="popup-example.html#x1606">popup/popup.cpp</a>.
<h3 class=fn>void <a name="released"></a>TQButton::released ()<tt> [signal]</tt>
</h3>
<p> This signal is emitted when the button is released.
<p> <p>See also <a href="ntqbutton.html#pressed">pressed</a>(), <a href="ntqbutton.html#clicked">clicked</a>(), and <a href="ntqbutton.html#toggled">toggled</a>().
<h3 class=fn>void <a name="setAccel"></a>TQButton::setAccel ( const&nbsp;<a href="ntqkeysequence.html">TQKeySequence</a>&nbsp;&amp; )<tt> [virtual]</tt>
</h3><p>Sets the accelerator associated with the button.
See the <a href="ntqbutton.html#accel-prop">"accel"</a> property for details.
<h3 class=fn>void <a name="setAutoRepeat"></a>TQButton::setAutoRepeat ( bool )<tt> [virtual]</tt>
</h3><p>Sets whether autoRepeat is enabled.
See the <a href="ntqbutton.html#autoRepeat-prop">"autoRepeat"</a> property for details.
<h3 class=fn>void <a name="setChecked"></a>TQRadioButton::setChecked ( bool&nbsp;check )<tt> [virtual slot]</tt>
</h3><p>Sets whether the radio button is checked to <em>check</em>.
See the <a href="ntqradiobutton.html#checked-prop">"checked"</a> property for details.
<h3 class=fn>void <a name="setDown"></a>TQButton::setDown ( bool )<tt> [virtual]</tt>
</h3><p>Sets whether the button is pressed.
See the <a href="ntqbutton.html#down-prop">"down"</a> property for details.
<h3 class=fn>void <a name="setPixmap"></a>TQButton::setPixmap ( const&nbsp;<a href="ntqpixmap.html">TQPixmap</a>&nbsp;&amp; )<tt> [virtual]</tt>
</h3><p>Sets the pixmap shown on the button.
See the <a href="ntqbutton.html#pixmap-prop">"pixmap"</a> property for details.
<h3 class=fn>void <a name="setText"></a>TQButton::setText ( const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp; )<tt> [virtual]</tt>
</h3><p>Sets the text shown on the button.
See the <a href="ntqbutton.html#text-prop">"text"</a> property for details.
<h3 class=fn><a href="ntqbutton.html#ToggleState-enum">ToggleState</a> <a name="state"></a>TQButton::state () const
</h3><p>Returns the state of the toggle button.
See the <a href="ntqbutton.html#toggleState-prop">"toggleState"</a> property for details.
<h3 class=fn>void <a name="stateChanged"></a>TQButton::stateChanged ( int&nbsp;state )<tt> [signal]</tt>
</h3>
<p> This signal is emitted whenever a toggle button changes state. <em>state</em> is <a href="ntqbutton.html#ToggleState-enum">On</a> if the button is on, <a href="ntqbutton.html#ToggleState-enum">NoChange</a> if it is in the
<a href="ntqcheckbox.html#setTristate">"no change" state</a> or <a href="ntqbutton.html#ToggleState-enum">Off</a>
if the button is off.
<p> This may be the result of a user action, <a href="ntqbutton.html#toggle">toggle</a>() slot activation,
<a href="ntqbutton.html#setState">setState</a>(), or because <a href="ntqbutton.html#setOn">setOn</a>() was called.
<p> <p>See also <a href="ntqbutton.html#clicked">clicked</a>() and <a href="ntqbutton.html#ToggleState-enum">TQButton::ToggleState</a>.
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="text"></a>TQButton::text () const
</h3><p>Returns the text shown on the button.
See the <a href="ntqbutton.html#text-prop">"text"</a> property for details.
<h3 class=fn>void <a name="toggle"></a>TQButton::toggle ()<tt> [slot]</tt>
</h3>
Toggles the state of a toggle button.
<p> <p>See also <a href="ntqbutton.html#on-prop">on</a>, <a href="ntqbutton.html#setOn">setOn</a>(), <a href="ntqbutton.html#toggled">toggled</a>(), and <a href="ntqbutton.html#toggleButton-prop">toggleButton</a>.
<h3 class=fn>void <a name="toggled"></a>TQButton::toggled ( bool&nbsp;on )<tt> [signal]</tt>
</h3>
<p> This signal is emitted whenever a toggle button changes status. <em>on</em> is TRUE if the button is on, or FALSE if the button is off.
<p> This may be the result of a user action, <a href="ntqbutton.html#toggle">toggle</a>() slot activation,
or because <a href="ntqbutton.html#setOn">setOn</a>() was called.
<p> <p>See also <a href="ntqbutton.html#clicked">clicked</a>().
<p>Example: <a href="listbox-example.html#x1427">listbox/listbox.cpp</a>.
<hr><h2>Property Documentation</h2>
<h3 class=fn><a href="ntqkeysequence.html">TQKeySequence</a> <a name="accel-prop"></a>accel</h3>
<p>This property holds the accelerator associated with the button.
<p>This property is 0 if there is no accelerator set. If you set this
property to 0 then any current accelerator is removed.
<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="autoMask-prop"></a>autoMask</h3>
<p>This property holds whether the radio button is automatically masked.
<p><p><p>See also <a href="ntqwidget.html#autoMask-prop">TQWidget::autoMask</a>.
<h3 class=fn>bool <a name="autoRepeat-prop"></a>autoRepeat</h3>
<p>This property holds whether autoRepeat is enabled.
<p>If autoRepeat is enabled then the <a href="ntqbutton.html#clicked">clicked</a>() signal is emitted at
regular intervals if the button is down. This property has no
effect on toggle buttons. autoRepeat is off by default.
<p>Set this property's value with <a href="#setAutoRepeat">setAutoRepeat</a>() and get this property's value with <a href="#autoRepeat">autoRepeat</a>().
<h3 class=fn>bool <a name="checked-prop"></a>checked</h3>
<p>This property holds whether the radio button is checked.
<p>This property will not effect any other radio buttons unless they
have been placed in the same <a href="ntqbuttongroup.html">TQButtonGroup</a>. The default value is
FALSE (unchecked).
<p>Set this property's value with <a href="#setChecked">setChecked</a>() and get this property's value with <a href="#isChecked">isChecked</a>().
<h3 class=fn><a href="ntqpixmap.html">TQPixmap</a> <a name="pixmap-prop"></a>pixmap</h3>
<p>This property holds the pixmap shown on the button.
<p>If the pixmap is monochrome (i.e. it is a <a href="ntqbitmap.html">TQBitmap</a> or its <a href="ntqpixmap.html#depth">depth</a> is 1) and it does not have a mask,
this property will set the pixmap to be its own mask. The purpose
of this is to draw transparent bitmaps which are important for
toggle buttons, for example.
<p> <a href="ntqbutton.html#pixmap">pixmap</a>() returns 0 if no pixmap was set.
<p>Set this property's value with <a href="#setPixmap">setPixmap</a>() and get this property's value with <a href="#pixmap">pixmap</a>().
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="text-prop"></a>text</h3>
<p>This property holds the text shown on the button.
<p>This property will return a <a href="ntqstring.html#TQString-null">TQString::null</a> if the button has no
text. If the text has an ampersand (&amp;) in it, then an
accelerator is automatically created for it using the character
that follows the '&amp;' as the accelerator key. Any previous
accelerator will be overwritten, or cleared if no accelerator is
defined by the text.
<p> There is no default text.
<p>Set this property's value with <a href="#setText">setText</a>() and get this property's value with <a href="#text">text</a>().
<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">TQt toolkit</a>.
Copyright &copy; 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 &copy; 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>