#include #include #include #include #include "enum.bactypes.h" #include "Bool.h" Bool::Bool(QWidget *parent, int db_id, int PropId, QString label, QGridLayout *layout, int row, int col) : Field(parent, db_id, PropId, BT_CHR_STR, label) { if(label != QString()) { this->checkBox = new QCheckBox(label); this->input = this->checkBox; connect(this->input, SIGNAL(stateChanged(int)), this, SLOT(valueChanged(int))); } else this->input = NULL; this->value = QVariant(); if(layout) { layout->addWidget(this->input, row, col, 1, 2, Qt::AlignHCenter); } } Bool::Bool(QWidget *parent, int db_id, int PropId, int value, QString label, QGridLayout *layout, int row, int col) : Field(parent, db_id, PropId, BT_CHR_STR, label) { if(label != QString()) { this->checkBox = new QCheckBox(label); this->checkBox->setCheckState(value ? Qt::Checked : Qt::Unchecked); this->input = this->checkBox; connect(this->input, SIGNAL(stateChanged(int)), this, SLOT(valueChanged(int))); } else this->input = NULL; this->value = value; if(layout) { layout->addWidget(this->input, row, col, 1, 2, Qt::AlignHCenter); } } void Bool::SetValue(QVariant value) { this->value = value; this->checkBox->setCheckState(value.toInt() ? Qt::Checked : Qt::Unchecked); }