#include #include #include #include #include #include "Enum.h" #include "enum.bactypes.h" Enum::Enum(QWidget *parent, int db_id, int PropId, QString label, QGridLayout *layout, int row, int col) : Field(parent, db_id, PropId, BT_ENUM, label) { this->value = QVariant(); if(label != QString()) { this->comboBox = new QComboBox(parent); connect(this->comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(valueChanged(int))); this->input = this->comboBox; } else this->input = NULL; if(layout) { layout->addWidget(this->label, row, col, Qt::AlignRight); layout->addWidget(this->input, row, col + 1, Qt::AlignLeft); } } void Enum::SetValue(QVariant value) { this->value = value; this->comboBox->setCurrentIndex(value.toInt()); }