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/ntqbuttongroup.html

265 lines
16 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/qbuttongroup.cpp:47 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>TQButtonGroup 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>TQButtonGroup Class Reference</h1>
<p>The TQButtonGroup widget organizes TQButton widgets in a group.
<a href="#details">More...</a>
<p><tt>#include &lt;<a href="qbuttongroup-h.html">ntqbuttongroup.h</a>&gt;</tt>
<p>Inherits <a href="ntqgroupbox.html">TQGroupBox</a>.
<p>Inherited by <a href="ntqhbuttongroup.html">TQHButtonGroup</a> and <a href="ntqvbuttongroup.html">TQVButtonGroup</a>.
<p><a href="qbuttongroup-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li class=fn><a href="#TQButtonGroup"><b>TQButtonGroup</b></a> ( TQWidget&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )</li>
<li class=fn><a href="#TQButtonGroup-2"><b>TQButtonGroup</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;title, TQWidget&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )</li>
<li class=fn><a href="#TQButtonGroup-3"><b>TQButtonGroup</b></a> ( int&nbsp;strips, Orientation&nbsp;orientation, TQWidget&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )</li>
<li class=fn><a href="#TQButtonGroup-4"><b>TQButtonGroup</b></a> ( int&nbsp;strips, Orientation&nbsp;orientation, const&nbsp;TQString&nbsp;&amp;&nbsp;title, TQWidget&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )</li>
<li class=fn>bool <a href="#isExclusive"><b>isExclusive</b></a> () const</li>
<li class=fn>bool <a href="#isRadioButtonExclusive"><b>isRadioButtonExclusive</b></a> () const</li>
<li class=fn>virtual void <a href="#setExclusive"><b>setExclusive</b></a> ( bool )</li>
<li class=fn>virtual void <a href="#setRadioButtonExclusive"><b>setRadioButtonExclusive</b></a> ( bool )</li>
<li class=fn>int <a href="#insert"><b>insert</b></a> ( TQButton&nbsp;*&nbsp;button, int&nbsp;id = -1 )</li>
<li class=fn>void <a href="#remove"><b>remove</b></a> ( TQButton&nbsp;*&nbsp;button )</li>
<li class=fn>TQButton * <a href="#find"><b>find</b></a> ( int&nbsp;id ) const</li>
<li class=fn>int <a href="#id"><b>id</b></a> ( TQButton&nbsp;*&nbsp;button ) const</li>
<li class=fn>int <a href="#count"><b>count</b></a> () const</li>
<li class=fn>virtual void <a href="#setButton"><b>setButton</b></a> ( int&nbsp;id )</li>
<li class=fn>virtual void <a href="#moveFocus"><b>moveFocus</b></a> ( int&nbsp;key )</li>
<li class=fn>TQButton * <a href="#selected"><b>selected</b></a> () const</li>
<li class=fn>int <a href="#selectedId"><b>selectedId</b></a> () const</li>
</ul>
<h2>Signals</h2>
<ul>
<li class=fn>void <a href="#pressed"><b>pressed</b></a> ( int&nbsp;id )</li>
<li class=fn>void <a href="#released"><b>released</b></a> ( int&nbsp;id )</li>
<li class=fn>void <a href="#clicked"><b>clicked</b></a> ( int&nbsp;id )</li>
</ul>
<h2>Properties</h2>
<ul>
<li class=fn>bool <a href="#exclusive-prop"><b>exclusive</b></a>&nbsp;- whether the button group is exclusive</li>
<li class=fn>bool <a href="#radioButtonExclusive-prop"><b>radioButtonExclusive</b></a>&nbsp;- whether the radio buttons in the group are exclusive</li>
<li class=fn>int <a href="#selectedId-prop"><b>selectedId</b></a>&nbsp;- the selected toggle button</li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>
The TQButtonGroup widget organizes <a href="ntqbutton.html">TQButton</a> widgets in a group.
<p>
<p> A button group widget makes it easier to deal with groups of
buttons. Each button in a button group has a unique identifier.
The button group emits a <a href="#clicked">clicked</a>() signal with this identifier
when a button in the group is clicked. This makes a button group
particularly useful when you have several similar buttons and want
to connect all their clicked() signals to a single slot.
<p> An <a href="#setExclusive">exclusive</a> button group switches
off all toggle buttons except the one that was clicked. A button
group is, by default, non-exclusive. Note that all radio buttons
that are inserted into a button group are mutually exclusive even
if the button group is non-exclusive. (See
<a href="#setRadioButtonExclusive">setRadioButtonExclusive</a>().)
<p> There are two ways of using a button group:
<ul>
<li> The button group is the parent widget of a number of buttons,
i.e. the button group is the parent argument in the button
constructor. The buttons are assigned identifiers 0, 1, 2, etc.,
in the order they are created. A TQButtonGroup can display a frame
and a title because it inherits <a href="ntqgroupbox.html">TQGroupBox</a>.
<li> The button group is an invisible widget and the contained
buttons have some other parent widget. In this usage, each button
must be manually inserted, using <a href="#insert">insert</a>(), into the button group
and given an identifier.
</ul>
<p> A button can be removed from the group with <a href="#remove">remove</a>(). A pointer to
a button with a given id can be obtained using <a href="#find">find</a>(). The id of a
button is available using <a href="#id">id</a>(). A button can be set <em>on</em> with
<a href="#setButton">setButton</a>(). The number of buttons in the group is returned by
<a href="#count">count</a>().
<p> <img src=qbttngrp-m.png> <img src=qbttngrp-w.png>
<p> <p>See also <a href="ntqpushbutton.html">TQPushButton</a>, <a href="ntqcheckbox.html">TQCheckBox</a>, <a href="ntqradiobutton.html">TQRadioButton</a>, <a href="appearance.html">Widget Appearance and Style</a>, <a href="geomanagement.html">Layout Management</a>, and <a href="organizers.html">Organizers</a>.
<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="TQButtonGroup"></a>TQButtonGroup::TQButtonGroup ( <a href="ntqwidget.html">TQWidget</a>&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )
</h3>
Constructs a button group with no title.
<p> The <em>parent</em> and <em>name</em> arguments are passed to the <a href="ntqwidget.html">TQWidget</a>
constructor.
<h3 class=fn><a name="TQButtonGroup-2"></a>TQButtonGroup::TQButtonGroup ( const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;title, <a href="ntqwidget.html">TQWidget</a>&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )
</h3>
Constructs a button group with the title <em>title</em>.
<p> The <em>parent</em> and <em>name</em> arguments are passed to the <a href="ntqwidget.html">TQWidget</a>
constructor.
<h3 class=fn><a name="TQButtonGroup-3"></a>TQButtonGroup::TQButtonGroup ( int&nbsp;strips, <a href="ntqt.html#Orientation-enum">Orientation</a>&nbsp;orientation, <a href="ntqwidget.html">TQWidget</a>&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )
</h3>
Constructs a button group with no title. Child widgets will be
arranged in <em>strips</em> rows or columns (depending on <em>orientation</em>).
<p> The <em>parent</em> and <em>name</em> arguments are passed to the <a href="ntqwidget.html">TQWidget</a>
constructor.
<h3 class=fn><a name="TQButtonGroup-4"></a>TQButtonGroup::TQButtonGroup ( int&nbsp;strips, <a href="ntqt.html#Orientation-enum">Orientation</a>&nbsp;orientation, const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;title, <a href="ntqwidget.html">TQWidget</a>&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )
</h3>
Constructs a button group with title <em>title</em>. Child widgets will
be arranged in <em>strips</em> rows or columns (depending on <em>orientation</em>).
<p> The <em>parent</em> and <em>name</em> arguments are passed to the <a href="ntqwidget.html">TQWidget</a>
constructor.
<h3 class=fn>void <a name="clicked"></a>TQButtonGroup::clicked ( int&nbsp;id )<tt> [signal]</tt>
</h3>
<p> This signal is emitted when a button in the group is <a href="ntqbutton.html#clicked">clicked</a>. The <em>id</em> argument is the
button's identifier.
<p> <p>See also <a href="#insert">insert</a>().
<p>Examples: <a href="drawdemo-example.html#x1062">drawdemo/drawdemo.cpp</a> and <a href="xform-example.html#x1221">xform/xform.cpp</a>.
<h3 class=fn>int <a name="count"></a>TQButtonGroup::count () const
</h3>
Returns the number of buttons in the group.
<h3 class=fn><a href="ntqbutton.html">TQButton</a>&nbsp;* <a name="find"></a>TQButtonGroup::find ( int&nbsp;id ) const
</h3>
Returns the button with the specified identifier <em>id</em>, or 0 if
the button was not found.
<h3 class=fn>int <a name="id"></a>TQButtonGroup::id ( <a href="ntqbutton.html">TQButton</a>&nbsp;*&nbsp;button ) const
</h3>
Returns the id of <em>button</em>, or -1 if <em>button</em> is not a member of
this group.
<p> <p>See also <a href="#selectedId-prop">selectedId</a>.
<h3 class=fn>int <a name="insert"></a>TQButtonGroup::insert ( <a href="ntqbutton.html">TQButton</a>&nbsp;*&nbsp;button, int&nbsp;id = -1 )
</h3>
Inserts the <em>button</em> with the identifier <em>id</em> into the button
group. Returns the button identifier.
<p> Buttons are normally inserted into a button group automatically by
passing the button group as the parent when the button is
constructed. So it is not necessary to manually insert buttons
that have this button group as their parent widget. An exception
is when you want custom identifiers instead of the default 0, 1,
2, etc., or if you want the buttons to have some other parent.
<p> The button is assigned the identifier <em>id</em> or an automatically
generated identifier. It works as follows: If <em>id</em> >= 0, this
identifier is assigned. If <em>id</em> == -1 (default), the identifier
is equal to the number of buttons in the group. If <em>id</em> is any
other negative integer, for instance -2, a unique identifier
(negative integer &lt;= -2) is generated. No button has an id of -1.
<p> <p>See also <a href="#find">find</a>(), <a href="#remove">remove</a>(), and <a href="#exclusive-prop">exclusive</a>.
<p>Examples: <a href="listbox-example.html#x1428">listbox/listbox.cpp</a> and <a href="xform-example.html#x1222">xform/xform.cpp</a>.
<h3 class=fn>bool <a name="isExclusive"></a>TQButtonGroup::isExclusive () const
</h3><p>Returns TRUE if the button group is exclusive; otherwise returns FALSE.
See the <a href="ntqbuttongroup.html#exclusive-prop">"exclusive"</a> property for details.
<h3 class=fn>bool <a name="isRadioButtonExclusive"></a>TQButtonGroup::isRadioButtonExclusive () const
</h3><p>Returns TRUE if the radio buttons in the group are exclusive; otherwise returns FALSE.
See the <a href="ntqbuttongroup.html#radioButtonExclusive-prop">"radioButtonExclusive"</a> property for details.
<h3 class=fn>void <a name="moveFocus"></a>TQButtonGroup::moveFocus ( int&nbsp;key )<tt> [virtual]</tt>
</h3>
Moves the <a href="focus.html#keyboard-focus">keyboard focus</a> according to <em>key</em>, and if appropriate
checks the new focus item.
<p> This function does nothing unless the keyboard focus points to one
of the button group members and <em>key</em> is one of <a href="ntqt.html#Key-enum">Key_Up</a>, <a href="ntqt.html#Key-enum">Key_Down</a>, <a href="ntqt.html#Key-enum">Key_Left</a> and <a href="ntqt.html#Key-enum">Key_Right</a>.
<h3 class=fn>void <a name="pressed"></a>TQButtonGroup::pressed ( int&nbsp;id )<tt> [signal]</tt>
</h3>
<p> This signal is emitted when a button in the group is <a href="ntqbutton.html#pressed">pressed</a>. The <em>id</em> argument is the
button's identifier.
<p> <p>See also <a href="#insert">insert</a>().
<h3 class=fn>void <a name="released"></a>TQButtonGroup::released ( int&nbsp;id )<tt> [signal]</tt>
</h3>
<p> This signal is emitted when a button in the group is <a href="ntqbutton.html#released">released</a>. The <em>id</em> argument is the
button's identifier.
<p> <p>See also <a href="#insert">insert</a>().
<h3 class=fn>void <a name="remove"></a>TQButtonGroup::remove ( <a href="ntqbutton.html">TQButton</a>&nbsp;*&nbsp;button )
</h3>
Removes the <em>button</em> from the button group.
<p> <p>See also <a href="#insert">insert</a>().
<h3 class=fn><a href="ntqbutton.html">TQButton</a>&nbsp;* <a name="selected"></a>TQButtonGroup::selected () const
</h3>
Returns the selected toggle button if exactly one is selected;
otherwise returns 0.
<p> <p>See also <a href="#selectedId-prop">selectedId</a>.
<h3 class=fn>int <a name="selectedId"></a>TQButtonGroup::selectedId () const
</h3><p>Returns the selected toggle button.
See the <a href="ntqbuttongroup.html#selectedId-prop">"selectedId"</a> property for details.
<h3 class=fn>void <a name="setButton"></a>TQButtonGroup::setButton ( int&nbsp;id )<tt> [virtual]</tt>
</h3><p>Sets the selected toggle button to <em>id</em>.
See the <a href="ntqbuttongroup.html#selectedId-prop">"selectedId"</a> property for details.
<h3 class=fn>void <a name="setExclusive"></a>TQButtonGroup::setExclusive ( bool )<tt> [virtual]</tt>
</h3><p>Sets whether the button group is exclusive.
See the <a href="ntqbuttongroup.html#exclusive-prop">"exclusive"</a> property for details.
<h3 class=fn>void <a name="setRadioButtonExclusive"></a>TQButtonGroup::setRadioButtonExclusive ( bool )<tt> [virtual]</tt>
</h3><p>Sets whether the radio buttons in the group are exclusive.
See the <a href="ntqbuttongroup.html#radioButtonExclusive-prop">"radioButtonExclusive"</a> property for details.
<hr><h2>Property Documentation</h2>
<h3 class=fn>bool <a name="exclusive-prop"></a>exclusive</h3>
<p>This property holds whether the button group is exclusive.
<p>If this property is TRUE, then the buttons in the group are
toggled, and to untoggle a button you must click on another button
in the group. The default value is FALSE.
<p>Set this property's value with <a href="#setExclusive">setExclusive</a>() and get this property's value with <a href="#isExclusive">isExclusive</a>().
<h3 class=fn>bool <a name="radioButtonExclusive-prop"></a>radioButtonExclusive</h3>
<p>This property holds whether the radio buttons in the group are exclusive.
<p>If this property is TRUE (the default), the <a href="ntqradiobutton.html">radiobuttons</a> in the group are treated exclusively.
<p>Set this property's value with <a href="#setRadioButtonExclusive">setRadioButtonExclusive</a>() and get this property's value with <a href="#isRadioButtonExclusive">isRadioButtonExclusive</a>().
<h3 class=fn>int <a name="selectedId-prop"></a>selectedId</h3>
<p>This property holds the selected toggle button.
<p>The toggle button is specified as an ID.
<p> If no toggle button is selected, this property holds -1.
<p> If <a href="#setButton">setButton</a>() is called on an exclusive group, the button with
the given id will be set to on and all the others will be set to
off.
<p> <p>See also <a href="#selected">selected</a>().
<p>Set this property's value with <a href="#setButton">setButton</a>() and get this property's value with <a href="#selectedId">selectedId</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>