From 74090f7ffd53ec694a42fa4a6b84350ad2b9ecc9 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Tue, 28 Sep 2021 16:43:36 +0300 Subject: [PATCH] PDF Tiles "ruler" is fine when Unit is "Inch" or "Cm". It is bad when Unit is "Mm" or "Pixel". --- src/app/puzzle/vptilefactory.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/app/puzzle/vptilefactory.cpp b/src/app/puzzle/vptilefactory.cpp index a9e2a9444..1b04d1fd3 100644 --- a/src/app/puzzle/vptilefactory.cpp +++ b/src/app/puzzle/vptilefactory.cpp @@ -446,8 +446,11 @@ void VPTileFactory::DrawRuler(QPainter *painter) const qreal notchHeight = UnitConvertor(3, Unit::Mm, Unit::Px); const qreal shortNotchHeight = UnitConvertor(1.1, Unit::Mm, Unit::Px); + Unit layoutUnits = layout->LayoutSettings().GetUnit(); - const qreal step = UnitConvertor(1, layoutUnits, Unit::Px); + Unit rulerUnits = layoutUnits == Unit::Inch ? layoutUnits : Unit::Cm; + + const qreal step = UnitConvertor(1, rulerUnits, Unit::Px); double marksCount = (m_drawingAreaWidth-tileStripeWidth) / step; int i = 0; while (i < marksCount) @@ -464,7 +467,7 @@ void VPTileFactory::DrawRuler(QPainter *painter) } else { - QString units = layoutUnits == Unit::Cm || layoutUnits == Unit::Mm ? tr("cm", "unit") : tr("in", "unit"); + QString units = rulerUnits != Unit::Inch ? tr("cm", "unit") : tr("in", "unit"); QFont fnt = painter->font(); fnt.setPointSize(10);