⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qcheckbox.html

📁 QT3的教程
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><!-- /home/reggie/tmp/qt-3.0-reggie-5401/qt-x11-commercial-3.0.5/src/widgets/qcheckbox.cpp:49 --><html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><meta name="Translator" content="Cavendish"><meta name="Qt zh_CN Documents Website" content="http://www.qiliang.net/qt"><title>QCheckBox类</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; font-family: "Times New Roman" }--></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">主页</font></a> | <a href="classes.html"><font color="#004faf">所有的类</font></a> | <a href="mainclasses.html"><font color="#004faf">主要的类</font></a> | <a href="annotated.html"><font color="#004faf">注释的类</font></a> | <a href="groups.html"><font color="#004faf">分组的类</font></a> | <a href="functions.html"><font color="#004faf">函数</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>QCheckBox类参考</h1><p>QCheckBox窗口部件提供一个带文本标签的复选框。<a href="#details">详情请见……</a><p><tt>#include &lt;<a href="qcheckbox-h.html">qcheckbox.h</a>&gt;</tt><p>继承了<a href="qbutton.html">QButton</a>。<p><a href="qcheckbox-members.html">所有成员函数的列表。</a><h2>公有成员</h2><ul><li><div class=fn><a href="#QCheckBox"><b>QCheckBox</b></a> ( QWidget&nbsp;*&nbsp;parent, const&nbsp;char&nbsp;*&nbsp;name = 0 )</div></li><li><div class=fn><a href="#QCheckBox-2"><b>QCheckBox</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;text, QWidget&nbsp;*&nbsp;parent, const&nbsp;char&nbsp;*&nbsp;name = 0 )</div></li><li><div class=fn>bool <a href="#isChecked"><b>isChecked</b></a> () const</div></li><li><div class=fn>void <a href="#setNoChange"><b>setNoChange</b></a> ()</div></li><li><div class=fn>void <a href="#setTristate"><b>setTristate</b></a> ( bool&nbsp;y = TRUE )</div></li><li><div class=fn>bool <a href="#isTristate"><b>isTristate</b></a> () const</div></li></ul><h2>公有槽</h2><ul><li><div class=fn>void <a href="#setChecked"><b>setChecked</b></a> ( bool&nbsp;check )</div></li></ul><h2>重要的继承成员</h2><ul><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>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>ToggleState <a href="#state"><b>state</b></a> () const</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><li><div class=fn>void <a href="#toggle"><b>toggle</b></a> ()</div></li><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>属性</h2><ul><li><div class=fn>bool <a href="#autoMask-prop"><b>autoMask</b></a>&nbsp;- 复选框是否被自动遮蔽&nbsp;<em>(只读)</em></div></li><li><div class=fn>bool <a href="#checked-prop"><b>checked</b></a>&nbsp;- 复选框是否被选中</div></li><li><div class=fn>bool <a href="#tristate-prop"><b>tristate</b></a>&nbsp;- 复选框是否是三态复选框</div></li></ul><hr><a name="details"></a><h2>详细描述</h2>QCheckBox窗口部件提供一个带文本标签的复选框。<p> <p> QCheckBox和<a href="qradiobutton.html">QRadioButton</a>都是选项按钮。这是因为它们都可以在开(选中)或者关(未选中)之间切换。它们的区别是对用户选择的限制。单选框定义了“多选一”的选择,而复选框提供的是“多选多”的选择。<p> 尽管在技术上可以通过复选框来实现单选框的行为,反之亦然,但我们还是强烈建议使用众所周知的约定。<p> <a href="qbuttongroup.html">QButtonGroup</a>可以用来在视觉上把许多复选框组织在一起。<p> 只要复选框被选中或者清除,它都会发射一个信号<a href="qbutton.html#toggled">toggled</a>()。如果你想在复选框改变状态的时候触发一个行为,请连接这个信号。你可以使用<a href="#isChecked">isChecked</a>()来查询复选框是否被选中。<p> 除了常用的被选中和未选中两个状态,QCheckBox还可以任选地提供第三种状态来表明“没有改变”。当你需要给用户一个选中或者未选中复选框的选择时,这是很有用的。如果你需要第三种状态,通过<a href="#setTristate">setTristate</a>()来使它生效并且使用<a href="qbutton.html#state">state</a>()来查询当前的切换状态。当三态复选框改变状态时,它发射<a href="qbutton.html#stateChanged">stateChanged</a>()信号。<p> 和<a href="qpushbutton.html">QPushButton</a>一样,复选框可以显示文本或者像素映射。文本可以通过构造函数或者<a href="qbutton.html#setText">setText</a>()来设置,像素映射可以通过<a href="qbutton.html#setPixmap">setPixmap</a>()来设置。<p> <p> <img src=qchkbox-m.png> <img src=qchkbox-w.png><p> <p>也可以参考<a href="qbutton.html">QButton</a>、<a href="qradiobutton.html">QRadioButton</a>、<a href="guibooks.html#fowler">福勒:复选框</a>和<a href="basic.html">基本窗口部件</a>。<hr><h2>成员函数文档</h2><h3 class=fn><a name="QCheckBox"></a>QCheckBox::QCheckBox ( <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;parent, const&nbsp;char&nbsp;*&nbsp;name = 0 )</h3>构造一个没有文本的复选框。<p> <em>parent</em>和<em>name</em>参数被发送到<a href="qwidget.html">QWidget</a>的构造函数。<h3 class=fn><a name="QCheckBox-2"></a>QCheckBox::QCheckBox ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;text, <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;parent, const&nbsp;char&nbsp;*&nbsp;name = 0 )</h3>构造一个文本为<em>text</em>的复选框。<p> <em>parent</em>和<em>name</em>参数被发送到<a href="qwidget.html">QWidget</a>的构造函数。<h3 class=fn><a href="qkeysequence.html">QKeySequence</a> <a name="accel"></a>QButton::accel () const</h3><p>返回这个按钮的相关快捷键。详细情况请参考<a href="qbutton.html#accel-prop">“accel”</a>属性。<h3 class=fn>bool <a name="autoRepeat"></a>QButton::autoRepeat () const</h3><p>如果autoRepeat生效,返回真,否则返回假。详细情况请参考<a href="qbutton.html#autoRepeat-prop">“autoRepeat”</a>属性。<h3 class=fn>void <a name="clicked"></a>QButton::clicked ()<tt> [信号]</tt></h3><p> 当按钮被激活时(比如,当鼠标光标在按钮中,按钮首先被按下并且然后被释放),或者当快捷键被按下时,或者<a href="#animateClick">animateClick</a>()被调用时,这个信号被发送。如果你调用<a href="#setDown">setDown</a>(),这个信号<em>不</em>被发送。<p> 如果你想把几个按钮连接到同一个槽中,<a href="qbuttongroup.html#clicked">QButtonGroup::clicked</a>()信号可以做这样的工作。<p> <p>也可以参考<a href="qbutton.html#pressed">pressed</a>()、<a href="qbutton.html#released">released</a>()、<a href="qbutton.html#toggled">toggled</a>()、<a href="qbutton.html#autoRepeat-prop">autoRepeat</a>和<a href="qbutton.html#down-prop">down</a>。<p>实例:<a href="simple-qfont-demo-walkthrough.html#x2109">fonts/simple-qfont-demo/viewer.cpp</a>、<a href="listbox-example.html#x1309">listbox/listbox.cpp</a>、<a href="clientserver-example.html#x777">network/clientserver/client/client.cpp</a>、<a href="ftpclient-example.html#x649">network/ftpclient/ftpmainwindow.cpp</a>、<a href="richtext-example.html#x581">richtext/richtext.cpp</a>、<a href="tutorial1-02.html#x2277">t2/main.cpp</a>和<a href="tutorial1-04.html#x2293">t4/main.cpp</a>。<h3 class=fn><a href="qbuttongroup.html">QButtonGroup</a>&nbsp;* <a name="group"></a>QButton::group () const</h3> 返回这个按钮所属的按钮组的指针。<p> 如果这个按钮不是任何一个<a href="qbuttongroup.html">QButtonGroup</a>的成员,这个函数返回0。<p> <p>也可以参考<a href="qbuttongroup.html">QButtonGroup</a>。<h3 class=fn>bool <a name="isChecked"></a>QCheckBox::isChecked () const</h3><p>如果复选框被选中,返回真,否则返回假。详细情况请参考<a href="qcheckbox.html#checked-prop">“checked”</a>属性。<h3 class=fn>bool <a name="isDown"></a>QButton::isDown () const</h3><p>如果按钮被按下,返回真,否则返回假。详细情况请参考<a href="qbutton.html#down-prop">“down”</a>属性。<h3 class=fn>bool <a name="isExclusiveToggle"></a>QButton::isExclusiveToggle () const

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -