diff options
| author | Jarkko Koivikko <jarkko.koivikko@code-q.fi> | 2023-10-26 14:02:48 +0300 |
|---|---|---|
| committer | Jarkko Koivikko <jarkko.koivikko@code-q.fi> | 2023-12-09 04:46:24 +0200 |
| commit | d420c1e25a0fb3b25ba4c572f2938701ce8494ec (patch) | |
| tree | 91dfc17727b5cf98d5375c809a280feadbfbaaca /src/corelib/io/qdebug.cpp | |
| parent | 5fb2d50e42e1046bf43d876e0caf92c14d914661 (diff) | |
print: QPageLayout: Fix pt unit conversion
This patch corrects the miscalculation in point unit conversion,
ensuring correct margin updates.
Previously, non-pt units were rounded to two decimal places. When
converting back to pt, rounding was to zero decimals, making the result
always less than the original. This could result in margins falling
below the minimum allowed.
Example:
original_points = 8.4
multiplier = 2.83464566929
mm: qRound(8.4 / multiplier * 100) / 100 = 2.96
new_points: qRound(2.96 * multiplier) = 8 // wrong!
The fix rounds back-converted values up to two decimals, ensuring they
are never less than the original and thus stay above minimum margins.
new_points: qCeil(2.96 * multiplier * 100) / 100 = 8.4
Also, remove unused function qt_convertPoint.
Pick-to: 6.6
Change-Id: I6109f8d381aec96db1ce04cc167f7b73c1c0b9a8
Reviewed-by: David Faure <david.faure@kdab.com>
Diffstat (limited to 'src/corelib/io/qdebug.cpp')
0 files changed, 0 insertions, 0 deletions
