QCheckBox

 

#include <QCheckBox>

 

Properties

Public Functions

  QCheckBox(QWidget *parent = nullptr)
  QCheckBox(const QString &text, QWidget *parent = nullptr)
virtual ~QCheckBox()
Qt::CheckState checkState() const
bool isTristate() const
void setCheckState(Qt::CheckState state)
void setTristate(bool y = true)

Reimplemented Public Functions

virtual QSize minimumSizeHint() const override
virtual QSize sizeHint() const override

Signals

void stateChanged(int state)

Protected Functions

void initStyleOption(QStyleOptionButton *option) const

Reimplemented Protected Functions

virtual void checkStateSet() override
virtual bool event(QEvent *e) override
virtual bool hitButton(const QPoint &pos) const override
virtual void mouseMoveEvent(QMouseEvent *e) override
virtual void nextCheckState() override
virtual void paintEvent(QPaintEvent *) override

Additional Inherited Members

  • 5 public slots inherited from QAbstractButton
  • 19 public slots inherited from QWidget
  • 1 public slot inherited from QObject
  • 1 public variable inherited from QObject
  • 5 static public members inherited from QWidget
  • 10 static public members inherited from QObject
  • 1 protected slot inherited from QWidget
  • 2 protected variables inherited from QObject
  • 1 protected type inherited from QPaintDevice

Detailed Description

The QCheckBox widget provides a checkbox with a text label.

 

 

使用案例

 

绑定槽函数:

connect(this->dCheckBox, SIGNAL(stateChanged(int)), this, SLOT(slotDCheckBoxChangeState(int)));

 

void slotDCheckBoxChangeState(int stateParam)
{
    
    if (stateParam==2)
    {
        //选中
    }
    
    if(stateParam ==0)
    {
        //取消选中
    }
}

 

 

 

####################

posted @ 2022-06-16 19:41  西北逍遥  阅读(165)  评论(0编辑  收藏  举报