本文整理汇总了C++中KstVCurvePtr::setLegendText方法的典型用法代码示例。如果您正苦于以下问题:C++ KstVCurvePtr::setLegendText方法的具体用法?C++ KstVCurvePtr::setLegendText怎么用?C++ KstVCurvePtr::setLegendText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KstVCurvePtr
的用法示例。
在下文中一共展示了KstVCurvePtr::setLegendText方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: newObject
bool KstEqDialogI::newObject() {
QString tag_name = _tagName->text();
QString etext = _w->_equation->text();
etext.remove(QRegExp("[^a-zA-Z0-9\\(\\)\\+\\-\\*/\\%\\^\\|\\&\\!<>=_.]"));
if (etext.length() > 12) {
etext.truncate(12);
etext += "...";
}
if (tag_name == defaultTag) {
tag_name = KST::suggestEQName(etext);
}
/* verify that the curve name is unique */
if (KstData::self()->dataTagNameNotUnique(tag_name)) {
_tagName->setFocus();
return false;
}
if (!checkEntries()) {
return false;
}
KST::vectorList.lock().readLock();
/* find *V */
KstVectorPtr vp = *KST::vectorList.findTag(_w->_xVectors->selectedVector());
if (!vp) {
kstdFatal() << "Bug in kst: the Vector field in plotDialog (Eq) "
<< "refers to a non-existent vector..." << endl;
}
KST::vectorList.lock().unlock();
/** Create the equation here */
vp->readLock();
KstEquationPtr eq = new KstEquation(tag_name, _w->_equation->text(), vp, _w->_doInterpolation->isChecked());
vp->unlock();
if (!eq->isValid()) {
eq = 0L;
QString parseErrors;
for (QStringList::ConstIterator i = Equation::errorStack.begin(); i != Equation::errorStack.end(); ++i) {
parseErrors += *i;
parseErrors += "\n";
}
KMessageBox::detailedSorry(this, i18n("There is an error in the equation you entered."), parseErrors);
return false;
}
KstVCurvePtr vc = new KstVCurve(KST::suggestCurveName(tag_name, true), eq->vX(), eq->vY(), 0L, 0L, 0L, 0L, _w->_curveAppearance->color());
vc->setHasPoints(_w->_curveAppearance->showPoints());
vc->setHasLines(_w->_curveAppearance->showLines());
vc->setHasBars(_w->_curveAppearance->showBars());
vc->setLineWidth(_w->_curveAppearance->lineWidth());
vc->setLineStyle(_w->_curveAppearance->lineStyle());
vc->pointType = _w->_curveAppearance->pointType();
vc->setPointDensity(_w->_curveAppearance->pointDensity());
vc->setBarStyle(_w->_curveAppearance->barStyle());
QString legend_text = _legendText->text();
if (legend_text == defaultTag) {
vc->setLegendText(QString(""));
} else {
vc->setLegendText(legend_text);
}
KstViewWindow *w = dynamic_cast<KstViewWindow*>(KstApp::inst()->findWindow(_w->_curvePlacement->_plotWindow->currentText()));
if (!w) {
QString n = KstApp::inst()->newWindow(KST::suggestWinName());
w = dynamic_cast<KstViewWindow*>(KstApp::inst()->findWindow(n));
}
if (w) {
Kst2DPlotPtr plot;
if (_w->_curvePlacement->existingPlot()) {
/* assign curve to plot */
plot = kst_cast<Kst2DPlot>(w->view()->findChild(_w->_curvePlacement->plotName()));
if (plot) {
plot->addCurve(vc.data());
}
}
if (_w->_curvePlacement->newPlot()) {
/* assign curve to plot */
QString name = w->createObject<Kst2DPlot>(KST::suggestPlotName());
if (_w->_curvePlacement->reGrid()) {
w->view()->cleanup(_w->_curvePlacement->columns());
}
plot = kst_cast<Kst2DPlot>(w->view()->findChild(name));
if (plot) {
_w->_curvePlacement->update();
_w->_curvePlacement->setCurrentPlot(plot->tagName());
plot->addCurve(vc.data());
plot->generateDefaultLabels();
}
}
}
KST::dataObjectList.lock().writeLock();
KST::dataObjectList.append(eq.data());
//.........这里部分代码省略.........