Sophie

Sophie

distrib > Mandriva > 8.2 > i586 > media > contrib > by-pkgid > 112b0974ad288f6cd55bf971ee6026a9 > files > 899

libqt3-devel-3.0.2-2mdk.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- /tmp/qt-3.0-reggie-28534/qt-x11-free-3.0.2/src/widgets/qbutton.cpp:125 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>QButton Class</title>
<style type="text/css"><!--
h3.fn,span.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>QButton Class Reference</h1>

<p>The QButton class is the abstract base class of button
widgets, providing functionality common to buttons.
<a href="#details">More...</a>
<p><tt>#include &lt;<a href="qbutton-h.html">qbutton.h</a>&gt;</tt>
<p>Inherits <a href="qwidget.html">QWidget</a>.
<p>Inherited by <a href="qcheckbox.html">QCheckBox</a>, <a href="qpushbutton.html">QPushButton</a>, <a href="qradiobutton.html">QRadioButton</a> and <a href="qtoolbutton.html">QToolButton</a>.
<p><a href="qbutton-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li><div class=fn><a href="#QButton"><b>QButton</b></a> ( QWidget&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0, WFlags&nbsp;f = 0 )</div></li>
<li><div class=fn><a href="#~QButton"><b>~QButton</b></a> ()</div></li>
<li><div class=fn>QString <a href="#text"><b>text</b></a> () const</div></li>
<li><div class=fn>virtual void <a href="#setText"><b>setText</b></a> ( const QString &amp; )</div></li>
<li><div class=fn>const QPixmap * <a href="#pixmap"><b>pixmap</b></a> () const</div></li>
<li><div class=fn>virtual void <a href="#setPixmap"><b>setPixmap</b></a> ( const QPixmap &amp; )</div></li>
<li><div class=fn>QKeySequence <a href="#accel"><b>accel</b></a> () const</div></li>
<li><div class=fn>virtual void <a href="#setAccel"><b>setAccel</b></a> ( const QKeySequence &amp; )</div></li>
<li><div class=fn>bool <a href="#isToggleButton"><b>isToggleButton</b></a> () const</div></li>
<li><div class=fn>enum <a href="#ToggleType-enum"><b>ToggleType</b></a> { SingleShot, Toggle, Tristate }</div></li>
<li><div class=fn>ToggleType <a href="#toggleType"><b>toggleType</b></a> () const</div></li>
<li><div class=fn>virtual void <a href="#setDown"><b>setDown</b></a> ( bool )</div></li>
<li><div class=fn>bool <a href="#isDown"><b>isDown</b></a> () const</div></li>
<li><div class=fn>bool <a href="#isOn"><b>isOn</b></a> () const</div></li>
<li><div class=fn>enum <a href="#ToggleState-enum"><b>ToggleState</b></a> { Off, NoChange, On }</div></li>
<li><div class=fn>ToggleState <a href="#state"><b>state</b></a> () const</div></li>
<li><div class=fn>bool autoResize () const &nbsp;<em>(obsolete)</em></div></li>
<li><div class=fn>void setAutoResize ( bool ) &nbsp;<em>(obsolete)</em></div></li>
<li><div class=fn>bool <a href="#autoRepeat"><b>autoRepeat</b></a> () const</div></li>
<li><div class=fn>virtual void <a href="#setAutoRepeat"><b>setAutoRepeat</b></a> ( bool )</div></li>
<li><div class=fn>bool <a href="#isExclusiveToggle"><b>isExclusiveToggle</b></a> () const</div></li>
<li><div class=fn>QButtonGroup * <a href="#group"><b>group</b></a> () const</div></li>
</ul>
<h2>Public Slots</h2>
<ul>
<li><div class=fn>void <a href="#animateClick"><b>animateClick</b></a> ()</div></li>
<li><div class=fn>void <a href="#toggle"><b>toggle</b></a> ()</div></li>
</ul>
<h2>Signals</h2>
<ul>
<li><div class=fn>void <a href="#pressed"><b>pressed</b></a> ()</div></li>
<li><div class=fn>void <a href="#released"><b>released</b></a> ()</div></li>
<li><div class=fn>void <a href="#clicked"><b>clicked</b></a> ()</div></li>
<li><div class=fn>void <a href="#toggled"><b>toggled</b></a> ( bool&nbsp;on )</div></li>
<li><div class=fn>void <a href="#stateChanged"><b>stateChanged</b></a> ( int&nbsp;state )</div></li>
</ul>
<h2>Properties</h2>
<ul>
<li><div class=fn>QKeySequence <a href="#accel-prop"><b>accel</b></a>&nbsp;- the accelerator associated with the button</div></li>
<li><div class=fn>bool <a href="#autoRepeat-prop"><b>autoRepeat</b></a>&nbsp;- whether autoRepeat is enabled</div></li>
<li><div class=fn>bool autoResize&nbsp;- whether autoResize is enabled &nbsp;<em>(obsolete)</em></div></li>
<li><div class=fn>bool <a href="#down-prop"><b>down</b></a>&nbsp;- whether the button is pressed</div></li>
<li><div class=fn>bool <a href="#exclusiveToggle-prop"><b>exclusiveToggle</b></a>&nbsp;- whether the button is an exclusive toggle &nbsp;<em>(read only)</em></div></li>
<li><div class=fn>bool <a href="#on-prop"><b>on</b></a>&nbsp;- whether the button is toggled &nbsp;<em>(read only)</em></div></li>
<li><div class=fn>QPixmap <a href="#pixmap-prop"><b>pixmap</b></a>&nbsp;- the pixmap shown on the button</div></li>
<li><div class=fn>QString <a href="#text-prop"><b>text</b></a>&nbsp;- the text shown on the button</div></li>
<li><div class=fn>bool <a href="#toggleButton-prop"><b>toggleButton</b></a>&nbsp;- whether the button is a toggle button &nbsp;<em>(read only)</em></div></li>
<li><div class=fn>ToggleState <a href="#toggleState-prop"><b>toggleState</b></a>&nbsp;- whether the button is toggled &nbsp;<em>(read only)</em></div></li>
<li><div class=fn>ToggleType <a href="#toggleType-prop"><b>toggleType</b></a>&nbsp;- the type of toggle on the button &nbsp;<em>(read only)</em></div></li>
</ul>
<h2>Protected Members</h2>
<ul>
<li><div class=fn>void <a href="#setToggleButton"><b>setToggleButton</b></a> ( bool&nbsp;b )</div></li>
<li><div class=fn>virtual void <a href="#setToggleType"><b>setToggleType</b></a> ( ToggleType&nbsp;type )</div></li>
<li><div class=fn>void <a href="#setOn"><b>setOn</b></a> ( bool&nbsp;on )</div></li>
<li><div class=fn>virtual void <a href="#setState"><b>setState</b></a> ( ToggleState&nbsp;s )</div></li>
<li><div class=fn>virtual bool <a href="#hitButton"><b>hitButton</b></a> ( const&nbsp;QPoint&nbsp;&amp;&nbsp;pos ) const</div></li>
<li><div class=fn>virtual void <a href="#drawButton"><b>drawButton</b></a> ( QPainter * )</div></li>
<li><div class=fn>virtual void <a href="#drawButtonLabel"><b>drawButtonLabel</b></a> ( QPainter * )</div></li>
<li><div class=fn>virtual void <a href="#paintEvent"><b>paintEvent</b></a> ( QPaintEvent * )</div></li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>


