6.0.0-rc4Source

QCheckBox Class

The QCheckBox class provides a checkbox with a text label. More…

Header#include <QCheckBox>
CMaketarget_link_libraries(app PRIVATE Nt::Widgets)
ModuleNt Widgets C++ Classes
InheritsQAbstractButton

List of all members, including inherited members

Public Functions

QCheckBox(QWidget *parent = nullptr)
QCheckBox(const QString &text, QWidget *parent = nullptr)
~QCheckBox()

Reimplemented Public Functions

QSizesizeHint() const

Reimplemented Protected Functions

voidpaintEvent(QPaintEvent *event)
boolhitButton(const QPoint &pos) const

Detailed Description

A check box is a checkable button that shows its state in an indicator next to the text. Connect to toggled():

QCheckBox *box = new QCheckBox("Remember me", window);
box->setChecked(true);

Check boxes: unchecked, checked, with the keyboard focus, and disabled.

QCheckBox in the light color scheme

See also QAbstractButton and QPushButton.

Differences from Qt

There are no tristate check boxes and no stateChanged() signal or checkState(); use toggled() and isChecked().

Member Function Documentation

[explicit] QCheckBox::QCheckBox(QWidget *parent = nullptr)

Constructs a check box with no text and the given parent.

[explicit] QCheckBox::QCheckBox(const QString &text, QWidget *parent = nullptr)

Constructs a check box that shows text, with the given parent.

[override] QCheckBox::~QCheckBox()

Destroys the check box.

[override, protected] bool QCheckBox::hitButton(const QPoint &pos) const

Reimplements QAbstractButton::hitButton().

[override, protected] void QCheckBox::paintEvent(QPaintEvent *event)

Reimplements QAbstractButton::paintEvent().

[override] QSize QCheckBox::sizeHint() const

Reimplements QAbstractButton::sizeHint().