You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
AppFlow/CFDStruct/CUIProperty/CUICheckBox.cpp

27 lines
654 B
C++

#include "CUICheckBox.h"
#include<CUIConfig.h>
#include<CUI.h>
CUICheckBox::CUICheckBox(CUIConfig* conf, QVector<CUI*> &subCUI, QWidget *parent) : QCheckBox(parent)
{
this->conf = conf;
iniUI(subCUI);
}
void CUICheckBox::iniUI(QVector<CUI*> &subCUI)
{
this->setText(conf->getPropertyValue("name"));
QVariant vOrigin = conf->getPropertyOriginValue("value_origin");
int *ptr = qvariant_cast<int*>(vOrigin);
if(ptr!=nullptr){
if(*ptr == 1)
this->setCheckState(Qt::Checked);
}
connect(this, QOverload<bool>::of(&QCheckBox::clicked),[ = ](bool sign){
this->conf->setValue((int)sign);
});
}