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