<p> The QButton class is the abstract base class of button
widgets, providing functionality common to buttons.
<p> 
<p> <b>If you want to create a button use <a href="qpushbutton.html">QPushButton</a>.</b>
<p> The QButton class implements an <em>abstract</em> button, and lets subclasses
specify how to reply to user actions and how to draw the button.
<p> QButton provides both push and toggle buttons.  The <a href="qradiobutton.html">QRadioButton</a> and
<a href="qcheckbox.html">QCheckBox</a> classes provide only toggle buttons; QPushButton and
<a href="qtoolbutton.html">QToolButton</a> provide both toggle and push buttons.
<p> Any button can have either a text or pixmap label.  <a href="#setText">setText</a>() sets
the button to be a text button and <a href="#setPixmap">setPixmap</a>() sets it to be a
pixmap button.  The text/pixmap is manipulated as necessary to
create the "disabled" appearance when the button is disabled.
<p> QButton provides most of the states used for buttons:
<ul>
<li> <a href="#isDown">isDown</a>() determines whether the button is <em>pressed</em> down.
<li> <a href="#isOn">isOn</a>() determines whether the button is <em>on</em>.
Only toggle buttons can be switched on and off  (see below).
<li> <a href="qwidget.html#isEnabled">isEnabled</a>() determines whether the button can be pressed by the
user.
<li> <a href="#setAutoRepeat">setAutoRepeat</a>() determines whether the button will auto-repeat
if the user holds it down.
<li> <a href="#setToggleButton">setToggleButton</a>() determines whether the button is a toggle
button or not.
</ul>
<p> The difference between isDown() and isOn() is as follows:
When the user clicks a toggle button to toggle it on, the button is
first <em>pressed</em> and then released into <em>on</em> state.  When the user
clicks it again (to toggle it off), the button moves first to the <em>pressed</em> state, then to the <em>off</em> state (isOn() and isDown() are
both FALSE).
<p> Default buttons (as used in many dialogs) are provided by
<a href="qpushbutton.html#setDefault">QPushButton::setDefault</a>() and <a href="qpushbutton.html#setAutoDefault">QPushButton::setAutoDefault</a>().
<p> QButton provides five signals:
<ol type=1>
<li> <a href="#pressed">pressed</a>() is emitted when the left mouse button is pressed while
the mouse cursor is inside the button.
<li> <a href="#released">released</a>() is emitted when the left mouse button is released.
<li> <a href="#clicked">clicked</a>() is emitted when the button is first pressed and then
released when the accelerator key is typed, or when <a href="#animateClick">animateClick</a>()
is called.
<li> <a href="#toggled">toggled</a>(bool) is emitted when the state of a toggle button changes.
<li> <a href="#stateChanged">stateChanged</a>(int) is emitted when the state of a tristate
toggle button changes.
</ol>
<p> If the button is a text button with "&amp;" in its text, QButton creates
an automatic accelerator key.  This code creates a push button
labelled "Rock &amp; Roll" (where the c is underscored).  The button
gets an automatic accelerator key, Alt+C:
<p> <pre>
    <a href="qpushbutton.html">QPushButton</a> *p = new <a href="qpushbutton.html">QPushButton</a>( "Ro&amp;ck &amp;&amp; Roll", this );
  </pre>
 
