Ignore:
Timestamp:
Feb 11, 2010, 11:19:06 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.1 sources.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/gui/widgets/qcheckbox.cpp

    r2 r561  
    22**
    33** 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)
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** 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.
    3838** $QT_END_LICENSE$
    3939**
     
    7474
    7575    \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
    8593
    8694    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:
    103109
    104110    \snippet doc/src/snippets/code/src_gui_widgets_qcheckbox.cpp 0
    105111
    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().
    116121
    117122    \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}.
    124132    \endtable
    125133
     
    139147    \fn void QCheckBox::stateChanged(int state)
    140148
    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.
    143151
    144152    \a state contains the check box's new Qt::CheckState.
     
    162170
    163171/*!
    164     Initialize \a option with the values from this QCheckBox. This method is useful
    165     for subclasses when they need a QStyleOptionButton, but don't want to fill
    166     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.
    167175
    168176    \sa QStyleOption::initFrom()
     
    194202    Constructs a checkbox with the given \a parent, but with no text.
    195203
    196     The \a parent argument is passed on to the QAbstractButton constructor.
     204    \a parent is passed on to the QAbstractButton constructor.
    197205*/
    198206
     
    207215    Constructs a checkbox with the given \a parent and \a text.
    208216
    209     The \a parent argument is passed on to the QAbstractButton constructor.
     217    \a parent is passed on to the QAbstractButton constructor.
    210218*/
    211219
     
    232240
    233241/*!
    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.
    238244
    239245    \sa setCheckState() Qt::CheckState
     
    248254
    249255/*!
    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.
    254259
    255260    \sa checkState() Qt::CheckState
     
    275280
    276281
    277 /*!\reimp
     282/*!
     283    \reimp
    278284*/
    279285QSize QCheckBox::sizeHint() const
     
    295301}
    296302
    297 /*!\reimp
     303/*!
     304    \reimp
    298305*/
    299306void QCheckBox::paintEvent(QPaintEvent *)
     
    326333
    327334
    328 /*!\reimp*/
     335/*!
     336    \reimp
     337*/
    329338bool QCheckBox::hitButton(const QPoint &pos) const
    330339{
     
    334343}
    335344
    336 /*!\reimp*/
     345/*!
     346    \reimp
     347*/
    337348void QCheckBox::checkStateSet()
    338349{
     
    346357}
    347358
    348 /*!\reimp*/
     359/*!
     360    \reimp
     361*/
    349362void QCheckBox::nextCheckState()
    350363{
Note: See TracChangeset for help on using the changeset viewer.