Changeset 561 for trunk/src/gui/widgets/qcheckbox.cpp
- Timestamp:
- Feb 11, 2010, 11:19:06 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/vendor/nokia/qt/4.6.1 merged eligible /branches/vendor/nokia/qt/current merged eligible /branches/vendor/trolltech/qt/current 3-149
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/src/gui/widgets/qcheckbox.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the QtGui module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 74 74 75 75 \ingroup basicwidgets 76 \mainclass 77 78 A QCheckBox is an option button that can be switched on (checked) 79 or off (unchecked). Checkboxes are typically used to represent 80 features in an application that can be enabled or disabled without 81 affecting others, but different types of behavior can be 82 implemented. 83 84 A QButtonGroup can be used to group check buttons visually. 76 77 78 A QCheckBox is an option button that can be switched on (checked) or off 79 (unchecked). Checkboxes are typically used to represent features in an 80 application that can be enabled or disabled without affecting others, but 81 different types of behavior can be implemented. For example, a 82 QButtonGroup can be used to group check buttons logically, allowing 83 exclusive checkboxes. However, QButtonGroup does not provide any visual 84 representation. 85 86 The image below further illustrates the differences between exclusive and 87 non-exclusive checkboxes. 88 89 \table 90 \row \o \inlineimage checkboxes-exclusive.png 91 \o \inlineimage checkboxes-non-exclusive.png 92 \endtable 85 93 86 94 Whenever a checkbox is checked or cleared it emits the signal 87 stateChanged(). Connect to this signal if you want to trigger an 88 action each time the checkbox changes state. You can use 89 isChecked() to query whether or not a checkbox is checked. 90 91 In addition to the usual checked and unchecked states, QCheckBox 92 optionally provides a third state to indicate "no change". This 93 is useful whenever you need to give the user the option of neither 94 checking nor unchecking a checkbox. If you need this third state, 95 enable it with setTristate(), and use checkState() to query the current 96 toggle state. 97 98 Just like QPushButton, a checkbox displays text, and optionally a 99 small icon. The icon is set with setIcon(). The text can be set in 100 the constructor or with setText(). A shortcut key can be specified 101 by preceding the preferred character with an ampersand. For 102 example: 95 stateChanged(). Connect to this signal if you want to trigger an action 96 each time the checkbox changes state. You can use isChecked() to query 97 whether or not a checkbox is checked. 98 99 In addition to the usual checked and unchecked states, QCheckBox optionally 100 provides a third state to indicate "no change". This is useful whenever you 101 need to give the user the option of neither checking nor unchecking a 102 checkbox. If you need this third state, enable it with setTristate(), and 103 use checkState() to query the current toggle state. 104 105 Just like QPushButton, a checkbox displays text, and optionally a small 106 icon. The icon is set with setIcon(). The text can be set in the 107 constructor or with setText(). A shortcut key can be specified by preceding 108 the preferred character with an ampersand. For example: 103 109 104 110 \snippet doc/src/snippets/code/src_gui_widgets_qcheckbox.cpp 0 105 111 106 In this example the shortcut is \e{Alt+A}. See the \l 107 {QShortcut#mnemonic}{QShortcut} documentation for details (to 108 display an actual ampersand, use '&&'). 109 110 Important inherited functions: text(), setText(), text(), 111 pixmap(), setPixmap(), accel(), setAccel(), isToggleButton(), 112 setDown(), isDown(), isOn(), checkState(), autoRepeat(), 113 isExclusiveToggle(), group(), setAutoRepeat(), toggle(), 114 pressed(), released(), clicked(), toggled(), checkState(), and 115 stateChanged(). 112 In this example the shortcut is \e{Alt+A}. See the \l{QShortcut#mnemonic} 113 {QShortcut} documentation for details (to display an actual ampersand, 114 use '&&'). 115 116 Important inherited functions: text(), setText(), text(), pixmap(), 117 setPixmap(), accel(), setAccel(), isToggleButton(), setDown(), isDown(), 118 isOn(), checkState(), autoRepeat(), isExclusiveToggle(), group(), 119 setAutoRepeat(), toggle(), pressed(), released(), clicked(), toggled(), 120 checkState(), and stateChanged(). 116 121 117 122 \table 100% 118 \row \o \inlineimage macintosh-checkbox.png Screenshot of a Macintosh style checkbox 119 \o A checkbox shown in the \l{Macintosh Style Widget Gallery}{Macintosh widget style}. 120 \row \o \inlineimage windows-checkbox.png Screenshot of a Windows XP style checkbox 121 \o A checkbox shown in the \l{Windows XP Style Widget Gallery}{Windows XP widget style}. 122 \row \o \inlineimage plastique-checkbox.png Screenshot of a Plastique style checkbox 123 \o A checkbox shown in the \l{Plastique Style Widget Gallery}{Plastique widget style}. 123 \row 124 \o \inlineimage macintosh-checkbox.png Screenshot of a Macintosh style checkbox 125 \o A checkbox shown in the \l{Macintosh Style Widget Gallery}{Macintosh widget style}. 126 \row 127 \o \inlineimage windows-checkbox.png Screenshot of a Windows XP style checkbox 128 \o A checkbox shown in the \l{Windows XP Style Widget Gallery}{Windows XP widget style}. 129 \row 130 \o \inlineimage plastique-checkbox.png Screenshot of a Plastique style checkbox 131 \o A checkbox shown in the \l{Plastique Style Widget Gallery}{Plastique widget style}. 124 132 \endtable 125 133 … … 139 147 \fn void QCheckBox::stateChanged(int state) 140 148 141 This signal is emitted whenever the check box's state changes, 142 i.e.whenever the user checks or unchecks it.149 This signal is emitted whenever the check box's state changes, i.e. 150 whenever the user checks or unchecks it. 143 151 144 152 \a state contains the check box's new Qt::CheckState. … … 162 170 163 171 /*! 164 Initialize \a option with the values from this QCheckBox. This method is useful165 for subclasses when they need a QStyleOptionButton, but don't want to fill166 in all the information themselves.172 Initializes \a option with the values from this QCheckBox. This method is 173 useful for subclasses that require a QStyleOptionButton, but do not want 174 to fill in all the information themselves. 167 175 168 176 \sa QStyleOption::initFrom() … … 194 202 Constructs a checkbox with the given \a parent, but with no text. 195 203 196 The \a parent argument is passed on to the QAbstractButton constructor.204 \a parent is passed on to the QAbstractButton constructor. 197 205 */ 198 206 … … 207 215 Constructs a checkbox with the given \a parent and \a text. 208 216 209 The \a parent argument is passed on to the QAbstractButton constructor.217 \a parent is passed on to the QAbstractButton constructor. 210 218 */ 211 219 … … 232 240 233 241 /*! 234 Returns the check box's check state. 235 If you do not need tristate support, you can also 236 use \l QAbstractButton::isChecked() which returns 237 a boolean. 242 Returns the check box's check state. If you do not need tristate support, 243 you can also use \l QAbstractButton::isChecked() which returns a boolean. 238 244 239 245 \sa setCheckState() Qt::CheckState … … 248 254 249 255 /*! 250 Sets the check box's check state to \a state. 251 If you do not need tristate support, you can also 252 use \l QAbstractButton::setChecked() which takes 253 a boolean. 256 Sets the check box's check state to \a state. If you do not need tristate 257 support, you can also use \l QAbstractButton::setChecked() which takes a 258 boolean. 254 259 255 260 \sa checkState() Qt::CheckState … … 275 280 276 281 277 /*!\reimp 282 /*! 283 \reimp 278 284 */ 279 285 QSize QCheckBox::sizeHint() const … … 295 301 } 296 302 297 /*!\reimp 303 /*! 304 \reimp 298 305 */ 299 306 void QCheckBox::paintEvent(QPaintEvent *) … … 326 333 327 334 328 /*!\reimp*/ 335 /*! 336 \reimp 337 */ 329 338 bool QCheckBox::hitButton(const QPoint &pos) const 330 339 { … … 334 343 } 335 344 336 /*!\reimp*/ 345 /*! 346 \reimp 347 */ 337 348 void QCheckBox::checkStateSet() 338 349 { … … 346 357 } 347 358 348 /*!\reimp*/ 359 /*! 360 \reimp 361 */ 349 362 void QCheckBox::nextCheckState() 350 363 {
Note:
See TracChangeset
for help on using the changeset viewer.