<p> In this example, when the user presses Alt+C the button will
call animateClick().
<p> You can also set a custom accelerator using the <a href="#setAccel">setAccel</a>() function.
This is useful mostly for pixmap buttons because they have no
automatic accelerator.
<p> <pre>
    <a href="qpushbutton.html">QPushButton</a> *p;
    p-&gt;<a href="#setPixmap">setPixmap</a>( QPixmap("print.png") );
    p-&gt;<a href="#setAccel">setAccel</a>( ALT+Key_F7 );
  </pre>
 
<p> All of the buttons provided by Qt (<a href="qpushbutton.html">QPushButton</a>, <a href="qtoolbutton.html">QToolButton</a>,
<a href="qcheckbox.html">QCheckBox</a> and <a href="qradiobutton.html">QRadioButton</a>) can display both text and pixmaps.
<p> To subclass QButton, you have to reimplement at least <a href="#drawButton">drawButton</a>()
(to draw the button's outline) and <a href="#drawButtonLabel">drawButtonLabel</a>() (to draw its
text or pixmap).  It is generally advisable to reimplement
<a href="qwidget.html#sizeHint">sizeHint</a>() as well, and sometimes <a href="#hitButton">hitButton</a>() (to determine whether
a button press is within the button).
<p> To reduce flickering, <a href="#paintEvent">QButton::paintEvent</a>() sets up a pixmap that
the drawButton() function draws in. You should not reimplement
<a href="#paintEvent">paintEvent</a>() for a subclass of QButton unless you want to take over
all drawing.
<p> <p>See also <a href="qbuttongroup.html">QButtonGroup</a> and <a href="abstractwidgets.html">Abstract Widget Classes</a>.

