本文整理汇总了C++中KstCPluginPtr::tagName方法的典型用法代码示例。如果您正苦于以下问题:C++ KstCPluginPtr::tagName方法的具体用法?C++ KstCPluginPtr::tagName怎么用?C++ KstCPluginPtr::tagName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KstCPluginPtr
的用法示例。
在下文中一共展示了KstCPluginPtr::tagName方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fillComboBox
void KstViewFitsDialog::fillComboBox(const QString& str) {
KstCPluginList::iterator it;
KstCPluginList fits;
QString fitName = str;
bool changed = false;
uint i;
_comboBoxFits->clear();
fits = kstObjectSubList<KstDataObject,KstCPlugin>(KST::dataObjectList);
for (it = fits.begin(); it != fits.end(); ++it) {
KstCPluginPtr fit;
fit = *it;
fit->readLock();
if (fit->plugin()->data()._isFit) {
_comboBoxFits->insertItem(0, fit->tagName());
if (fitName == fit->tagName() || fitName.isEmpty()) {
_comboBoxFits->setCurrentIndex(_comboBoxFits->count() - 1);
if (fitName.isEmpty()) {
fitName = fit->tagName();
}
changed = true;
fitChanged(fitName);
}
}
fit->unlock();
}
if (!changed) {
fitChanged(_comboBoxFits->currentText());
}
}
示例2: fillFieldsForEdit
void KstPluginDialogI::fillFieldsForEdit() {
KstCPluginPtr pp = kst_cast<KstCPlugin>(_dp);
if (!pp) {
return;
}
pp->readLock();
if (!pp->plugin()) { // plugin() can be null if the kst file is invalid
pp->unlock();
return;
}
const QString pluginName(pp->tagName());
const QString pluginObjectName(pp->plugin()->data()._name);
const int usage = pp->getUsage();
KstSharedPtr<Plugin> plug = pp->plugin();
pp->unlock();
_tagName->setText(pluginName);
updatePluginList();
int i = _pluginList.findIndex(pluginObjectName);
_w->PluginCombo->setCurrentItem(i);
pluginChanged(_w->PluginCombo->currentItem());
fillVectorScalarCombos(plug);
_w->PluginCombo->setEnabled(usage < 3);
fixupLayout();
}
示例3: editObject
bool KstPluginDialogI::editObject() {
KstCPluginPtr pp = kst_cast<KstCPlugin>(_dp);
if (!pp) { // something is dreadfully wrong - this should never happen
return false;
}
pp->writeLock();
if (_tagName->text() != pp->tagName() && KstData::self()->dataTagNameNotUnique(_tagName->text())) {
_tagName->setFocus();
pp->unlock();
return false;
}
pp->setTagName(_tagName->text());
int pitem = _w->PluginCombo->currentItem();
KstSharedPtr<Plugin> pPtr = PluginCollection::self()->plugin(_pluginList[pitem]);
// Must unlock before clear()
for (KstVectorMap::Iterator i = pp->inputVectors().begin(); i != pp->inputVectors().end(); ++i) {
(*i)->unlock();
}
for (KstScalarMap::Iterator i = pp->inputScalars().begin(); i != pp->inputScalars().end(); ++i) {
(*i)->unlock();
}
for (KstStringMap::Iterator i = pp->inputStrings().begin(); i != pp->inputStrings().end(); ++i) {
(*i)->unlock();
}
pp->inputVectors().clear();
pp->inputScalars().clear();
pp->inputStrings().clear();
// Save the vectors and scalars
if (!saveInputs(pp, pPtr)) {
KMessageBox::sorry(this, i18n("There is an error in the plugin you entered."));
pp->unlock();
return false;
}
if (pitem >= 0 && _w->PluginCombo->count() > 0) {
pp->setPlugin(pPtr);
}
if (!saveOutputs(pp, pPtr)) {
KMessageBox::sorry(this, i18n("There is an error in the plugin you entered."));
pp->unlock();
return false;
}
if (!pp->isValid()) {
KMessageBox::sorry(this, i18n("There is an error in the plugin you entered."));
pp->unlock();
return false;
}
pp->setDirty();
pp->unlock();
emit modified();
return true;
}
示例4: editObject
bool KstPluginDialogI::editObject() {
KstCPluginPtr pp = kst_cast<KstCPlugin>(_dp);
if (!pp) { // something is dreadfully wrong - this should never happen
return false;
}
KstWriteLocker pl(pp);
if (_tagName->text() != pp->tagName() && KstData::self()->dataTagNameNotUnique(_tagName->text())) {
_tagName->setFocus();
return false;
}
pp->setTagName(KstObjectTag(_tagName->text(), KstObjectTag::globalTagContext)); // FIXME: tag context always global?
int pitem = _w->PluginCombo->currentItem();
KstSharedPtr<Plugin> pPtr = PluginCollection::self()->plugin(_pluginList[pitem]);
pp->setRecursed(false);
pp->inputVectors().clear();
pp->inputScalars().clear();
pp->inputStrings().clear();
// Save the vectors and scalars
if (!saveInputs(pp, pPtr)) {
KMessageBox::sorry(this, i18n("There is an error in the inputs you entered."));
return false;
}
if (pitem >= 0 && _w->PluginCombo->count() > 0) {
pp->setPlugin(pPtr);
}
if (!saveOutputs(pp, pPtr)) {
KMessageBox::sorry(this, i18n("There is an error in the outputs you entered."));
return false;
}
if (!pp->isValid()) {
KMessageBox::sorry(this, i18n("There is an error in the plugin you entered."));
return false;
}
pp->setRecursed(false);
if (pp->recursion()) {
pp->setRecursed(true);
KMessageBox::sorry(this, i18n("There is a recursion resulting from the plugin you entered."));
return false;
}
pp->setDirty();
emit modified();
return true;
}
示例5: createCurve
bool KstFilterDialogI::createCurve(KstCPluginPtr plugin) {
KstVectorPtr xVector;
KstVectorPtr yVector;
KST::vectorList.lock().readLock();
KstVectorList::Iterator it = KST::vectorList.findTag(_xvector);
if (it != KST::vectorList.end()) {
xVector = *it;
}
KST::vectorList.lock().unlock();
if (plugin->outputVectors().contains(plugin->plugin()->data()._filterOutputVector)) {
yVector = plugin->outputVectors()[plugin->plugin()->data()._filterOutputVector];
}
if (!xVector || !yVector) {
return false;
}
plugin->setDirty();
QString c_name = KST::suggestCurveName(plugin->tagName(), true);
KstVCurvePtr fit = new KstVCurve(c_name, KstVectorPtr(xVector), KstVectorPtr(yVector), KstVectorPtr(0L), KstVectorPtr(0L), KstVectorPtr(0L), KstVectorPtr(0L), _w->_curveAppearance->color());
fit->setHasPoints(_w->_curveAppearance->showPoints());
fit->setHasLines(_w->_curveAppearance->showLines());
fit->setHasBars(_w->_curveAppearance->showBars());
fit->setLineWidth(_w->_curveAppearance->lineWidth());
fit->setLineStyle(_w->_curveAppearance->lineStyle());
fit->pointType = _w->_curveAppearance->pointType();
fit->setBarStyle(_w->_curveAppearance->barStyle());
fit->setPointDensity(_w->_curveAppearance->pointDensity());
KstViewWindow *w = dynamic_cast<KstViewWindow*>(KstApp::inst()->findWindow(_window));
if (w && w->view()->findChild(_plotName)) {
Kst2DPlotPtr plot = kst_cast<Kst2DPlot>(w->view()->findChild(_plotName));
if (plot) {
plot->addCurve(fit.data());
}
}
KST::dataObjectList.lock().writeLock();
KST::dataObjectList.append(fit.data());
KST::dataObjectList.lock().unlock();
return true;
}
示例6: saveOutputs
bool KstPluginDialogI::saveOutputs(KstCPluginPtr plugin, KstSharedPtr<Plugin> p) {
const QValueList<Plugin::Data::IOValue>& otable = p->data()._outputs;
for (QValueList<Plugin::Data::IOValue>::ConstIterator it = otable.begin(); it != otable.end(); ++it) {
QObject *field = _w->_pluginInputOutputFrame->child((*it)._name.latin1(), "QLineEdit");
if (!field) {
continue; // Some are unsupported
}
QLineEdit *li = static_cast<QLineEdit*>(field);
if (li->text().isEmpty()) {
QString tagName = _tagName->text();
if (tagName==plugin_defaultTag) {
tagName = plugin->tagName();
}
li->setText(tagName + "-" + (*it)._name);
}
QString nt = li->text();
if ((*it)._type == Plugin::Data::IOValue::TableType) {
if (!KstData::self()->vectorTagNameNotUnique(nt, false)) {
// Implicitly creates it if it doesn't exist
KstVectorPtr v = plugin->outputVectors()[(*it)._name];
if (!v) {
v = new KstVector(nt, 0, plugin.data());
v->writeLock();
plugin->outputVectors().insert((*it)._name, v);
KST::addVectorToList(v);
}
} else if (plugin->outputVectors()[(*it)._name]->tagName() != nt) {
while (KstData::self()->vectorTagNameNotUnique(nt, false)) {
nt += "'";
}
KstVectorPtr v;
if (plugin->outputVectors().contains((*it)._name)) {
v = plugin->outputVectors()[(*it)._name];
} else {
v = new KstVector(nt, 0, plugin.data());
v->writeLock();
plugin->outputVectors().insert((*it)._name, v);
KST::addVectorToList(v);
}
}
} else if ((*it)._type == Plugin::Data::IOValue::StringType) {
if (!KstData::self()->vectorTagNameNotUnique(nt, false)) {
KstStringPtr s;
if (plugin->outputStrings().contains((*it)._name)) {
s = plugin->outputStrings()[(*it)._name];
} else {
s = new KstString(nt, plugin.data());
s->writeLock();
plugin->outputStrings().insert((*it)._name, s);
}
} else if (plugin->outputStrings()[(*it)._name]->tagName() != nt) {
while (KstData::self()->vectorTagNameNotUnique(nt, false)) {
nt += "'";
}
KstStringPtr s;
if (plugin->outputStrings().contains((*it)._name)) {
s = plugin->outputStrings()[(*it)._name];
} else {
s = new KstString(nt, plugin.data());
s->writeLock();
plugin->outputStrings().insert((*it)._name, s);
}
}
} else if ((*it)._type == Plugin::Data::IOValue::PidType) {
// Nothing
} else if ((*it)._type == Plugin::Data::IOValue::FloatType) {
if (!KstData::self()->vectorTagNameNotUnique(nt, false)) {
KstScalarPtr s;
if (plugin->outputScalars().contains((*it)._name)) {
s = plugin->outputScalars()[(*it)._name];
} else {
s = new KstScalar(nt, plugin.data());
s->writeLock();
plugin->outputScalars().insert((*it)._name, s);
}
} else if (plugin->outputScalars()[(*it)._name]->tagName() != nt) {
while (KstData::self()->vectorTagNameNotUnique(nt, false)) {
nt += "'";
}
KstScalarPtr s;
if (plugin->outputScalars().contains((*it)._name)) {
s = plugin->outputScalars()[(*it)._name];
} else {
s = new KstScalar(nt, plugin.data());
s->writeLock();
plugin->outputScalars().insert((*it)._name, s);
}
}
}
}
return true;
}