1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Qt Toolkit - QCheckBox 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: white; color: black; }
--></style>
</head><body bgcolor="#ffffff">
<table width="100%">
<tr><td><a href="index.html">
<img width="100" height="100" src="qtlogo.png"
alt="Home" border="0"><img width="100"
height="100" src="face.png" alt="Home" border="0">
</a><td valign=top><div align=right><img src="dochead.png" width="472" height="27"><br>
<a href="classes.html"><b>Classes</b></a>
-<a href="annotated.html">Annotated</a>
- <a href="hierarchy.html">Tree</a>
-<a href="functions.html">Functions</a>
-<a href="index.html">Home</a>
-<a href="topicals.html"><b>Structure</b></a>
</div>
</table>
<h1 align=center>QCheckBox Class Reference</h1><br clear="all">
<p>
The QCheckBox widget provides a check box with a text label.
<a href="#details">More...</a>
<p>
<code>#include <<a href="qcheckbox-h.html">qcheckbox.h</a>></code>
<p>
Inherits <a href="qbutton.html">QButton</a>.
<p><a href="qcheckbox-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li><div class="fn"><a href="#fee76b"><b>QCheckBox</b></a>(QWidget*parent, constchar*name=0)</div>
<li><div class="fn"><a href="#1435d9"><b>QCheckBox</b></a>(constQString&text, QWidget*parent, constchar*name=0)</div>
<li><div class="fn">bool<a href="#17b182"><b>isChecked</b></a>()const</div>
<li><div class="fn">void<a href="#08b09c"><b>setChecked</b></a>(boolcheck)</div>
<li><div class="fn">void<a href="#d27876"><b>setNoChange</b></a>()</div>
<li><div class="fn">void<a href="#aea03f"><b>setTristate</b></a>(booly=TRUE)</div>
<li><div class="fn">bool<a href="#ae7654"><b>isTristate</b></a>()const</div>
</ul>
<h2>Important Inherited Members</h2>
<ul>
<li><div class="fn">QString<a href="qbutton.html#6033fb"><b>text</b></a>()const</div>
<li><div class="fn">virtualvoid<a href="qbutton.html#989f4f"><b>setText</b></a>(constQString&text)</div>
<li><div class="fn">QString<a href="qbutton.html#6033fb"><b>text</b></a>()const</div>
<li><div class="fn">constQPixmap*<a href="qbutton.html#0e318f"><b>pixmap</b></a>()const</div>
<li><div class="fn">virtualvoid<a href="qbutton.html#27e4fe"><b>setPixmap</b></a>(constQPixmap&pixmap)</div>
<li><div class="fn">int<a href="qbutton.html#eff9e3"><b>accel</b></a>()const</div>
<li><div class="fn">virtualvoid<a href="qbutton.html#da0271"><b>setAccel</b></a>(intkey)</div>
<li><div class="fn">bool<a href="qbutton.html#1ad908"><b>isToggleButton</b></a>()const</div>
<li><div class="fn">virtualvoid<a href="qbutton.html#f865ac"><b>setDown</b></a>(boolenable)</div>
<li><div class="fn">bool<a href="qbutton.html#ea8b93"><b>isDown</b></a>()const</div>
<li><div class="fn">bool<a href="qbutton.html#12ce08"><b>isOn</b></a>()const</div>
<li><div class="fn">bool<a href="qbutton.html#359c59"><b>autoRepeat</b></a>()const</div>
<li><div class="fn">bool<a href="qbutton.html#7ab492"><b>isExclusiveToggle</b></a>()const</div>
<li><div class="fn">QButtonGroup*<a href="qbutton.html#a64d2c"><b>group</b></a>()const</div>
<li><div class="fn">virtualvoid<a href="qbutton.html#221ffa"><b>setAutoRepeat</b></a>(boolenable)</div>
<li><div class="fn">void<a href="qbutton.html#e6faa9"><b>toggle</b></a>()</div>
<li><div class="fn">void<a href="qbutton.html#a27000"><b>pressed</b></a>()</div>
<li><div class="fn">void<a href="qbutton.html#e6fa8e"><b>released</b></a>()</div>
<li><div class="fn">void<a href="qbutton.html#da7248"><b>clicked</b></a>()</div>
<li><div class="fn">void<a href="qbutton.html#4069b1"><b>toggled</b></a>(boolon)</div>
<li><div class="fn">void<a href="qbutton.html#3369ee"><b>stateChanged</b></a>(intstate)</div>
</ul>
<h2>Properties</h2>
<table border=1 cellpadding=3 cellspacing=0>
<tr><th>Type<th>Name<th>READ<th>WRITE<th>Options
<tr><td>bool<td>checked<td>isChecked<td>setChecked<td>
<tr><td>bool<td>tristate<td>isTristate<td>setTristate<td>
</table>
<hr><h2><a name="details"></a>Detailed Description</h2>
The QCheckBox widget provides a check box with a text label.
<p>
QCheckBox and <a href="qradiobutton.html">QRadioButton</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. Radio buttons define
a "one of many" choice, while check-boxes provide "many of many"
choices.
<p>While it is technically possible to implement radio-behaviour with
check boxes and vice versa, it's strongly recommended to stick with
the well-known semantics. Otherwise your users would be pretty
confused.
<p>Use <a href="qbuttongroup.html">QButtonGroup</a> to group check-buttons visually.
<p>Whenver a check box is checked or cleared, it emits the signal
<a href="qbutton.html#4069b1">toggled</a>(). Connect to this signal if you want to trigger an action
each time the box changes state. Otherwise, use <a href="#17b182">isChecked</a>() to query
whether or not a particular check box is selected.
<p>In addition to the usual checked and unchecked states, QCheckBox
optionally provides a third state to indicate "no change". This is
useful whenever you need to give the user the option of neither
setting nor unsetting an option. If you need that third state,
enable it with <a href="#aea03f">setTristate</a>() and use <a href="qbutton.html#7b764f">state</a>() to query the current
toggle state. When a tristate box changes state, it emits the
<a href="qbutton.html#3369ee">stateChanged</a>() signal.
<p><img src=qchkbox-m.png> <img src=qchkbox-w.png>
<p>See also <a href="qbutton.html">QButton</a>, <a href="qradiobutton.html">QRadioButton</a> and <a href="guibooks.html#fowler">Fowler: Check Box.</a>
<p>Examples:
<a href="xform-xform-cpp.html#QCheckBox">xform/xform.cpp</a>
<a href="i18n-main-cpp.html#QCheckBox">i18n/main.cpp</a>
<hr><h2>Member Function Documentation</h2>
<h3 class="fn"><a name="fee76b"></a>QCheckBox::QCheckBox(<a href="qwidget.html">QWidget</a>*parent, constchar*name=0)</h3>
<p>Constructs a check box with no text.
<p>The <em>parent</em> and <em>name</em> arguments are sent to the <a href="qwidget.html">QWidget</a> constructor.
<h3 class="fn"><a name="1435d9"></a>QCheckBox::QCheckBox(const<a href="qstring.html">QString</a>&text, <a href="qwidget.html">QWidget</a>*parent, constchar*name=0)</h3>
<p>Constructs a check box with a text.
<p>The <em>parent</em> and <em>name</em> arguments are sent to the <a href="qwidget.html">QWidget</a> constructor.
<h3 class="fn">void<a name="5cc1f9"></a>QCheckBox::drawButton(<a href="qpainter.html">QPainter</a>*paint) <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qbutton.html#13c577">QButton.</a>
<h3 class="fn">void<a name="005675"></a>QCheckBox::drawButtonLabel(<a href="qpainter.html">QPainter</a>*p) <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qbutton.html#c175f1">QButton.</a>
<h3 class="fn">bool<a name="17b182"></a>QCheckBox::isChecked()const</h3>
<p>Returns TRUE if the check box is checked, or FALSE if it is not checked.
<p>See also <a href="#08b09c">setChecked</a>().
<p>Examples:
<a href="xform-xform-cpp.html#isChecked">xform/xform.cpp</a>
<h3 class="fn">bool<a name="ae7654"></a>QCheckBox::isTristate()const</h3>
<p>Returns TRUE if the checkbox is a tristate checkbox. Otherwise returns
FALSE.
<p>See also <a href="#aea03f">setTristate</a>().
<h3 class="fn">void<a name="806122"></a>QCheckBox::resizeEvent(<a href="qresizeevent.html">QResizeEvent</a>*) <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#7d375f">QWidget.</a>
<h3 class="fn">void<a name="08b09c"></a>QCheckBox::setChecked(boolcheck)</h3>
<p>Checks the check box if <em>check</em> is TRUE, or unchecks it if <em>check</em>
is FALSE.
<p>See also <a href="#17b182">isChecked</a>().
<h3 class="fn">void<a name="d27876"></a>QCheckBox::setNoChange()</h3>
<p>Sets the checkbox into the "no change" state.
<p>See also <a href="#aea03f">setTristate</a>().
<h3 class="fn">void<a name="aea03f"></a>QCheckBox::setTristate(booly=TRUE)</h3>
<p>Makes the check box a tristate check box if <em>y</em> is TRUE. A tristate
check box provides an additional state NoChange.
<p>Use tristate check boxes whenever you need to give the user the
option of neither setting nor unsetting an option. A typical example
is the "Italic" check box in the font dialog of a word processor
when the marked text is partially Italic and partially not.
<p>See also <a href="#ae7654">isTristate</a>(), <a href="#d27876">setNoChange</a>(), <a href="qbutton.html#3369ee">stateChanged</a>() and <a href="qbutton.html#7b764f">state</a>().
<h3 class="fn"><a href="qsize.html">QSize</a><a name="6a1396"></a>QCheckBox::sizeHint()const <code>[virtual]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#4511d1">QWidget.</a>
<h3 class="fn"><a href="qsizepolicy.html">QSizePolicy</a><a name="d27352"></a>QCheckBox::sizePolicy()const <code>[virtual]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#23726d">QWidget.</a>
<h3 class="fn">void<a name="b02b2f"></a>QCheckBox::updateMask() <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#b8a07f">QWidget.</a>
<hr><p>
Search the documentation, FAQ, qt-interest archive and more (uses
<a href="http://www.trolltech.com">www.trolltech.com</a>):<br>
<form method=post action="http://www.trolltech.com/search.cgi">
<input type=hidden name="version" value="2.3.2"><nobr>
<input size="50" name="search"><input type=submit value="Search">
</nobr></form><hr><p>
This file is part of the <a href="index.html">Qt toolkit</a>,
copyright © 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 2001 Trolltech<td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a>
<td align="right"><div align="right">Qt version 2.3.2</div>
</table></div></address></body></html>
|