<hr><h2>Member Type Documentation</h2>
<h3 class=fn><a name="ToggleState-enum"></a>QButton::ToggleState</h3> 
<p> This enum defines the state of a toggle button at any moment.  The
possible values are as follows:
<ul>
<li><tt>QButton::Off</tt> - the button is in the "off" state
<li><tt>QButton::NoChange</tt> - the button is in the default/unchanged state
<li><tt>QButton::On</tt> - the button is in the "on" state
</ul>
<h3 class=fn><a name="ToggleType-enum"></a>QButton::ToggleType</h3> 
<p> This enum type defines what a button can do in response to a
mouse/keyboard press:
<ul>
<li><tt>QButton::SingleShot</tt> - pressing the button causes an action, then the
button returns to the unpressed state.
<li><tt>QButton::Toggle</tt> - pressing the button toggles it between an <a href="#ToggleState-enum">On</a> and
and <a href="#ToggleState-enum">Off</a> state.
<li><tt>QButton::Tristate</tt> - pressing the button cycles between the three
states <a href="#ToggleState-enum">On</a>, <a href="#ToggleState-enum">Off</a> and <a href="#ToggleState-enum">NoChange</a>
</ul><p> 
<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="QButton"></a>QButton::QButton ( <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0, WFlags&nbsp;f = 0 )
</h3>
Constructs a standard button with the parent <em>parent</em> and the
name <em>name</em> using the <a href="qt.html#WidgetFlags">widget flags</a> <em>f</em>.
<p> If <em>parent</em> is a <a href="qbuttongroup.html">QButtonGroup</a>, this constructor calls
<a href="qbuttongroup.html#insert">QButtonGroup::insert</a>().

<h3 class=fn><a name="~QButton"></a>QButton::~QButton ()
</h3> Destroys the button.

<h3 class=fn><a href="qkeysequence.html">QKeySequence</a> <a name="accel"></a>QButton::accel () const
</h3><p>Returns the accelerator associated with the button.
See the <a href="qbutton.html#accel-prop">"accel"</a> property for details.
<h3 class=fn>void <a name="animateClick"></a>QButton::animateClick ()<tt> [slot]</tt>
</h3>
Performs an animated click: the button is pressed and released a short
while later.
<p> The <a href="#pressed">pressed</a>(), <a href="#released">released</a>(), <a href="#clicked">clicked</a>(), <a href="#toggled">toggled</a>(), and <a href="#stateChanged">stateChanged</a>()
signals are emitted as appropriate.
<p> This function does nothing if the button is <a href="qwidget.html#setEnabled">disabled.</a>
<p> <p>See also <a href="#accel-prop">accel</a>.

<h3 class=fn>bool <a name="autoRepeat"></a>QButton::autoRepeat () const
</h3><p>Returns TRUE if autoRepeat is enabled; otherwise returns FALSE.
See the <a href="qbutton.html#autoRepeat-prop">"autoRepeat"</a> property for details.
<h3 class=fn>bool <a name="autoResize"></a>QButton::autoResize () const
</h3><p>Returns TRUE if autoResize is enabled; otherwise returns FALSE.
See the <a href="qbutton.html#autoResize-prop">"autoResize"</a> property for details.
<h3 class=fn>void <a name="clicked"></a>QButton::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="#animateClick">animateClick</a>() is called.
<p> The <a href="qbuttongroup.html#clicked">QButtonGroup::clicked</a>() signal does the same job, if you want to
connect several buttons to the same slot.
<p> <p>See also <a href="#pressed">pressed</a>(), <a href="#released">released</a>() and <a href="#toggled">toggled</a>().

<p>Examples: <a href="simple-qfont-demo-walkthrough.html#x2387">fonts/simple-qfont-demo/viewer.cpp</a>, <a href="listbox-example.html#x1267">listbox/listbox.cpp</a>, <a href="clientserver-example.html#x1062">network/clientserver/client/client.cpp</a>, <a href="ftpclient-example.html#x1002">network/ftpclient/ftpmainwindow.cpp</a>, <a href="richtext-example.html#x593">richtext/richtext.cpp</a>, <a href="t2.html#x2103">t2/main.cpp</a> and <a href="t4.html#x2119">t4/main.cpp</a>.
<h3 class=fn>void <a name="drawButton"></a>QButton::drawButton ( <a href="qpainter.html">QPainter</a>&nbsp;* )<tt> [virtual protected]</tt>
</h3>
Draws the button.  The default implementation does nothing.
<p> This virtual function is reimplemented by subclasses to draw real
buttons. At some point in time, these reimplementations are supposed
to call <a href="#drawButtonLabel">drawButtonLabel</a>().
<p> <p>See also <a href="#drawButtonLabel">drawButtonLabel</a>() and <a href="#paintEvent">paintEvent</a>().

