Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qcheckbox.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QCHECKBOX_H
5#define QCHECKBOX_H
6
7#include <QtWidgets/qtwidgetsglobal.h>
8#include <QtWidgets/qabstractbutton.h>
9
11
13
14
17
18class Q_WIDGETS_EXPORT QCheckBox : public QAbstractButton
19{
21
22 Q_PROPERTY(bool tristate READ isTristate WRITE setTristate)
23
24public:
25 explicit QCheckBox(QWidget *parent = nullptr);
26 explicit QCheckBox(const QString &text, QWidget *parent = nullptr);
27 ~QCheckBox();
28
29 QSize sizeHint() const override;
30 QSize minimumSizeHint() const override;
31
32 void setTristate(bool y = true);
33 bool isTristate() const;
34
36 void setCheckState(Qt::CheckState state);
37
39#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
40 void stateChanged(int);
41#else
43#endif
44
45protected:
46 bool event(QEvent *e) override;
47 bool hitButton(const QPoint &pos) const override;
48 void checkStateSet() override;
49 void nextCheckState() override;
50 void paintEvent(QPaintEvent *) override;
51 void mouseMoveEvent(QMouseEvent *) override;
52 virtual void initStyleOption(QStyleOptionButton *option) const;
53
54
55private:
56 Q_DECLARE_PRIVATE(QCheckBox)
57 Q_DISABLE_COPY(QCheckBox)
58 friend class QAccessibleButton;
59};
60
62
63#endif // QCHECKBOX_H
The QAbstractButton class is the abstract base class of button widgets, providing functionality commo...
void mouseMoveEvent(QMouseEvent *e) override
\reimp
void paintEvent(QPaintEvent *e) override=0
\reimp
virtual void checkStateSet()
This virtual handler is called when setChecked() is used, unless it is called from within nextCheckSt...
virtual bool hitButton(const QPoint &pos) const
Returns true if pos is inside the clickable button rectangle; otherwise returns false.
virtual void nextCheckState()
This virtual handler is called when a button is clicked.
The QCheckBox widget provides a checkbox with a text label.
Definition qcheckbox.h:19
void stateChanged(Qt::CheckState)
\inmodule QtCore
Definition qcoreevent.h:45
\inmodule QtGui
Definition qevent.h:195
The QPaintEvent class contains event parameters for paint events.
Definition qevent.h:485
\inmodule QtCore\reentrant
Definition qpoint.h:23
\inmodule QtCore
Definition qsize.h:25
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:127
\variable QStyleOptionHeaderV2::textElideMode
The QWidget class is the base class of all user interface objects.
Definition qwidget.h:99
QSize minimumSizeHint
the recommended minimum size for the widget
Definition qwidget.h:149
QSize sizeHint
the recommended size for the widget
Definition qwidget.h:148
QString text
double e
else opt state
[0]
Combined button and popup list for selecting options.
CheckState
GLint y
struct _cl_event * event
GLuint GLenum option
#define QT_REQUIRE_CONFIG(feature)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_SIGNALS
QCheckBox * checkbox
[0]
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent