Fix rounding problem when search a size template.
This commit is contained in:
parent
eb22f19fea
commit
21b8401466
|
@ -690,7 +690,8 @@ void PuzzlePreferencesLayoutPage::FindTemplate(QComboBox *box, qreal width, qrea
|
|||
{
|
||||
const QSizeF tmplSize =
|
||||
VAbstractLayoutDialog::GetTemplateSize(static_cast<VAbstractLayoutDialog::PaperSizeTemplate>(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);
|
||||
|
|
|
@ -2144,7 +2144,8 @@ void VPMainWindow::FindTemplate(QComboBox *box, qreal width, qreal height)
|
|||
{
|
||||
const QSizeF tmplSize =
|
||||
VAbstractLayoutDialog::GetTemplateSize(static_cast<VAbstractLayoutDialog::PaperSizeTemplate>(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);
|
||||
|
|
|
@ -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<int>(PaperSizeTemplate::Custom);
|
||||
for (int i = 0; i < max; ++i)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user