<h3 class=fn>void <a name="drawButtonLabel"></a>QButton::drawButtonLabel ( <a href="qpainter.html">QPainter</a>&nbsp;* )<tt> [virtual protected]</tt>
</h3>
Draws the button text or pixmap.
<p> This virtual function is reimplemented by subclasses to draw real
buttons. It's invoked by <a href="#drawButton">drawButton</a>().
<p> <p>See also <a href="#drawButton">drawButton</a>() and <a href="#paintEvent">paintEvent</a>().

<p>Example: <a href="tictac-example.html#x176">tictac/tictac.cpp</a>.
<h3 class=fn><a href="qbuttongroup.html">QButtonGroup</a>&nbsp;* <a name="group"></a>QButton::group () const
</h3> Returns a pointer to the group of which this button is a member.
<p> If the button is not a member of any <a href="qbuttongroup.html">QButtonGroup</a>, this function
returns 0.
<p> <p>See also <a href="qbuttongroup.html">QButtonGroup</a>.

<h3 class=fn>bool <a name="hitButton"></a>QButton::hitButton ( const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;pos ) const<tt> [virtual protected]</tt>
</h3>
Returns TRUE if <em>pos</em> is inside the clickable button rectangle, or
FALSE if it is outside.
<p> By default, the clickable area is the entire widget. Subclasses may
reimplement it, though.

<h3 class=fn>bool <a name="isDown"></a>QButton::isDown () const
</h3><p>Returns TRUE if the button is pressed; otherwise returns FALSE.
See the <a href="qbutton.html#down-prop">"down"</a> property for details.
<h3 class=fn>bool <a name="isExclusiveToggle"></a>QButton::isExclusiveToggle () const
</h3><p>Returns TRUE if the button is an exclusive toggle; otherwise returns FALSE.
See the <a href="qbutton.html#exclusiveToggle-prop">"exclusiveToggle"</a> property for details.
<h3 class=fn>bool <a name="isOn"></a>QButton::isOn () const
</h3><p>Returns TRUE if the button is toggled; otherwise returns FALSE.
See the <a href="qbutton.html#on-prop">"on"</a> property for details.
<h3 class=fn>bool <a name="isToggleButton"></a>QButton::isToggleButton () const
</h3><p>Returns TRUE if the button is a toggle button; otherwise returns FALSE.
See the <a href="qbutton.html#toggleButton-prop">"toggleButton"</a> property for details.
<h3 class=fn>void <a name="paintEvent"></a>QButton::paintEvent ( <a href="qpaintevent.html">QPaintEvent</a>&nbsp;* )<tt> [virtual protected]</tt>
</h3>
Handles paint events for buttons.  Small and typically complex
buttons are painted double-buffered to reduce flicker. The actually
drawing is done in the virtual functions <a href="#drawButton">drawButton</a>() and
<a href="#drawButtonLabel">drawButtonLabel</a>().
<p> <p>See also <a href="#drawButton">drawButton</a>() and <a href="#drawButtonLabel">drawButtonLabel</a>().

<p>Reimplemented from <a href="qwidget.html#paintEvent">QWidget</a>.
<h3 class=fn>const&nbsp;<a href="qpixmap.html">QPixmap</a>&nbsp;* <a name="pixmap"></a>QButton::pixmap () const
</h3><p>Returns the pixmap shown on the button.
See the <a href="qbutton.html#pixmap-prop">"pixmap"</a> property for details.
<h3 class=fn>void <a name="pressed"></a>QButton::pressed ()<tt> [signal]</tt>
</h3>

This signal is emitted when the button is pressed down.
<p> <p>See also <a href="#released">released</a>() and <a href="#clicked">clicked</a>().

<p>Examples: <a href="httpd-example.html#x989">network/httpd/httpd.cpp</a> and <a href="popup-example.html#x880">popup/popup.cpp</a>.
<h3 class=fn>void <a name="released"></a>QButton::released ()<tt> [signal]</tt>
</h3>

This signal is emitted when the button is released.
<p> <p>See also <a href="#pressed">pressed</a>(), <a href="#clicked">clicked</a>() and <a href="#toggled">toggled</a>().

