diff --git a/src/app/puzzle/dialogs/configpages/puzzlepreferenceslayoutpage.cpp b/src/app/puzzle/dialogs/configpages/puzzlepreferenceslayoutpage.cpp index 4f5bdfee4..9698757c6 100644 --- a/src/app/puzzle/dialogs/configpages/puzzlepreferenceslayoutpage.cpp +++ b/src/app/puzzle/dialogs/configpages/puzzlepreferenceslayoutpage.cpp @@ -690,7 +690,8 @@ void PuzzlePreferencesLayoutPage::FindTemplate(QComboBox *box, qreal width, qrea { const QSizeF tmplSize = VAbstractLayoutDialog::GetTemplateSize(static_cast(i), paperUnit); - if (QSizeF(width, height) == tmplSize || QSizeF(height, width) == tmplSize) + if (VAbstractLayoutDialog::RoundTemplateSize(width, height, paperUnit) == tmplSize || + VAbstractLayoutDialog::RoundTemplateSize(height, width, paperUnit) == tmplSize) { box->blockSignals(true); const int index = box->findData(i); diff --git a/src/app/puzzle/vpmainwindow.cpp b/src/app/puzzle/vpmainwindow.cpp index 872d4501b..edf383fc6 100644 --- a/src/app/puzzle/vpmainwindow.cpp +++ b/src/app/puzzle/vpmainwindow.cpp @@ -2144,7 +2144,8 @@ void VPMainWindow::FindTemplate(QComboBox *box, qreal width, qreal height) { const QSizeF tmplSize = VAbstractLayoutDialog::GetTemplateSize(static_cast(i), paperUnit); - if (QSizeF(width, height) == tmplSize || QSizeF(height, width) == tmplSize) + if (VAbstractLayoutDialog::RoundTemplateSize(width, height, paperUnit) == tmplSize || + VAbstractLayoutDialog::RoundTemplateSize(height, width, paperUnit) == tmplSize) { box->blockSignals(true); const int index = box->findData(i); diff --git a/src/app/valentina/dialogs/dialogsavelayout.cpp b/src/app/valentina/dialogs/dialogsavelayout.cpp index e585dad0e..4b17b5542 100644 --- a/src/app/valentina/dialogs/dialogsavelayout.cpp +++ b/src/app/valentina/dialogs/dialogsavelayout.cpp @@ -760,7 +760,8 @@ void DialogSaveLayout::ReadSettings() ui->doubleSpinBoxBottomField->setSuffix(UnitsToStr(unit, true)); // read Template - const QSizeF size = QSizeF(settings->GetTiledPDFPaperWidth(Unit::Mm), settings->GetTiledPDFPaperHeight(Unit::Mm)); + const QSizeF size = VAbstractLayoutDialog::RoundTemplateSize(settings->GetTiledPDFPaperWidth(Unit::Mm), + settings->GetTiledPDFPaperHeight(Unit::Mm), Unit::Mm); const int max = static_cast(PaperSizeTemplate::Custom); for (int i = 0; i < max; ++i) diff --git a/src/libs/vlayout/dialogs/vabstractlayoutdialog.h b/src/libs/vlayout/dialogs/vabstractlayoutdialog.h index cbda557a4..8e520096f 100644 --- a/src/libs/vlayout/dialogs/vabstractlayoutdialog.h +++ b/src/libs/vlayout/dialogs/vabstractlayoutdialog.h @@ -61,6 +61,7 @@ public: explicit VAbstractLayoutDialog(QWidget *parent = nullptr); static auto GetTemplateSize(PaperSizeTemplate tmpl, Unit unit) -> QSizeF; + static auto RoundTemplateSize(qreal width, qreal height, Unit unit) -> QSizeF; static void InitTemplates(QComboBox *comboBoxTemplates); static void InitTileTemplates(QComboBox *comboBoxTemplates, bool keepCustom = false); @@ -70,7 +71,6 @@ protected: using VIndexType = int; static auto PageFormatNames() -> const FormatsVector &; - static auto RoundTemplateSize(qreal width, qreal height, Unit unit) -> QSizeF; private: Q_DISABLE_COPY_MOVE(VAbstractLayoutDialog) // NOLINT