void PlotWizard::accept() { QStringList curves, curves3D, ribbons; for (int i=0; i < plotAssociations->count(); i++) { QString text = plotAssociations->item(i)->text(); if (text.endsWith("(X)")) { QMessageBox::critical(this, tr("MantidPlot - Error"), tr("Please define a Y column for the following curve") + ":\n\n" + text); return; } if ( text.contains("(Z)") ) { if ( text.contains("(Y)") && !curves3D.contains(text) ) curves3D << text; else if ( !text.contains("(Y)") && !ribbons.contains(text) ) ribbons << text; } else if ( text.contains("(xErr)") || text.contains("(yErr)")) { QStringList lst = text.split(",", QString::SkipEmptyParts); lst.pop_back(); QString master_curve = lst.join(","); if (!curves.contains(master_curve)) curves.prepend(master_curve); if (!curves.contains(text)) curves << text; //add error bars at the end of the list. } else if (!curves.contains(text)) curves.prepend(text); } if (curves.count()>0) emit plot(curves); if (curves3D.count()>0) plot3D(curves3D); if (ribbons.count()>0) plot3DRibbon(ribbons); if(!noCurves()) close(); }
void plotWizard::accept() { QStringList curves, curves3D, ribbons; bool multiple=FALSE; int i=0; for (i=0;i<(int)plotAssociations->count ();i++) { QString text=plotAssociations->text (i); if (text.contains("(Z)", TRUE)>0 ) { if (text.contains("(Y)", TRUE)>0 && curves3D.contains(text) == 0) curves3D<<text; else if ( text.contains("(Y)", TRUE) ==0 && ribbons.contains(text) == 0) ribbons<<text; } else { if (curves.contains(text)>0) multiple=TRUE; else curves<<text; } } if (multiple) QMessageBox::warning(this,tr("QtiPlot - Warning"), tr("Redefinitions of the same curve are ignored!")); if ((int)curves.count ()>0) emit plot(curves); for (i=0;i<(int)curves3D.count ();i++) emit plot3D(curves3D[i]); for (i=0;i<(int)ribbons.count ();i++) emit plot3DRibbon(ribbons[i]); if (!noCurves()) close(); }