<h3 class=fn>void <a name="setAccel"></a>QButton::setAccel ( const&nbsp;<a href="qkeysequence.html">QKeySequence</a>&nbsp;&amp; )<tt> [virtual]</tt>
</h3><p>Sets the accelerator associated with the button.
See the <a href="qbutton.html#accel-prop">"accel"</a> property for details.
<h3 class=fn>void <a name="setAutoRepeat"></a>QButton::setAutoRepeat ( bool )<tt> [virtual]</tt>
</h3><p>Sets whether autoRepeat is enabled.
See the <a href="qbutton.html#autoRepeat-prop">"autoRepeat"</a> property for details.
<h3 class=fn>void <a name="setAutoResize"></a>QButton::setAutoResize ( bool )
</h3><p>Sets whether autoResize is enabled.
See the <a href="qbutton.html#autoResize-prop">"autoResize"</a> property for details.
<h3 class=fn>void <a name="setDown"></a>QButton::setDown ( bool )<tt> [virtual]</tt>
</h3><p>Sets whether the button is pressed.
See the <a href="qbutton.html#down-prop">"down"</a> property for details.
<h3 class=fn>void <a name="setOn"></a>QButton::setOn ( bool&nbsp;on )<tt> [protected]</tt>
</h3> 
<p> Sets the state of this button to On when <em>on</em> is TRUE, otherwise
to Off.
<p> <p>See also <a href="#toggleState-prop">toggleState</a>.

<h3 class=fn>void <a name="setPixmap"></a>QButton::setPixmap ( const&nbsp;<a href="qpixmap.html">QPixmap</a>&nbsp;&amp; )<tt> [virtual]</tt>
</h3><p>Sets the pixmap shown on the button.
See the <a href="qbutton.html#pixmap-prop">"pixmap"</a> property for details.
<h3 class=fn>void <a name="setState"></a>QButton::setState ( <a href="qbutton.html#ToggleState-enum">ToggleState</a>&nbsp;s )<tt> [virtual protected]</tt>
</h3>
<p> Sets the toggle state of the button to <em>s</em>.
<em>s</em> can be <a href="#ToggleState-enum">Off</a>, <a href="#ToggleState-enum">NoChange</a> or <a href="#ToggleState-enum">On</a>.
<p> 
<h3 class=fn>void <a name="setText"></a>QButton::setText ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp; )<tt> [virtual]</tt>
</h3><p>Sets the text shown on the button.
See the <a href="qbutton.html#text-prop">"text"</a> property for details.
<h3 class=fn>void <a name="setToggleButton"></a>QButton::setToggleButton ( bool&nbsp;b )<tt> [protected]</tt>
</h3> 
Makes this button a toggle button when <em>b</em> is TRUE, otherwise
it becomes a normal button.
<p> <p>See also <a href="#toggleButton-prop">toggleButton</a>.

<h3 class=fn>void <a name="setToggleType"></a>QButton::setToggleType ( <a href="qbutton.html#ToggleType-enum">ToggleType</a>&nbsp;type )<tt> [virtual protected]</tt>
</h3>
Sets the toggle type of the button to <em>type</em>.
<p> <em>type</em> can be set to <a href="#ToggleType-enum">SingleShot</a>, <a href="#ToggleType-enum">Toggle</a> and
<tt>TriState</tt>.

<h3 class=fn><a href="qbutton.html#ToggleState-enum">ToggleState</a> <a name="state"></a>QButton::state () const
</h3><p>Returns TRUE if the button is toggled; otherwise returns FALSE.
See the <a href="qbutton.html#toggleState-prop">"toggleState"</a> property for details.
<h3 class=fn>void <a name="stateChanged"></a>QButton::stateChanged ( int&nbsp;state )<tt> [signal]</tt>
</h3>

This signal is emitted whenever a toggle button changes status.
<em>state</em> is 2 if the button is on, 1 if it is in the
<a href="qcheckbox.html#setTristate">"no change" state</a>
or 0 if the button is off.
<p> This may be the result of a user action, <a href="#toggle">toggle</a>() slot activation,
<a href="#setState">setState</a>(), or because <a href="#setOn">setOn</a>() was called.
<p> <p>See also <a href="#clicked">clicked</a>().

