From 2f305a7134f27489203c3fd2e9ca81790f35ac3b Mon Sep 17 00:00:00 2001 From: ivan tkachenko Date: Mon, 17 Jan 2022 02:24:44 +0300 Subject: [PATCH] [upower] Properly round up battery's capacity The same rounding is already used for charge percent just few lines above. Without it, for example, values that are close to 100% (e.g. 99.9825%) were rounded down to 99% instead of up to 100%. BUG: 448372 FIXED-IN: 5.91 --- src/solid/devices/backends/upower/upowerbattery.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/solid/devices/backends/upower/upowerbattery.cpp b/src/solid/devices/backends/upower/upowerbattery.cpp index 22b25d9..055856b 100644 --- a/src/solid/devices/backends/upower/upowerbattery.cpp +++ b/src/solid/devices/backends/upower/upowerbattery.cpp @@ -84,7 +84,7 @@ int Battery::chargePercent() const int Battery::capacity() const { - return m_device.data()->prop("Capacity").toDouble(); + return qRound(m_device.data()->prop("Capacity").toDouble()); } bool Battery::isRechargeable() const -- GitLab