Qt logo

QCheckBox Class Reference


The QCheckBox widget provides a check box with a text label. More...

#include <qcheckbox.h>

Inherits QButton.

List of all member functions.

Public Members

Protected Members


Detailed Description

The QCheckBox widget provides a check box with a text label.

QCheckBox and QRadioButton are both toggle buttons, but a check box represents an independent switch that can be on (checked) or off (unchecked).

See also: QButton, QRadioButton and Fowler: Check Box.

Examples: tabdialog/tabdialog.cpp xform/xform.cpp


Member Function Documentation

QCheckBox::QCheckBox(QWidget*parent, constchar*name=0)

Constructs a check box with no text.

The parent and name arguments are sent to the QWidget constructor.

QCheckBox::QCheckBox(constQString&text, QWidget*parent, constchar*name=0)

Constructs a check box with a text.

The parent and name arguments are sent to the QWidget constructor.

voidQCheckBox::drawButton(QPainter*paint) [virtualprotected]

Draws the check box. Calls drawButtonLabel() to draw the content.

See also: drawButtonLabel().

Reimplemented from QButton.

voidQCheckBox::drawButtonLabel(QPainter*p) [virtualprotected]

Draws the check box label.

See also: drawButton().

Reimplemented from QButton.

boolQCheckBox::isChecked()const

Returns TRUE if the check box is checked, or FALSE if it is not checked.

See also: setChecked().

Examples: xform/xform.cpp

voidQCheckBox::setChecked(boolcheck)

Checks the check box if check is TRUE, or unchecks it if check is FALSE.

See also: isChecked().

Examples: tabdialog/tabdialog.cpp

voidQCheckBox::setNoChange()

Sets the checkbox into the "no change" state.

See also: setTristate().

voidQCheckBox::setTristate(booly=TRUE)

Makes the checkbox a tristate checkbox if y is TRUE. A tristate checkbox is useful when you need to give the use the option of neither setting nor unsetting an option, for example choosing Italic or non-Italic when the selected text is partially Italic and partially not.

See also: setNoChange() and stateChanged().

QSizeQCheckBox::sizeHint()const [virtual]

Returns a size which fits the contents of the check box.

Reimplemented from QWidget.

QSizePolicyQCheckBox::sizePolicy()const [virtual]

Specifies that this widget may stretch horizontally, but is fixed vertically.

Reimplemented from QWidget.


Search the documentation, FAQ, qt-interest archive and more (uses www.troll.no):


This file is part of the Qt toolkit, copyright © 1995-99 Troll Tech, all rights reserved.


Copyright 1999 Troll TechTrademarks
Qt version 2.0.2