diff options
author | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2015-06-18 16:14:24 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2015-06-18 17:22:28 +0300 |
commit | 5f40e434f93ca1a97bfddb23bb8baa361432176a (patch) | |
tree | b500c0df29f897d23ef125989e4e91f1aec8202a /src/utils | |
parent | 595b5eadc0504c6d4657772d893524542501d1f4 (diff) |
B2QtDevice: use rounding instead of truncating
Change-Id: Id5723f62b2df32fed1bb65f8e9211ba2d1032664
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@theqtcompany.com>
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/b2qtdevice.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/utils/b2qtdevice.cpp b/src/utils/b2qtdevice.cpp index c87c1b5..6bc0710 100644 --- a/src/utils/b2qtdevice.cpp +++ b/src/utils/b2qtdevice.cpp @@ -533,7 +533,7 @@ void PhysicalScreenSize::read(const QString &filename) physScreenSizeEnabled = true; const qreal diagMM = qSqrt(physScreenWidth * physScreenWidth + physScreenHeight * physScreenHeight); - physScreenSizeInch = int(diagMM / 25.4); + physScreenSizeInch = qRound(diagMM / 25.4); } void PhysicalScreenSize::onTimeout() @@ -567,8 +567,8 @@ void PhysicalScreenSize::write(const QString &filename, bool includePhysSize) const qreal diagMM = physScreenSizeInch * 25.4; // Assume 16:9 aspect ratio - const int physScreenHeight = int(diagMM / 1.975); - const int physScreenWidth = int(physScreenHeight * 1.777); + const int physScreenHeight = qRound(diagMM / 1.975); + const int physScreenWidth = qRound(physScreenHeight * 1.777); foreach (const QByteArray &line, lines) f.write(line + QByteArrayLiteral("\n")); |