MCPcopy Create free account
hub / github.com/KDE/labplot / generate

Method generate

src/frontend/spreadsheet/FunctionValuesDialog.cpp:390–421  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

388}
389
390void FunctionValuesDialog::generate() {
391 Q_ASSERT(m_spreadsheet);
392
393 WAIT_CURSOR;
394 m_spreadsheet->beginMacro(i18np("%1: fill column with function values", "%1: fill columns with function values", m_spreadsheet->name(), m_columns.size()));
395
396 // determine variable names and data vectors of the specified columns
397 QStringList variableNames;
398 QVector<Column*> variableColumns;
399 for (int i = 0; i < m_variableLineEdits.size(); ++i) {
400 variableNames << m_variableLineEdits.at(i)->text().simplified();
401
402 auto* aspect{static_cast<AbstractAspect*>(m_variableDataColumns.at(i)->currentModelIndex().internalPointer())};
403 if (aspect) {
404 auto* column{dynamic_cast<Column*>(aspect)};
405 if (column)
406 variableColumns << column;
407 }
408 }
409
410 // set the new values and store the expression, variable names and used data columns
411 const QString& expression{ui.teEquation->toPlainText()};
412 bool autoUpdate{(ui.chkAutoUpdate->checkState() == Qt::Checked)};
413 bool autoResize{(ui.chkAutoResize->checkState() == Qt::Checked)};
414 for (auto* col : m_columns) {
415 col->setColumnMode(AbstractColumn::ColumnMode::Double);
416 col->setFormula(expression, variableNames, variableColumns, autoUpdate, autoResize);
417 col->updateFormula();
418 }
419 m_spreadsheet->endMacro();
420 RESET_CURSOR;
421}

Callers

nothing calls this directly

Calls 9

beginMacroMethod · 0.80
currentModelIndexMethod · 0.80
endMacroMethod · 0.80
nameMethod · 0.45
sizeMethod · 0.45
textMethod · 0.45
setColumnModeMethod · 0.45
setFormulaMethod · 0.45
updateFormulaMethod · 0.45

Tested by

no test coverage detected