/* Creates a property item 'val' in a parameter category specified by its 'box'. */ void QucsTranscalc::createPropItem (QGridLayout * parentGrid, TransValue * val, int box, QButtonGroup * group) { Q_UNUSED(group); QRadioButton * r = NULL; QLabel * l; QLineEdit * e; QComboBox * c; QDoubleValidator * v = new QDoubleValidator (this); // name label l = new QLabel (val->name); parentGrid->addWidget(l, parentGrid->rowCount(), 0); l->setAlignment (Qt::AlignRight); if (val->tip) l->setToolTip(*(val->tip)); val->label = l; // editable value text e = new QLineEdit (); parentGrid->addWidget(e, parentGrid->rowCount()-1, 1); e->setText (QString::number (val->value)); e->setAlignment (Qt::AlignRight); e->setValidator (v); connect(e, SIGNAL(textChanged(const QString&)), SLOT(slotValueChanged())); if (!val->name) e->setDisabled (true); val->lineedit = e; // unit choice c = new QComboBox (); parentGrid->addWidget(c, parentGrid->rowCount()-1, 2); if (!val->units[0]) { c->addItem ("NA"); c->setDisabled(true); } else { int nounit = 0; for (int i = 0; val->units[i]; i++) { c->addItem (val->units[i]); if (!strcmp (val->units[i], "NA")) nounit++; } c->setDisabled (nounit != 0); c->setCurrentIndex (0); } connect(c, SIGNAL(activated(int)), SLOT(slotValueChanged())); val->combobox = c; // special synthesize-computation choice if (box == TRANS_PHYSICAL) { r = new QRadioButton (); r->setDisabled (true); r->setHidden(true); val->radio = r; parentGrid->addWidget(r, parentGrid->rowCount()-1, 3); } }