<h3 class=fn><a href="qstring.html">QString</a> <a name="text"></a>QButton::text () const
</h3><p>Returns the text shown on the button.
See the <a href="qbutton.html#text-prop">"text"</a> property for details.
<h3 class=fn>void <a name="toggle"></a>QButton::toggle ()<tt> [slot]</tt>
</h3>
Toggles the state of a toggle button.
<p>See also <a href="#on-prop">on</a>, <a href="#setOn">setOn</a>(), <a href="#toggled">toggled</a>() and <a href="#toggleButton-prop">toggleButton</a>.

<h3 class=fn><a href="qbutton.html#ToggleType-enum">ToggleType</a> <a name="toggleType"></a>QButton::toggleType () const
</h3><p>Returns the type of toggle on the button.
See the <a href="qbutton.html#toggleType-prop">"toggleType"</a> property for details.
<h3 class=fn>void <a name="toggled"></a>QButton::toggled ( bool&nbsp;on )<tt> [signal]</tt>
</h3>

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="#toggle">toggle</a>() slot activation,
or because <a href="#setOn">setOn</a>() was called.
<p> <p>See also <a href="#clicked">clicked</a>().

<p>Example: <a href="listbox-example.html#x1268">listbox/listbox.cpp</a>.
<hr><h2>Property Documentation</h2>
<h3 class=fn><a href="qkeysequence.html">QKeySequence</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="autoRepeat-prop"></a>autoRepeat</h3> <p>This property holds whether autoRepeat is enabled.
<p>If autoRepeat is enabled then the <a href="#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="autoResize-prop"></a>autoResize</h3> <p>This property holds whether autoResize is enabled.
<p><b>This property is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
<p> If autoResize is enabled then the button will resize itself
whenever the contents are changed.

<p>Set this property's value with <a href="#setAutoResize">setAutoResize</a>() and get this property's value with <a href="#autoResize">autoResize</a>().
<h3 class=fn>bool <a name="down-prop"></a>down</h3> <p>This property holds whether the button is pressed.
<p>If this property is TRUE, the button is set to be pressed down.  The
signals <a href="#pressed">pressed</a>() and <a href="#clicked">clicked</a>() are not emitted if you set this
property to TRUE. The default is FALSE.

<p>Set this property's value with <a href="#setDown">setDown</a>() and get this property's value with <a href="#isDown">isDown</a>().
<h3 class=fn>bool <a name="exclusiveToggle-prop"></a>exclusiveToggle</h3> <p>This property holds whether the button is an exclusive toggle.
<p>If this property is TRUE and the button is in a <a href="qbuttongroup.html">QButtonGroup</a>, the
button can only be toggled off by another one being toggled on. The
default is FALSE.

<p>Get this property's value with <a href="#isExclusiveToggle">isExclusiveToggle</a>().
<h3 class=fn>bool <a name="on-prop"></a>on</h3> <p>This property holds whether the button is toggled.
<p>This property should only be set for toggle buttons.

<p>Get this property's value with <a href="#isOn">isOn</a>().
<h3 class=fn><a href="qpixmap.html">QPixmap</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="qbitmap.html">QBitmap</a> or its <a href="qpixmap.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="#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="qstring.html">QString</a> <a name="text-prop"></a>text</h3> <p>This property holds the text shown on the button.
<p>This property will return a null string 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 after the '&amp;' as the accelerator key.
<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>().
<h3 class=fn>bool <a name="toggleButton-prop"></a>toggleButton</h3> <p>This property holds whether the button is a toggle button.
<p>The default value is FALSE.

<p>Get this property's value with <a href="#isToggleButton">isToggleButton</a>().
<h3 class=fn><a href="qbutton.html#ToggleState-enum">ToggleState</a> <a name="toggleState-prop"></a>toggleState</h3> <p>This property holds whether the button is toggled.
<p>If this is property is changed then it does not cause the button
to be repainted.

<p>Get this property's value with <a href="#state">state</a>().
<h3 class=fn><a href="qbutton.html#ToggleType-enum">ToggleType</a> <a name="toggleType-prop"></a>toggleType</h3> <p>This property holds the type of toggle on the button.
<p>The default toggle type is SingleShot.

<p>Get this property's value with <a href="#toggleType">toggleType</a>().
<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">Qt toolkit</a>.
Copyright &copy; 1995-2001
<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; 2001 
<a href="http://www.trolltech.com">Trolltech</a><td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a>
<td align=right><div align=right>Qt version 3.0.2</div>
</table></div></address></body>
</html>