void FFT::fftTable() { double *amp = (double *)malloc(d_n*sizeof(double)); gsl_fft_complex_wavetable *wavetable = gsl_fft_complex_wavetable_alloc (d_n); gsl_fft_complex_workspace *workspace = gsl_fft_complex_workspace_alloc (d_n); if(!amp || !wavetable || !workspace){ memoryErrorMessage(); return; } double df = 1.0/(double)(d_n*d_sampling);//frequency sampling double aMax = 0.0;//max amplitude if(d_inverse) gsl_fft_complex_inverse (d_y, 1, d_n, wavetable, workspace); else gsl_fft_complex_forward (d_y, 1, d_n, wavetable, workspace); gsl_fft_complex_wavetable_free (wavetable); gsl_fft_complex_workspace_free (workspace); if (d_shift_order) { int n2 = d_n/2; for(int i = 0; i < d_n; i++) { d_x[i] = (i - n2)*df; int j = i + d_n; double aux = d_y[i]; d_y[i] = d_y[j]; d_y[j] = aux; } } else { for(int i = 0; i < d_n; i++) d_x[i] = i*df; } for(int i = 0; i < d_n; i++) { int i2 = 2*i; double a = sqrt(d_y[i2]*d_y[i2] + d_y[i2+1]*d_y[i2+1]); amp[i]= a; if (a > aMax) aMax = a; } ApplicationWindow *app = (ApplicationWindow *)parent(); QLocale locale = app->locale(); int prec = app->d_decimal_digits; for (int i = 0; i < d_n; i++) { int i2 = 2*i; d_result_table->setText(i, 0, locale.toString(d_x[i], 'g', prec)); d_result_table->setText(i, 1, locale.toString(d_y[i2], 'g', prec)); d_result_table->setText(i, 2, locale.toString(d_y[i2 + 1], 'g', prec)); if (d_normalize) d_result_table->setText(i, 3, locale.toString(amp[i]/aMax, 'g', prec)); else d_result_table->setText(i, 3, locale.toString(amp[i], 'g', prec)); d_result_table->setText(i, 4, locale.toString(atan(d_y[i2 + 1]/d_y[i2]), 'g', prec)); } free(amp); }
int main( int argc, char ** argv ) { QApplication a( argc, argv ); ApplicationWindow *mw = new ApplicationWindow(); mw->setCaption( "Qt Example - Application" ); mw->show(); a.connect( &a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()) ); return a.exec(); }
int main( int argc, char ** argv ) { QApplication window( argc, argv ); ApplicationWindow *mw = new ApplicationWindow(); mw->show(); window.connect( &window, SIGNAL(lastWindowClosed()), &window, SLOT(quit()) ); return window.exec(); }
void ScriptingLangDialog::accept() { ApplicationWindow *app = (ApplicationWindow*) parent(); if (app->setScriptingLang(langList->currentText())) close(); else QMessageBox::critical(this, tr("QtiPlot - Scripting Error"), tr("Scripting language \"%1\" failed to initialize.").arg(langList->currentText())); }
void Plot3DDialog::initAxesPage() { axesList2 = new QListWidget(); axesList2->addItem(tr( "X" ) ); axesList2->addItem(tr( "Y" ) ); axesList2->addItem(tr( "Z" ) ); axesList2->setFixedWidth(50); axesList2->setCurrentRow(0); QGridLayout *gl1 = new QGridLayout(); gl1->addWidget(new QLabel(tr("Title")), 0, 0); boxLabel = new QTextEdit(); boxLabel->setMaximumHeight(60); gl1->addWidget(boxLabel, 0, 1); gl1->addWidget(new QLabel(tr("Axis Font")), 1, 0); QHBoxLayout* hb1 = new QHBoxLayout(); btnLabelFont = new QPushButton(tr( "&Font" )); btnLabelFont->setIcon(QIcon(":/font.png")); hb1->addWidget(btnLabelFont); axisTitleFormatButtons = new TextFormatButtons(boxLabel); hb1->addWidget(axisTitleFormatButtons); hb1->addStretch(); gl1->addLayout(hb1, 1, 1); ApplicationWindow *app = (ApplicationWindow *)parent(); gl1->addWidget(new QLabel(tr("Major Ticks Length")), 2, 0); boxMajorLength = new DoubleSpinBox(); boxMajorLength->setLocale(app->locale()); boxMajorLength->setDecimals(app->d_decimal_digits); boxMajorLength->setMinimum(0.0); gl1->addWidget(boxMajorLength, 2, 1); gl1->addWidget(new QLabel(tr("Minor Ticks Length")), 3, 0); boxMinorLength = new DoubleSpinBox(); boxMinorLength->setLocale(app->locale()); boxMinorLength->setDecimals(app->d_decimal_digits); boxMinorLength->setMinimum(0.0); gl1->addWidget(boxMinorLength, 3, 1); gl1->setRowStretch(4, 1); QGroupBox *gb1 = new QGroupBox(); gb1->setLayout(gl1); QHBoxLayout* hb2 = new QHBoxLayout(); hb2->addWidget(axesList2); hb2->addWidget(gb1); axes = new QWidget(); axes->setLayout(hb2); generalDialog->insertTab(axes, tr( "&Axis" ) ); connect( btnLabelFont, SIGNAL(clicked()), this, SLOT(pickAxisLabelFont())); }
void LineDialog::setDefaultValues() { ApplicationWindow *app = (ApplicationWindow *)this->parent(); if (!app) return; app->setArrowDefaultSettings(widthBox->value(), colorBox->color(), styleBox->style(), boxHeadLength->value(), boxHeadAngle->value(), filledBox->isChecked()); }
void Differentiation::output() { double *result = new double[d_n - 1]; for (int i = 1; i < d_n - 1; i++){ double xl = d_x[i - 1]; double xc = d_x[i]; double xr = d_x[i + 1]; if (xr != xc && xl != xc) result[i] = 0.5*((d_y[i + 1] - d_y[i])/(xr - xc) + (d_y[i] - d_y[i - 1])/(xc - xl)); else if (xr != xc) result[i] = (d_y[i + 1] - d_y[i])/(xr - xc); else if (xl != xc) result[i] = (d_y[i] - d_y[i - 1])/(xc - xl); else result[i] = result[i - 1]; } ApplicationWindow *app = (ApplicationWindow *)parent(); QLocale locale = app->locale(); QString tableName = app->generateUniqueName(QString(objectName())); QString dataSet; if (d_curve) dataSet = d_curve->title().text(); else dataSet = d_y_col_name; int prec = app->d_decimal_digits; int rows = d_n - 2; int col = 1; if (!d_result_table || d_result_table->numRows() < rows){ d_result_table = app->newHiddenTable(tableName, tr("Derivative") + " " + tr("of", "Derivative of") + " " + dataSet, rows, 2); for (int i = 1; i < d_n-1; i++) { int aux = i - 1; d_result_table->setText(aux, 0, locale.toString(d_x[i], 'g', prec)); d_result_table->setText(aux, 1, locale.toString(result[i], 'g', prec)); } } else { col = d_result_table->numCols(); d_result_table->addCol(); for (int i = 1; i < d_n-1; i++) d_result_table->setText(i - 1, col, locale.toString(result[i], 'g', prec)); } delete[] result; if (d_graphics_display){ if (!d_output_graph){ createOutputGraph(); d_output_graph->removeLegend(); } d_output_graph->insertCurve(d_result_table, d_result_table->colLabel(col), 0); if (d_update_output_graph) d_output_graph->updatePlot(); } }
void TextDialog::setDefaultValues() { ApplicationWindow *app = (ApplicationWindow *)this->parent(); if (!app) return; app->setLegendDefaultSettings(backgroundBox->currentItem(), f, colorBox->color(), backgroundBtn->color()); }
void CurvesDialog::showFunctionDialog() { ApplicationWindow *app = (ApplicationWindow *)this->parent(); int currentRow = contents->currentRow(); close(); if (app) app->showFunctionDialog(d_graph, currentRow); }
void ImportASCIIDialog::initPreview(int previewMode) { if (previewMode < NewTables || previewMode > Overwrite) return; ApplicationWindow *app = (ApplicationWindow *)parent(); if (!app) return; if (d_preview_table){ delete d_preview_table; d_preview_table = NULL; } if (d_preview_matrix){ delete d_preview_matrix; d_preview_matrix = NULL; } switch(previewMode){ case NewTables: d_preview_table = new PreviewTable(30, 2, this); d_preview_table->setNumericPrecision(app->d_decimal_digits); d_preview_stack->addWidget(d_preview_table); connect(d_preview_table, SIGNAL(modifiedColumnType()), this, SLOT(preview())); enableTableOptions(true); break; case NewMatrices: d_preview_matrix = new PreviewMatrix(app); d_preview_stack->addWidget(d_preview_matrix); enableTableOptions(false); break; case NewColumns: case NewRows: case Overwrite: MdiSubWindow *w = app->activeWindow(); if (!w) return; if (w->inherits("Table")){ d_preview_table = new PreviewTable(30, ((Table*)w)->numCols(), this); d_preview_table->setNumericPrecision(app->d_decimal_digits); d_preview_stack->addWidget(d_preview_table); connect(d_preview_table, SIGNAL(modifiedColumnType()), this, SLOT(preview())); enableTableOptions(true); } else if (w->isA("Matrix")){ d_preview_matrix = new PreviewMatrix(app, (Matrix *)w); d_preview_stack->addWidget(d_preview_matrix); enableTableOptions(false); } break; } preview(); }
int main( int argc, char ** argv ) { QApplication a( argc, argv ); ApplicationWindow * mw = new ApplicationWindow(); a.setMainWidget(mw); mw->setCaption( "Qt Example - Multiple Documents Interface (MDI)" ); mw->show(); a.connect( &a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()) ); int res = a.exec(); return res; }
MultiLayer * Filter::createOutputGraph() { ApplicationWindow *app = dynamic_cast<ApplicationWindow *>(this->parent()); if (!app) { throw std::logic_error("Parent of Filter is not ApplicationWindow as expected."); } MultiLayer *ml = app->newGraph(objectName() + tr("Plot")); d_output_graph = ml->activeGraph(); return ml; }
void LineDialog::setDefaultValues() { ApplicationWindow *app = dynamic_cast<ApplicationWindow *>(this->parent()); if (!app) return; app->setArrowDefaultSettings(widthBox->value(), colorBox->color(), Graph::getPenStyle(styleBox->currentItem()), boxHeadLength->value(), boxHeadAngle->value(), filledBox->isChecked()); }
void OptionsFileLocations::applyChanges(CustomTreeWidget* pTree) { VERIFYNR(pTree != NULL); Service<ConfigurationSettings> pSettings; QTreeWidgetItemIterator iter(pTree); while (*iter != NULL) { QTreeWidgetItem* pItem = *iter; if (pItem != NULL) { string type = pItem->text(0).toStdString(); string confSettingsKey; string confSettingsArgumentKey; for (vector<FileLocationDescriptor>::iterator iter2 = mFileLocations.begin(); iter2 != mFileLocations.end(); ++iter2) { if (iter2->getText() == type) { confSettingsKey = iter2->getKey(); confSettingsArgumentKey = iter2->getArgumentKey(); break; } } if (!confSettingsKey.empty()) { QString strLocation = pItem->text(1); strLocation.replace(QRegExp("\\\\"), "/"); FactoryResource<Filename> pFilename; string location = strLocation.toStdString(); pFilename->setFullPathAndName(location); pSettings->setSetting(confSettingsKey, *(pFilename.get())); if (type == "Message Log Path") { MessageLogMgrImp::instance()->setPath(location); } else if (type == "Wizard Path") { Service<DesktopServices> pDesktop; ApplicationWindow* pAppWindow = static_cast<ApplicationWindow*>(pDesktop->getMainWidget()); if ((location != mWizardPath) && (pAppWindow != NULL)) { pAppWindow->updateWizardCommands(); } } } if (!confSettingsArgumentKey.empty()) { pSettings->setSetting(confSettingsArgumentKey, pItem->text(2).toStdString()); } } ++iter; } }
void SurfaceDialog::clearList() { ApplicationWindow *app = static_cast<ApplicationWindow *>(this->parent()); if (app && boxType->currentIndex()) { app->d_param_surface_func.clear(); } else { boxFunction->clear(); if (app) app->clearSurfaceFunctionsList(); } }
void DataSetDialog::accept() { if (d_operation == ApplicationWindow::NoAnalysis) emit options(boxName->currentText()); else if (d_graph){ ApplicationWindow *app = (ApplicationWindow *)this->parent(); if (app) app->analyzeCurve(d_graph, d_operation, boxName->currentText()); } close(); }
void CurvesDialog::showPlotAssociations() { int curve = contents->currentRow(); if (curve < 0) curve = 0; ApplicationWindow *app = (ApplicationWindow *)this->parent(); close(); if (app) app->showPlotAssociations(curve); }
void FitDialog::applyChanges() { ApplicationWindow *app = (ApplicationWindow *)this->parent(); app->fit_output_precision = boxPrecision->value(); app->pasteFitResultsToPlot = plotLabelBox->isChecked(); app->writeFitResultsToLog = logBox->isChecked(); app->fitPoints = generatePointsBox->value(); app->generateUniformFitPoints = generatePointsBtn->isChecked(); app->fit_scale_errors = scaleErrorsBox->isChecked(); app->saveSettings(); btnApply->setEnabled(false); }
void Correlation::addResultCurve() { ApplicationWindow *app = dynamic_cast<ApplicationWindow *>(parent()); if (!app) return; QLocale locale = app->locale(); if (d_n > d_table->numRows()) d_table->setNumRows(d_n); int cols = d_table->numCols(); int cols2 = cols+1; d_table->addCol(); d_table->addCol(); int n = d_n/2; QVarLengthArray<double> x_temp(d_n), y_temp(d_n);//double x_temp[d_n], y_temp[d_n]; for (int i = 0; i<d_n; i++){ double x = i - n; x_temp[i] = x; double y; if(i < n) y = d_x[n + i]; else y = d_x[i - n]; y_temp[i] = y; d_table->setText(i, cols, QString::number(x)); d_table->setText(i, cols2, locale.toString(y, 'g', app->d_decimal_digits)); } QStringList l = d_table->colNames().grep(tr("Lag")); QString id = QString::number((int)l.size()+1); QString label = objectName() + id; d_table->setColName(cols, tr("Lag") + id); d_table->setColName(cols2, label); d_table->setColPlotDesignation(cols, Table::X); d_table->setHeaderColType(); if (d_graphics_display){ if (!d_output_graph) d_output_graph = createOutputGraph()->activeGraph(); DataCurve *c = new DataCurve(d_table, d_table->colName(cols), d_table->colName(cols2)); c->setData(x_temp.data(), y_temp.data(), d_n);//c->setData(x_temp, y_temp, d_n); c->setPen(QPen(ColorBox::color(d_curveColorIndex), 1)); d_output_graph->insertPlotItem(c, Graph::Line); d_output_graph->updatePlot(); } }
void CurvesDialog::showCurveRangeDialog() { int curve = contents->currentRow(); if (curve < 0) curve = 0; ApplicationWindow *app = (ApplicationWindow *)this->parent(); if (app) { app->showCurveRangeDialog(d_graph, curve); updateCurveRange(); } }
void ExportDialog::updateOptions(const QString & name) { ApplicationWindow *app = (ApplicationWindow *)this->parent(); if (!app) return; MdiSubWindow* w = app->window(name); if (!w) return; boxComments->setEnabled(w->inherits("Table")); boxNames->setEnabled(w->inherits("Table")); }
void FindDialog::accept() { ApplicationWindow *app = (ApplicationWindow *)this->parent(); app->find(boxFind->currentText(), boxWindowNames->isChecked(), boxWindowLabels->isChecked(), boxFolderNames->isChecked(), boxCaseSensitive->isChecked(), boxPartialMatch->isChecked(), boxSubfolders->isChecked()); // add the combo box's current text to the list when the find button is pressed QString text = boxFind->currentText(); if(!text.isEmpty() && boxFind->findText(text) == -1){ // no duplicates boxFind->insertItem(0, text); boxFind->setCurrentIndex(0); } }
void Convolution::addResultCurve() { ApplicationWindow *app = (ApplicationWindow *)parent(); if (!app) return; int cols = d_table->numCols(); int cols2 = cols+1; d_table->addCol(); d_table->addCol(); #ifdef Q_CC_MSVC QVarLengthArray<double> x_temp(d_n); #else double x_temp[d_n]; #endif QLocale locale = app->locale(); for (int i = 0; i<d_n; i++){ double x = i+1; x_temp[i] = x; d_table->setText(i, cols, QString::number(x)); d_table->setText(i, cols2, locale.toString(d_x[i], 'g', app->d_decimal_digits)); } QStringList l = d_table->colNames().grep(tr("Index")); QString id = QString::number((int)l.size()+1); QString label = objectName() + id; d_table->setColName(cols, tr("Index") + id); d_table->setColName(cols2, label); d_table->setColPlotDesignation(cols, Table::X); d_table->setHeaderColType(); if (d_graphics_display){ if (!d_output_graph) createOutputGraph(); DataCurve *c = new DataCurve(d_table, d_table->colName(cols), d_table->colName(cols2)); #ifdef Q_CC_MSVC c->setData(x_temp.data(), d_x, d_n); #else c->setData(x_temp, d_x, d_n); #endif c->setPen(QPen(ColorBox::color(d_curveColorIndex), 1)); d_output_graph->insertPlotItem(c, Graph::Line); d_output_graph->updatePlot(); } }
int main (int argc, char *argv[]) { int val = 0; QApplication app (argc, argv); ApplicationWindow window (&val); // Necessary argument ! Profiler *prof = new Profiler (); prof->setWindowTitle ("Profil"); window.setProfiler (prof); if (argc == 2) window.setFile (QString (argv[1])); window.show (); return app.exec (); // return EXIT_SUCCESS; }
QString NonLinearFit::legendInfo() { QString info = Fit::legendInfo(); if (d_constants.isEmpty()) return info; ApplicationWindow *app = (ApplicationWindow *)parent(); QLocale locale = app->locale(); QMapIterator<QString, double> i(d_constants); while (i.hasNext()) { i.next(); info += "\n" + i.key() + " = " + locale.toString(i.value(), 'g', d_prec) + " ("+ tr("constant") + ")"; } return info; }
Graph3D *MantidMatrix::plotGraph3D(int style) { QApplication::setOverrideCursor(Qt::WaitCursor); ApplicationWindow *a = applicationWindow(); QString labl = a->generateUniqueName(tr("Graph")); Graph3D *plot = new Graph3D("", a); plot->resize(500, 400); plot->setWindowTitle(labl); plot->setName(labl); plot->setTitle(tr("Workspace ") + name()); a->customPlot3D(plot); plot->customPlotStyle(style); int resCol = numCols() / 200; int resRow = numRows() / 200; plot->setResolution(qMax(resCol, resRow)); double zMin = 1e300; double zMax = -1e300; for (int i = 0; i < numRows(); i++) { for (int j = 0; j < numCols(); j++) { double val = cell(i, j); if (val < zMin) zMin = val; if (val > zMax) zMax = val; } } // Calculate xStart(), xEnd(), yStart(), yEnd() boundingRect(); MantidMatrixFunction *fun = new MantidMatrixFunction(*this); plot->addFunction(fun, xStart(), xEnd(), yStart(), yEnd(), zMin, zMax, numCols(), numRows()); using MantidQt::API::PlotAxis; plot->setXAxisLabel(PlotAxis(*m_workspace, 0).title()); plot->setYAxisLabel(PlotAxis(*m_workspace, 1).title()); plot->setZAxisLabel(PlotAxis(false, *m_workspace).title()); a->initPlot3D(plot); // plot->confirmClose(false); QApplication::restoreOverrideCursor(); return plot; }
int main( int argc, char **argv ) { // This is just a example of a main program using // the QtROOT interface. Here above a variable "mode" // defines different programs .ie. // mode 0 : Qtroot alone // mode 1 QtROOT + TBrowser // mode 2 QtROOT + TBrowser + Guitest (ROOT GUI"S examples) int mode = 0; TQApplication app("uno",&argc,argv); // Define a QRootApplication with polling mechanism on. // The ROOT events are then enabled .ie. the use of // TTimer TThread and Gui classes TGxx together // with Qt events handling is possible. TQRootApplication a( argc, argv, 0); // Define a QRootApplication without polling mechanism. //> QRootApplication a( argc, argv, 1); //> with debug info //> a.setDebugOn(); if (argc>1 ) mode = atoi(argv[1]); // if no polling done, the user need to create a // Qt customized factory // app.setCustomized(); if ( mode > 1 ) TestMainFrame* mainWindow = new TestMainFrame( gClient->GetRoot(), 400, 220); if ( mode > 0 ) TBrowser *b = new TBrowser(); ApplicationWindow * mw = new ApplicationWindow(); mw->setCaption( "Qt & ROOT" ); mw->show(); a.connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) ); int res = a.exec(); return res; }
void EnrichmentDialog::frameApplyTo() { ApplicationWindow *app = (ApplicationWindow *)this->parent(); switch(frameApplyToBox->currentIndex()){ case 0://this layer { FrameWidget *fw = qobject_cast<FrameWidget *>(d_widget); if (fw) setFrameTo(fw); } break; case 1://this layer { QList <FrameWidget *> lst = d_plot->enrichmentsList(); foreach(FrameWidget *fw, lst) setFrameTo(fw); } break; case 2://this window { QList<Graph *> layersLst = d_plot->multiLayer()->layersList(); foreach(Graph *g, layersLst){ QList <FrameWidget *> lst = g->enrichmentsList(); foreach(FrameWidget *fw, lst) setFrameTo(fw); } } break; case 3://all windows { QList<MdiSubWindow *> windows = app->windowsList(); foreach(MdiSubWindow *w, windows){ MultiLayer *ml = qobject_cast<MultiLayer *>(w); if (!ml) continue; QList<Graph *> layersLst = ml->layersList(); foreach(Graph *g, layersLst){ QList <FrameWidget *> lst = g->enrichmentsList(); foreach(FrameWidget *fw, lst) setFrameTo(fw); } }
QString Integration::logInfo() { ApplicationWindow *app = (ApplicationWindow *)parent(); QLocale locale = app->locale(); int prec = app->d_decimal_digits; QString logInfo = "[" + QDateTime::currentDateTime().toString(Qt::LocalDate); if (d_integrand == AnalyticalFunction){ logInfo += "\n" + tr("Numerical integration of") + " f(" + d_variable + ") = " + d_formula + " "; logInfo += tr("using a %1 order method").arg(d_method) + "\n"; logInfo += tr("From") + " x = " + locale.toString(d_from, 'g', prec) + " "; logInfo += tr("to") + " x = " + locale.toString(d_to, 'g', prec) + "\n"; logInfo += tr("Tolerance") + " = " + locale.toString(d_tolerance, 'g', prec) + "\n"; logInfo += tr("Iterations") + ": " + QString::number(romberg()) + "\n"; } else if (d_integrand == DataSet){ if (d_graph) logInfo += tr("\tPlot")+ ": ''" + d_graph->multiLayer()->objectName() + "'']\n"; else logInfo += "\n"; QString dataSet; if (d_curve) dataSet = d_curve->title().text(); else dataSet = d_y_col_name; logInfo += "\n" + tr("Numerical integration of") + ": " + dataSet + " "; logInfo += tr("using the Trapezoidal Rule") + "\n"; logInfo += tr("Points") + ": " + QString::number(d_n) + " " + tr("from") + " x = " + locale.toString(d_from, 'g', prec) + " "; logInfo += tr("to") + " x = " + locale.toString(d_to, 'g', prec) + "\n"; // use GSL to find maximum value of data set gsl_vector *aux = gsl_vector_alloc(d_n); for(int i=0; i < d_n; i++) gsl_vector_set (aux, i, fabs(d_y[i])); int maxID = gsl_vector_max_index (aux); gsl_vector_free(aux); logInfo += tr("Peak at") + " x = " + locale.toString(d_x[maxID], 'g', prec)+"\t"; logInfo += "y = " + locale.toString(d_y[maxID], 'g', prec)+"\n"; d_area = trapez(); } logInfo += tr("Area") + "=" + locale.toString(d_area, 'g', prec); logInfo += "\n-------------------------------------------------------------\n"; return logInfo; }
void Differentiation::output() { std::vector<double> result(d_n - 1); for (int i = 1; i < d_n - 1; i++) result[i] = 0.5 * ((d_y[i + 1] - d_y[i]) / (d_x[i + 1] - d_x[i]) + (d_y[i] - d_y[i - 1]) / (d_x[i] - d_x[i - 1])); ApplicationWindow *app = dynamic_cast<ApplicationWindow *>(parent()); if (!app) { throw std::logic_error( "Parent of Differentiation is not ApplicationWindow as expected."); } QLocale locale = app->locale(); QString tableName = app->generateUniqueName(QString(objectName())); QString dataSet; if (d_curve) dataSet = d_curve->title().text(); else dataSet = d_y_col_name; d_result_table = app->newHiddenTable( tableName, tr("Derivative") + " " + tr("of", "Derivative of") + " " + dataSet, d_n - 2, 2); for (int i = 1; i < d_n - 1; i++) { d_result_table->setText( i - 1, 0, locale.toString(d_x[i], 'g', app->d_decimal_digits)); d_result_table->setText( i - 1, 1, locale.toString(result[i], 'g', app->d_decimal_digits)); } if (d_graphics_display) { if (!d_output_graph) d_output_graph = createOutputGraph()->activeGraph(); d_output_graph->insertCurve(d_result_table, tableName + "_2", 0); QString legend = "\\l(1)" + tr("Derivative") + " " + tr("of", "Derivative of") + " " + dataSet; LegendWidget *l = d_output_graph->legend(); if (l) { l->setText(legend); l->repaint(); } else d_output_graph->newLegend(legend); } }