void KstBasicDialogI::createInputString(const QString &name, int row) { QLabel *label = new QLabel(name + ":", _w->_frame); StringSelector *widget = new StringSelector(_w->_frame, name.latin1()); connect(widget, SIGNAL(newStringCreated()), this, SIGNAL(modified())); _grid->addWidget(label, row, 0); label->show(); _grid->addWidget(widget, row, 1); widget->show(); }
void KstPluginDialogI::generateEntries(bool input, int& cnt, QWidget *parent, QGridLayout *grid, const QValueList<Plugin::Data::IOValue>& table) { QString scalarLabelTemplate, vectorLabelTemplate, stringLabelTemplate; if (input) { stringLabelTemplate = i18n("Input string - %1:"); scalarLabelTemplate = i18n("Input scalar - %1:"); vectorLabelTemplate = i18n("Input vector - %1:"); } else { stringLabelTemplate = i18n("Output string - %1:"); scalarLabelTemplate = i18n("Output scalar - %1:"); vectorLabelTemplate = i18n("Output vector - %1:"); } for (QValueList<Plugin::Data::IOValue>::ConstIterator it = table.begin(); it != table.end(); ++it) { QString labellabel; bool scalar = false; bool string = false; switch ((*it)._type) { case Plugin::Data::IOValue::PidType: continue; case Plugin::Data::IOValue::StringType: labellabel = stringLabelTemplate.arg((*it)._name); string = true; break; case Plugin::Data::IOValue::FloatType: labellabel = scalarLabelTemplate.arg((*it)._name); scalar = true; break; case Plugin::Data::IOValue::TableType: if ((*it)._subType == Plugin::Data::IOValue::FloatSubType || (*it)._subType == Plugin::Data::IOValue::FloatNonVectorSubType) { labellabel = vectorLabelTemplate.arg((*it)._name); } else { // unsupported continue; } break; default: // unsupported continue; } QLabel *label = new QLabel(labellabel, parent, input ? "Input label" : "Output label"); QWidget *widget = 0L; if (input) { if (scalar) { ScalarSelector *w = new ScalarSelector(parent, (*it)._name.latin1()); widget = w; connect(w->_scalar, SIGNAL(activated(const QString&)), this, SLOT(updateScalarTooltip(const QString&))); connect(widget, SIGNAL(newScalarCreated()), this, SIGNAL(modified())); if (!(*it)._default.isEmpty()) { w->_scalar->insertItem((*it)._default); w->_scalar->setCurrentText((*it)._default); } KstScalarPtr p = *KST::scalarList.findTag(w->_scalar->currentText()); w->allowDirectEntry(true); if (p) { p->readLock(); QToolTip::remove(w->_scalar); QToolTip::add(w->_scalar, QString::number(p->value())); p->unlock(); } } else if (string) { StringSelector *w = new StringSelector(parent, (*it)._name.latin1()); widget = w; connect(w->_string, SIGNAL(activated(const QString&)), this, SLOT(updateStringTooltip(const QString&))); connect(widget, SIGNAL(newStringCreated()), this, SIGNAL(modified())); if (!(*it)._default.isEmpty()) { w->_string->insertItem((*it)._default); w->_string->setCurrentText((*it)._default); } KstStringPtr p = *KST::stringList.findTag(w->_string->currentText()); w->allowDirectEntry(true); if (p) { p->readLock(); QToolTip::remove(w->_string); QToolTip::add(w->_string, p->value()); p->unlock(); } } else { widget = new VectorSelector(parent, (*it)._name.latin1()); connect(widget, SIGNAL(newVectorCreated(const QString&)), this, SIGNAL(modified())); } } else {