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.
463 lines
28 KiB
463 lines
28 KiB
13 years ago
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||
4 months ago
|
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/widgets/tqbutton.cpp:126 -->
|
||
13 years ago
|
<html>
|
||
|
<head>
|
||
|
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||
|
<title>TQButton 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>TQButton Class Reference</h1>
|
||
|
|
||
|
<p>The TQButton class is the abstract base class of button
|
||
|
widgets, providing functionality common to buttons.
|
||
|
<a href="#details">More...</a>
|
||
4 months ago
|
<p><tt>#include <<a href="tqbutton-h.html">tqbutton.h</a>></tt>
|
||
7 months ago
|
<p>Inherits <a href="tqwidget.html">TQWidget</a>.
|
||
5 months ago
|
<p>Inherited by <a href="tqcheckbox.html">TQCheckBox</a>, <a href="tqpushbutton.html">TQPushButton</a>, <a href="tqradiobutton.html">TQRadioButton</a>, and <a href="tqtoolbutton.html">TQToolButton</a>.
|
||
4 months ago
|
<p><a href="tqbutton-members.html">List of all member functions.</a>
|
||
13 years ago
|
<h2>Public Members</h2>
|
||
|
<ul>
|
||
|
<li class=fn><a href="#TQButton"><b>TQButton</b></a> ( TQWidget * parent = 0, const char * name = 0, WFlags f = 0 )</li>
|
||
|
<li class=fn><a href="#~TQButton"><b>~TQButton</b></a> ()</li>
|
||
|
<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 & )</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 & )</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 & )</li>
|
||
|
<li class=fn>bool <a href="#isToggleButton"><b>isToggleButton</b></a> () const</li>
|
||
|
<li class=fn>enum <a href="#ToggleType-enum"><b>ToggleType</b></a> { SingleShot, Toggle, Tristate }</li>
|
||
|
<li class=fn>ToggleType <a href="#toggleType"><b>toggleType</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>enum <a href="#ToggleState-enum"><b>ToggleState</b></a> { Off, NoChange, On }</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>
|
||
|
</ul>
|
||
|
<h2>Public Slots</h2>
|
||
|
<ul>
|
||
|
<li class=fn>void <a href="#animateClick"><b>animateClick</b></a> ()</li>
|
||
|
<li class=fn>void <a href="#toggle"><b>toggle</b></a> ()</li>
|
||
|
</ul>
|
||
|
<h2>Signals</h2>
|
||
|
<ul>
|
||
|
<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 on )</li>
|
||
|
<li class=fn>void <a href="#stateChanged"><b>stateChanged</b></a> ( int state )</li>
|
||
|
</ul>
|
||
|
<h2>Properties</h2>
|
||
|
<ul>
|
||
|
<li class=fn>TQKeySequence <a href="#accel-prop"><b>accel</b></a> - the accelerator associated with the button</li>
|
||
|
<li class=fn>bool <a href="#autoRepeat-prop"><b>autoRepeat</b></a> - whether autoRepeat is enabled</li>
|
||
|
<li class=fn>bool <a href="#down-prop"><b>down</b></a> - whether the button is pressed</li>
|
||
|
<li class=fn>bool <a href="#exclusiveToggle-prop"><b>exclusiveToggle</b></a> - whether the button is an exclusive toggle <em>(read only)</em></li>
|
||
|
<li class=fn>bool <a href="#on-prop"><b>on</b></a> - whether the button is toggled <em>(read only)</em></li>
|
||
|
<li class=fn>TQPixmap <a href="#pixmap-prop"><b>pixmap</b></a> - the pixmap shown on the button</li>
|
||
|
<li class=fn>TQString <a href="#text-prop"><b>text</b></a> - the text shown on the button</li>
|
||
|
<li class=fn>bool <a href="#toggleButton-prop"><b>toggleButton</b></a> - whether the button is a toggle button <em>(read only)</em></li>
|
||
|
<li class=fn>ToggleState <a href="#toggleState-prop"><b>toggleState</b></a> - the state of the toggle button <em>(read only)</em></li>
|
||
|
<li class=fn>ToggleType <a href="#toggleType-prop"><b>toggleType</b></a> - the type of toggle on the button <em>(read only)</em></li>
|
||
|
</ul>
|
||
|
<h2>Protected Members</h2>
|
||
|
<ul>
|
||
|
<li class=fn>void <a href="#setToggleButton"><b>setToggleButton</b></a> ( bool b )</li>
|
||
|
<li class=fn>virtual void <a href="#setToggleType"><b>setToggleType</b></a> ( ToggleType type )</li>
|
||
|
<li class=fn>void <a href="#setOn"><b>setOn</b></a> ( bool on )</li>
|
||
|
<li class=fn>virtual void <a href="#setState"><b>setState</b></a> ( ToggleState s )</li>
|
||
|
<li class=fn>virtual bool <a href="#hitButton"><b>hitButton</b></a> ( const TQPoint & pos ) const</li>
|
||
|
<li class=fn>virtual void <a href="#drawButton"><b>drawButton</b></a> ( TQPainter * )</li>
|
||
|
<li class=fn>virtual void <a href="#drawButtonLabel"><b>drawButtonLabel</b></a> ( TQPainter * )</li>
|
||
|
<li class=fn>virtual void <a href="#paintEvent"><b>paintEvent</b></a> ( TQPaintEvent * )</li>
|
||
|
</ul>
|
||
|
<hr><a name="details"></a><h2>Detailed Description</h2>
|
||
|
|
||
|
|
||
|
The TQButton class is the abstract base class of button
|
||
|
widgets, providing functionality common to buttons.
|
||
|
<p>
|
||
5 months ago
|
<p> <b>If you want to create a button use <a href="tqpushbutton.html">TQPushButton</a>.</b>
|
||
13 years ago
|
<p> The TQButton class implements an <em>abstract</em> button, and lets
|
||
|
subclasses specify how to reply to user actions and how to draw
|
||
|
the button.
|
||
5 months ago
|
<p> TQButton provides both push and toggle buttons. The <a href="tqradiobutton.html">TQRadioButton</a>
|
||
|
and <a href="tqcheckbox.html">TQCheckBox</a> classes provide only toggle buttons; TQPushButton and
|
||
6 months ago
|
<a href="tqtoolbutton.html">TQToolButton</a> provide both toggle and push buttons.
|
||
13 years ago
|
<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> TQButton provides most of the states used for buttons:
|
||
|
<ul>
|
||
|
<li> <a href="#isDown">isDown</a>() indicates whether the button is <em>pressed</em> down.
|
||
|
<li> <a href="#isOn">isOn</a>() indicates whether the button is <em>on</em>.
|
||
|
Only toggle buttons can be switched on and off (see below).
|
||
7 months ago
|
<li> <a href="tqwidget.html#isEnabled">isEnabled</a>() indicates whether the button can be pressed by the
|
||
13 years ago
|
user.
|
||
|
<li> <a href="#setAutoRepeat">setAutoRepeat</a>() sets whether the button will auto-repeat
|
||
|
if the user holds it down.
|
||
|
<li> <a href="#setToggleButton">setToggleButton</a>() sets 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 the <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
|
||
5 months ago
|
<a href="tqpushbutton.html#setDefault">TQPushButton::setDefault</a>() and <a href="tqpushbutton.html#setAutoDefault">TQPushButton::setAutoDefault</a>().
|
||
13 years ago
|
<p> TQButton provides five signals:
|
||
|
<ol type=1>
|
||
|
<li> <a href="#pressed">pressed</a>() is emitted when the button is pressed. E.g. with the mouse
|
||
|
or when <a href="#animateClick">animateClick</a>() is called.
|
||
|
<li> <a href="#released">released</a>() is emitted when the button is released. E.g. when the mouse
|
||
|
is released or the cursor is moved outside the widget.
|
||
|
<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
|
||
|
animateClick() 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 an ampersand (&) in its text,
|
||
|
TQButton creates an automatic accelerator key. This code creates a
|
||
|
push button labelled "Ro<u>c</u>k & Roll" (where the c is
|
||
|
underlined). The button gets an automatic accelerator key, Alt+C:
|
||
|
<p> <pre>
|
||
5 months ago
|
<a href="tqpushbutton.html">TQPushButton</a> *p = new <a href="tqpushbutton.html">TQPushButton</a>( "Ro&ck && Roll", this );
|
||
13 years ago
|
</pre>
|
||
|
|
||
|
<p> In this example, when the user presses Alt+C the button will call
|
||
|
<a href="#animateClick">animateClick</a>().
|
||
|
<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>
|
||
|
p->setPixmap( TQPixmap("print.png") );
|
||
|
p->setAccel( ALT+Key_F7 );
|
||
|
</pre>
|
||
|
|
||
5 months ago
|
<p> All of the buttons provided by TQt (<a href="tqpushbutton.html">TQPushButton</a>, <a href="tqtoolbutton.html">TQToolButton</a>,
|
||
|
<a href="tqcheckbox.html">TQCheckBox</a> and <a href="tqradiobutton.html">TQRadioButton</a>) can display both text and
|
||
13 years ago
|
pixmaps.
|
||
|
<p> To subclass TQButton, you must 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
|
||
7 months ago
|
<a href="tqwidget.html#sizeHint">sizeHint</a>() as well, and sometimes <a href="#hitButton">hitButton</a>() (to determine
|
||
13 years ago
|
whether a button press is within the button).
|
||
|
<p> To reduce flickering, <a href="#paintEvent">TQButton::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 TQButton unless you want to take
|
||
|
over all drawing.
|
||
4 months ago
|
<p> <p>See also <a href="tqbuttongroup.html">TQButtonGroup</a> and <a href="abstractwidgets.html">Abstract Widget Classes</a>.
|
||
13 years ago
|
|
||
|
<hr><h2>Member Type Documentation</h2>
|
||
|
<h3 class=fn><a name="ToggleState-enum"></a>TQButton::ToggleState</h3>
|
||
|
|
||
|
<p> This enum defines the state of a toggle button.
|
||
|
<ul>
|
||
|
<li><tt>TQButton::Off</tt> - the button is in the "off" state
|
||
|
<li><tt>TQButton::NoChange</tt> - the button is in the default/unchanged state
|
||
|
<li><tt>TQButton::On</tt> - the button is in the "on" state
|
||
|
</ul>
|
||
|
<h3 class=fn><a name="ToggleType-enum"></a>TQButton::ToggleType</h3>
|
||
|
|
||
|
<p> This enum type defines what a button can do in response to a
|
||
|
mouse/keyboard press:
|
||
|
<ul>
|
||
|
<li><tt>TQButton::SingleShot</tt> - pressing the button causes an action, then the
|
||
|
button returns to the unpressed state.
|
||
|
<li><tt>TQButton::Toggle</tt> - pressing the button toggles it between an <a href="#ToggleState-enum">On</a> and
|
||
|
an <a href="#ToggleState-enum">Off</a> state.
|
||
|
<li><tt>TQButton::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>
|
||
|
<hr><h2>Member Function Documentation</h2>
|
||
7 months ago
|
<h3 class=fn><a name="TQButton"></a>TQButton::TQButton ( <a href="tqwidget.html">TQWidget</a> * parent = 0, const char * name = 0, WFlags f = 0 )
|
||
13 years ago
|
</h3>
|
||
|
Constructs a standard button called <em>name</em> with parent <em>parent</em>,
|
||
|
using the widget flags <em>f</em>.
|
||
4 months ago
|
<p> If <em>parent</em> is a <a href="tqbuttongroup.html">TQButtonGroup</a>, this constructor calls
|
||
|
<a href="tqbuttongroup.html#insert">TQButtonGroup::insert</a>().
|
||
13 years ago
|
|
||
|
<h3 class=fn><a name="~TQButton"></a>TQButton::~TQButton ()
|
||
|
</h3>
|
||
|
Destroys the button.
|
||
|
|
||
13 years ago
|
<h3 class=fn><a href="ntqkeysequence.html">TQKeySequence</a> <a name="accel"></a>TQButton::accel () const
|
||
13 years ago
|
</h3><p>Returns the accelerator associated with the button.
|
||
4 months ago
|
See the <a href="tqbutton.html#accel-prop">"accel"</a> property for details.
|
||
13 years ago
|
<h3 class=fn>void <a name="animateClick"></a>TQButton::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.
|
||
7 months ago
|
<p> This function does nothing if the button is <a href="tqwidget.html#setEnabled">disabled.</a>
|
||
13 years ago
|
<p> <p>See also <a href="#accel-prop">accel</a>.
|
||
|
|
||
|
<h3 class=fn>bool <a name="autoRepeat"></a>TQButton::autoRepeat () const
|
||
|
</h3><p>Returns TRUE if autoRepeat is enabled; otherwise returns FALSE.
|
||
4 months ago
|
See the <a href="tqbutton.html#autoRepeat-prop">"autoRepeat"</a> property for details.
|
||
13 years ago
|
<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="#animateClick">animateClick</a>()
|
||
|
is called. This signal is <em>not</em> emitted if you call <a href="#setDown">setDown</a>().
|
||
4 months ago
|
<p> The <a href="tqbuttongroup.html#clicked">TQButtonGroup::clicked</a>() signal does the same job, if you want
|
||
13 years ago
|
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="#autoRepeat-prop">autoRepeat</a> turned on.
|
||
|
<p> <p>See also <a href="#pressed">pressed</a>(), <a href="#released">released</a>(), <a href="#toggled">toggled</a>(), <a href="#autoRepeat-prop">autoRepeat</a>, and <a href="#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>.
|
||
5 months ago
|
<h3 class=fn>void <a name="drawButton"></a>TQButton::drawButton ( <a href="tqpainter.html">TQPainter</a> * )<tt> [virtual protected]</tt>
|
||
13 years ago
|
</h3>
|
||
|
Draws the button. The default implementation does nothing.
|
||
|
<p> This virtual function is reimplemented by subclasses to draw real
|
||
|
buttons. At some point, these reimplementations should call
|
||
|
<a href="#drawButtonLabel">drawButtonLabel</a>().
|
||
|
<p> <p>See also <a href="#drawButtonLabel">drawButtonLabel</a>() and <a href="#paintEvent">paintEvent</a>().
|
||
|
|
||
5 months ago
|
<h3 class=fn>void <a name="drawButtonLabel"></a>TQButton::drawButtonLabel ( <a href="tqpainter.html">TQPainter</a> * )<tt> [virtual protected]</tt>
|
||
13 years ago
|
</h3>
|
||
|
Draws the button text or pixmap.
|
||
|
<p> This virtual function is reimplemented by subclasses to draw real
|
||
|
buttons. It is invoked by <a href="#drawButton">drawButton</a>().
|
||
|
<p> <p>See also <a href="#drawButton">drawButton</a>() and <a href="#paintEvent">paintEvent</a>().
|
||
|
|
||
4 months ago
|
<h3 class=fn><a href="tqbuttongroup.html">TQButtonGroup</a> * <a name="group"></a>TQButton::group () const
|
||
13 years ago
|
</h3>
|
||
|
Returns the group that this button belongs to.
|
||
4 months ago
|
<p> If the button is not a member of any <a href="tqbuttongroup.html">TQButtonGroup</a>, this function
|
||
13 years ago
|
returns 0.
|
||
4 months ago
|
<p> <p>See also <a href="tqbuttongroup.html">TQButtonGroup</a>.
|
||
13 years ago
|
|
||
5 months ago
|
<h3 class=fn>bool <a name="hitButton"></a>TQButton::hitButton ( const <a href="tqpoint.html">TQPoint</a> & pos ) const<tt> [virtual protected]</tt>
|
||
13 years ago
|
</h3>
|
||
|
Returns TRUE if <em>pos</em> is inside the clickable button rectangle;
|
||
|
otherwise returns FALSE.
|
||
|
<p> By default, the clickable area is the entire widget. Subclasses
|
||
|
may reimplement it, though.
|
||
|
|
||
|
<h3 class=fn>bool <a name="isDown"></a>TQButton::isDown () const
|
||
|
</h3><p>Returns TRUE if the button is pressed; otherwise returns FALSE.
|
||
4 months ago
|
See the <a href="tqbutton.html#down-prop">"down"</a> property for details.
|
||
13 years ago
|
<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.
|
||
4 months ago
|
See the <a href="tqbutton.html#exclusiveToggle-prop">"exclusiveToggle"</a> property for details.
|
||
13 years ago
|
<h3 class=fn>bool <a name="isOn"></a>TQButton::isOn () const
|
||
|
</h3><p>Returns TRUE if the button is toggled; otherwise returns FALSE.
|
||
4 months ago
|
See the <a href="tqbutton.html#on-prop">"on"</a> property for details.
|
||
13 years ago
|
<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.
|
||
4 months ago
|
See the <a href="tqbutton.html#toggleButton-prop">"toggleButton"</a> property for details.
|
||
5 months ago
|
<h3 class=fn>void <a name="paintEvent"></a>TQButton::paintEvent ( <a href="tqpaintevent.html">TQPaintEvent</a> * )<tt> [virtual protected]</tt>
|
||
13 years ago
|
</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>().
|
||
|
|
||
7 months ago
|
<p>Reimplemented from <a href="tqwidget.html#paintEvent">TQWidget</a>.
|
||
5 months ago
|
<h3 class=fn>const <a href="tqpixmap.html">TQPixmap</a> * <a name="pixmap"></a>TQButton::pixmap () const
|
||
13 years ago
|
</h3><p>Returns the pixmap shown on the button.
|
||
4 months ago
|
See the <a href="tqbutton.html#pixmap-prop">"pixmap"</a> property for details.
|
||
13 years ago
|
<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="#released">released</a>() and <a href="#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="#pressed">pressed</a>(), <a href="#clicked">clicked</a>(), and <a href="#toggled">toggled</a>().
|
||
|
|
||
13 years ago
|
<h3 class=fn>void <a name="setAccel"></a>TQButton::setAccel ( const <a href="ntqkeysequence.html">TQKeySequence</a> & )<tt> [virtual]</tt>
|
||
13 years ago
|
</h3><p>Sets the accelerator associated with the button.
|
||
4 months ago
|
See the <a href="tqbutton.html#accel-prop">"accel"</a> property for details.
|
||
13 years ago
|
<h3 class=fn>void <a name="setAutoRepeat"></a>TQButton::setAutoRepeat ( bool )<tt> [virtual]</tt>
|
||
|
</h3><p>Sets whether autoRepeat is enabled.
|
||
4 months ago
|
See the <a href="tqbutton.html#autoRepeat-prop">"autoRepeat"</a> property for details.
|
||
13 years ago
|
<h3 class=fn>void <a name="setDown"></a>TQButton::setDown ( bool )<tt> [virtual]</tt>
|
||
|
</h3><p>Sets whether the button is pressed.
|
||
4 months ago
|
See the <a href="tqbutton.html#down-prop">"down"</a> property for details.
|
||
13 years ago
|
<h3 class=fn>void <a name="setOn"></a>TQButton::setOn ( bool on )<tt> [protected]</tt>
|
||
|
</h3>
|
||
|
|
||
|
<p> Sets the state of this button to On if <em>on</em> is TRUE; otherwise to
|
||
|
Off.
|
||
|
<p> <p>See also <a href="#toggleState-prop">toggleState</a>.
|
||
|
|
||
5 months ago
|
<h3 class=fn>void <a name="setPixmap"></a>TQButton::setPixmap ( const <a href="tqpixmap.html">TQPixmap</a> & )<tt> [virtual]</tt>
|
||
13 years ago
|
</h3><p>Sets the pixmap shown on the button.
|
||
4 months ago
|
See the <a href="tqbutton.html#pixmap-prop">"pixmap"</a> property for details.
|
||
|
<h3 class=fn>void <a name="setState"></a>TQButton::setState ( <a href="tqbutton.html#ToggleState-enum">ToggleState</a> s )<tt> [virtual protected]</tt>
|
||
13 years ago
|
</h3>
|
||
|
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>.
|
||
|
|
||
6 months ago
|
<h3 class=fn>void <a name="setText"></a>TQButton::setText ( const <a href="tqstring.html">TQString</a> & )<tt> [virtual]</tt>
|
||
13 years ago
|
</h3><p>Sets the text shown on the button.
|
||
4 months ago
|
See the <a href="tqbutton.html#text-prop">"text"</a> property for details.
|
||
13 years ago
|
<h3 class=fn>void <a name="setToggleButton"></a>TQButton::setToggleButton ( bool b )<tt> [protected]</tt>
|
||
|
</h3>
|
||
|
|
||
|
<p> If <em>b</em> is TRUE, this button becomes a toggle button; if <em>b</em> is
|
||
|
FALSE, this button becomes a command button.
|
||
|
<p> <p>See also <a href="#toggleButton-prop">toggleButton</a>.
|
||
|
|
||
4 months ago
|
<h3 class=fn>void <a name="setToggleType"></a>TQButton::setToggleType ( <a href="tqbutton.html#ToggleType-enum">ToggleType</a> type )<tt> [virtual protected]</tt>
|
||
13 years ago
|
</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 <a href="#ToggleType-enum">Tristate</a>.
|
||
|
|
||
4 months ago
|
<h3 class=fn><a href="tqbutton.html#ToggleState-enum">ToggleState</a> <a name="state"></a>TQButton::state () const
|
||
13 years ago
|
</h3><p>Returns the state of the toggle button.
|
||
4 months ago
|
See the <a href="tqbutton.html#toggleState-prop">"toggleState"</a> property for details.
|
||
13 years ago
|
<h3 class=fn>void <a name="stateChanged"></a>TQButton::stateChanged ( int state )<tt> [signal]</tt>
|
||
|
</h3>
|
||
|
|
||
|
<p> This signal is emitted whenever a toggle button changes state. <em>state</em> is <a href="#ToggleState-enum">On</a> if the button is on, <a href="#ToggleState-enum">NoChange</a> if it is in the
|
||
5 months ago
|
<a href="tqcheckbox.html#setTristate">"no change" state</a> or <a href="#ToggleState-enum">Off</a>
|
||
13 years ago
|
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>() and <a href="#ToggleState-enum">TQButton::ToggleState</a>.
|
||
|
|
||
6 months ago
|
<h3 class=fn><a href="tqstring.html">TQString</a> <a name="text"></a>TQButton::text () const
|
||
13 years ago
|
</h3><p>Returns the text shown on the button.
|
||
4 months ago
|
See the <a href="tqbutton.html#text-prop">"text"</a> property for details.
|
||
13 years ago
|
<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="#on-prop">on</a>, <a href="#setOn">setOn</a>(), <a href="#toggled">toggled</a>(), and <a href="#toggleButton-prop">toggleButton</a>.
|
||
|
|
||
4 months ago
|
<h3 class=fn><a href="tqbutton.html#ToggleType-enum">ToggleType</a> <a name="toggleType"></a>TQButton::toggleType () const
|
||
13 years ago
|
</h3><p>Returns the type of toggle on the button.
|
||
4 months ago
|
See the <a href="tqbutton.html#toggleType-prop">"toggleType"</a> property for details.
|
||
13 years ago
|
<h3 class=fn>void <a name="toggled"></a>TQButton::toggled ( bool 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="#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#x1427">listbox/listbox.cpp</a>.
|
||
|
<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 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="down-prop"></a>down</h3>
|
||
|
<p>This property holds whether the button is pressed.
|
||
|
<p>If this property is TRUE, the button is 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.
|
||
4 months ago
|
<p>If this property is TRUE and the button is in a <a href="tqbuttongroup.html">TQButtonGroup</a>, the
|
||
13 years ago
|
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>().
|
||
5 months ago
|
<h3 class=fn><a href="tqpixmap.html">TQPixmap</a> <a name="pixmap-prop"></a>pixmap</h3>
|
||
13 years ago
|
<p>This property holds the pixmap shown on the button.
|
||
5 months ago
|
<p>If the pixmap is monochrome (i.e. it is a <a href="tqbitmap.html">TQBitmap</a> or its <a href="tqpixmap.html#depth">depth</a> is 1) and it does not have a mask,
|
||
13 years ago
|
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>().
|
||
6 months ago
|
<h3 class=fn><a href="tqstring.html">TQString</a> <a name="text-prop"></a>text</h3>
|
||
13 years ago
|
<p>This property holds the text shown on the button.
|
||
6 months ago
|
<p>This property will return a <a href="tqstring.html#TQString-null">TQString::null</a> if the button has no
|
||
13 years ago
|
text. If the text has an ampersand (&) in it, then an
|
||
|
accelerator is automatically created for it using the character
|
||
|
that follows the '&' 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>().
|
||
|
<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>().
|
||
4 months ago
|
<h3 class=fn><a href="tqbutton.html#ToggleState-enum">ToggleState</a> <a name="toggleState-prop"></a>toggleState</h3>
|
||
13 years ago
|
<p>This property holds the state of the toggle button.
|
||
|
<p>If this 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>().
|
||
4 months ago
|
<h3 class=fn><a href="tqbutton.html#ToggleType-enum">ToggleType</a> <a name="toggleType-prop"></a>toggleType</h3>
|
||
13 years ago
|
<p>This property holds the type of toggle on the button.
|
||
|
<p>The default toggle type is <a href="#ToggleType-enum">SingleShot</a>.
|
||
|
<p> <p>See also <a href="#ToggleType-enum">TQButton::ToggleType</a>.
|
||
|
|
||
|
<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">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>
|