Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-06-30 08:21:44

0001 // Copyright (C) 2016 The Qt Company Ltd.
0002 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
0003 // Qt-Security score:significant reason:default
0004 
0005 #ifndef QCHECKBOX_H
0006 #define QCHECKBOX_H
0007 
0008 #include <QtWidgets/qtwidgetsglobal.h>
0009 #include <QtWidgets/qabstractbutton.h>
0010 
0011 QT_REQUIRE_CONFIG(checkbox);
0012 
0013 QT_BEGIN_NAMESPACE
0014 
0015 
0016 class QCheckBoxPrivate;
0017 class QStyleOptionButton;
0018 
0019 class Q_WIDGETS_EXPORT QCheckBox : public QAbstractButton
0020 {
0021     Q_OBJECT
0022 
0023     Q_PROPERTY(bool tristate READ isTristate WRITE setTristate)
0024 
0025 public:
0026     explicit QCheckBox(QWidget *parent = nullptr);
0027     explicit QCheckBox(const QString &text, QWidget *parent = nullptr);
0028     ~QCheckBox();
0029 
0030     QSize sizeHint() const override;
0031     QSize minimumSizeHint() const override;
0032 
0033     void setTristate(bool y = true);
0034     bool isTristate() const;
0035 
0036     Qt::CheckState checkState() const;
0037     void setCheckState(Qt::CheckState state);
0038 
0039 Q_SIGNALS:
0040 #if QT_DEPRECATED_SINCE(6, 9)
0041     QT_MOC_COMPAT QT_DEPRECATED_VERSION_X_6_9("Use checkStateChanged() instead")
0042     void stateChanged(int);
0043 #endif
0044     void checkStateChanged(Qt::CheckState);
0045 
0046 protected:
0047     bool event(QEvent *e) override;
0048     bool hitButton(const QPoint &pos) const override;
0049     void checkStateSet() override;
0050     void nextCheckState() override;
0051     void paintEvent(QPaintEvent *) override;
0052     void mouseMoveEvent(QMouseEvent *) override;
0053     virtual void initStyleOption(QStyleOptionButton *option) const;
0054 
0055 
0056 private:
0057     Q_DECLARE_PRIVATE(QCheckBox)
0058     Q_DISABLE_COPY(QCheckBox)
0059     friend class QAccessibleButton;
0060 };
0061 
0062 QT_END_NAMESPACE
0063 
0064 #endif // QCHECKBOX_H