From 9cddf75d97f20a83d7bb0f947e6ab90385611b64 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Fri, 18 Feb 2022 19:18:19 +0200 Subject: [PATCH] Fix issue with Custom template. --- ChangeLog.txt | 1 + src/app/puzzle/vpmainwindow.cpp | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 6829cde9f..26b4f4e9b 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,5 +1,6 @@ # Valentina 0.7.51 (unreleased) - Z value change for a layout piece. +- Fix issue with Custom template. # Valentina 0.7.50 February 14, 2022 - Fix regression. Minimal seam allowance width is less than the point accuracy values. diff --git a/src/app/puzzle/vpmainwindow.cpp b/src/app/puzzle/vpmainwindow.cpp index 4d22b7132..436fbea9f 100644 --- a/src/app/puzzle/vpmainwindow.cpp +++ b/src/app/puzzle/vpmainwindow.cpp @@ -1935,7 +1935,6 @@ auto VPMainWindow::Template(VAbstractLayoutDialog::PaperSizeTemplate t) const -> case VAbstractLayoutDialog::PaperSizeTemplate::Letter: case VAbstractLayoutDialog::PaperSizeTemplate::Legal: case VAbstractLayoutDialog::PaperSizeTemplate::Tabloid: - return VAbstractLayoutDialog::GetTemplateSize(t, layoutUnit); case VAbstractLayoutDialog::PaperSizeTemplate::Roll24in: case VAbstractLayoutDialog::PaperSizeTemplate::Roll30in: case VAbstractLayoutDialog::PaperSizeTemplate::Roll36in: @@ -1946,17 +1945,22 @@ auto VPMainWindow::Template(VAbstractLayoutDialog::PaperSizeTemplate t) const -> case VAbstractLayoutDialog::PaperSizeTemplate::Roll72in: return VAbstractLayoutDialog::GetTemplateSize(t, layoutUnit); case VAbstractLayoutDialog::PaperSizeTemplate::Custom: - return VAbstractLayoutDialog::GetTemplateSize(t, layoutUnit); default: break; } - return QSizeF(); + return {}; } //--------------------------------------------------------------------------------------------------------------------- auto VPMainWindow::SheetTemplate() const -> QSizeF { auto t = static_cast(ui->comboBoxSheetTemplates->currentData().toInt()); + + if (t == VAbstractLayoutDialog::PaperSizeTemplate::Custom) + { + return {ui->doubleSpinBoxSheetPaperWidth->value(), ui->doubleSpinBoxSheetPaperHeight->value()}; + } + return Template(t); } @@ -1964,6 +1968,12 @@ auto VPMainWindow::SheetTemplate() const -> QSizeF auto VPMainWindow::TileTemplate() const -> QSizeF { auto t = static_cast(ui->comboBoxTileTemplates->currentData().toInt()); + + if (t == VAbstractLayoutDialog::PaperSizeTemplate::Custom) + { + return {ui->doubleSpinBoxTilePaperWidth->value(), ui->doubleSpinBoxTilePaperHeight->value()}; + } + return Template(t); }