#include #include #include #include #include "enum.bactypes.h" #include "DateTime.h" DateTime::DateTime(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->dtEdit = new QDateTimeEdit(parent); this->input = this->dtEdit; connect(this->input, SIGNAL(dateTimeChanged(const QDateTime &)), this, SLOT(valueChanged(const QDateTime &))); } else this->input = NULL; if(layout) { layout->addWidget(this->label, row, col, Qt::AlignRight); layout->addWidget(this->input, row, col + 1, Qt::AlignLeft); } this->value = QVariant(); } DateTime::DateTime(QWidget *parent, int db_id, int PropId, QDateTime value, QString label, QGridLayout *layout, int row, int col) : Field(parent, db_id, PropId, BT_CHR_STR, label) { if(label != QString()) { this->dtEdit = new QDateTimeEdit(value, parent); this->input = this->dtEdit; connect(this->input, SIGNAL(dateTimeChanged(const QDateTime &)), this, SLOT(valueChanged(const QDateTime &))); } else this->input = NULL; if(layout) { layout->addWidget(this->label, row, col, Qt::AlignRight); layout->addWidget(this->input, row, col + 1, Qt::AlignLeft); } this->value = value; } void DateTime::SetValue(QVariant value) { this->value = value; this->dtEdit->setDateTime(value.toDateTime()); }