############################################################################## ##################### Preview related functions ############################ ##############################################################################
| 497 | // ##################### Preview related functions ############################ |
| 498 | // ############################################################################## |
| 499 | void AddSubtractValueDialog::initPreview() { |
| 500 | // create project and worksheet |
| 501 | m_project = new Project(); |
| 502 | m_project->setUndoAware(false); |
| 503 | auto* ws = new Worksheet(QString()); |
| 504 | ws->setUseViewSize(true); |
| 505 | ws->setLayoutTopMargin(0.); |
| 506 | ws->setLayoutBottomMargin(0.); |
| 507 | ws->setLayoutLeftMargin(0.); |
| 508 | ws->setLayoutRightMargin(0.); |
| 509 | m_project->addChild(ws); |
| 510 | |
| 511 | // add plot |
| 512 | auto* plot = new CartesianPlot(QString()); |
| 513 | plot->setSuppressRetransform(true); |
| 514 | plot->setSymmetricPadding(false); |
| 515 | const double padding = Worksheet::convertToSceneUnits(0.5, Worksheet::Unit::Centimeter); |
| 516 | plot->setRightPadding(padding); |
| 517 | plot->setVerticalPadding(padding); |
| 518 | plot->plotArea()->borderLine()->setStyle(Qt::NoPen); |
| 519 | m_previewPlotTitle = plot->title(); |
| 520 | |
| 521 | // x-axis |
| 522 | auto* axis = new Axis(QLatin1String("y"), Axis::Orientation::Horizontal); |
| 523 | axis->setDefault(true); |
| 524 | axis->setSuppressRetransform(true); |
| 525 | plot->addChild(axis); |
| 526 | axis->setPosition(Axis::Position::Bottom); |
| 527 | axis->setMajorTicksDirection(Axis::ticksIn); |
| 528 | axis->majorGridLine()->setStyle(Qt::NoPen); |
| 529 | axis->setMinorTicksDirection(Axis::noTicks); |
| 530 | axis->title()->setText(QString()); |
| 531 | auto font = axis->labelsFont(); |
| 532 | font.setPointSizeF(Worksheet::convertToSceneUnits(8, Worksheet::Unit::Point)); |
| 533 | axis->setLabelsFont(font); |
| 534 | axis->setLabelsOffset(0); |
| 535 | axis->setSuppressRetransform(false); |
| 536 | |
| 537 | // y-axis |
| 538 | axis = new Axis(QLatin1String("y"), Axis::Orientation::Vertical); |
| 539 | axis->setDefault(true); |
| 540 | axis->setSuppressRetransform(true); |
| 541 | plot->addChild(axis); |
| 542 | axis->setPosition(Axis::Position::Left); |
| 543 | axis->setMajorTicksDirection(Axis::ticksIn); |
| 544 | axis->majorGridLine()->setStyle(Qt::NoPen); |
| 545 | axis->setMinorTicksDirection(Axis::noTicks); |
| 546 | axis->title()->setText(QString()); |
| 547 | font = axis->labelsFont(); |
| 548 | font.setPointSizeF(Worksheet::convertToSceneUnits(8, Worksheet::Unit::Point)); |
| 549 | axis->setLabelsFont(font); |
| 550 | axis->setLabelsOffset(0); |
| 551 | axis->setSuppressRetransform(false); |
| 552 | |
| 553 | ws->addChild(plot); |
| 554 | plot->setSuppressRetransform(false); |
| 555 | |
| 556 | // add the curve for the original data |
nothing calls this directly
no test coverage detected