[ksysguard] [Bug 427795] CPU Applet does not round Load average numbers
https://bugs.kde.org/show_bug.cgi?id=427795 Kishore Gopalakrishnan changed: What|Removed |Added CC||[email protected] -- You are receiving this mail because: You are watching all bug changes.
[ksysguard] [Bug 427795] CPU Applet does not round Load average numbers
https://bugs.kde.org/show_bug.cgi?id=427795 --- Comment #8 from Sébastien P. --- Created attachment 145056 --> https://bugs.kde.org/attachment.cgi?id=145056&action=edit Still an issue As you can see, the text part is fine but not the chart. -- You are receiving this mail because: You are watching all bug changes.
[ksysguard] [Bug 427795] CPU Applet does not round Load average numbers
https://bugs.kde.org/show_bug.cgi?id=427795 Sébastien P. changed: What|Removed |Added Status|RESOLVED|REOPENED Ever confirmed|0 |1 Resolution|FIXED |--- --- Comment #7 from Sébastien P. --- Or reopen it since it is the same issue^^. I tried to recreate a new load average applet but the numbers are not rounded. libksysguard 5.23.4 Frameworks 5.88.0 Qt 5.15.2 Screenshot to come. -- You are receiving this mail because: You are watching all bug changes.
[ksysguard] [Bug 427795] CPU Applet does not round Load average numbers
https://bugs.kde.org/show_bug.cgi?id=427795 --- Comment #6 from Sébastien P. --- It is fine for CPU, but not for load average. I think I will create another issue for that. -- You are receiving this mail because: You are watching all bug changes.
[ksysguard] [Bug 427795] CPU Applet does not round Load average numbers
https://bugs.kde.org/show_bug.cgi?id=427795 --- Comment #5 from Sébastien P. --- Ok, I will have to wait the full stabilisation of 5.23 on my distro. I had another issue since 5.21: https://bugs.kde.org/show_bug.cgi?id=438554 so I do not have any load average now :) -- You are receiving this mail because: You are watching all bug changes.
[ksysguard] [Bug 427795] CPU Applet does not round Load average numbers
https://bugs.kde.org/show_bug.cgi?id=427795 --- Comment #4 from Gerald Weber --- (In reply to Sébastien P. from comment #3) > Hi Gerald, > Do you have a commit hash/know version? hi, um, no, i closed the issue since i don't see the problem anymore with the actual version regards -- You are receiving this mail because: You are watching all bug changes.
[ksysguard] [Bug 427795] CPU Applet does not round Load average numbers
https://bugs.kde.org/show_bug.cgi?id=427795 --- Comment #3 from Sébastien P. --- Hi Gerald, Do you have a commit hash/know version? -- You are receiving this mail because: You are watching all bug changes.
[ksysguard] [Bug 427795] CPU Applet does not round Load average numbers
https://bugs.kde.org/show_bug.cgi?id=427795 Gerald Weber changed: What|Removed |Added Resolution|--- |FIXED Status|REPORTED|RESOLVED -- You are receiving this mail because: You are watching all bug changes.
[ksysguard] [Bug 427795] CPU Applet does not round Load average numbers
https://bugs.kde.org/show_bug.cgi?id=427795
--- Comment #2 from Sébastien P. ---
Created attachment 135334
--> https://bugs.kde.org/attachment.cgi?id=135334&action=edit
A very dirty fix
I tried to analyze a bit. Without the knowledge of Qt/C++… a bit difficult^^.
It looks like new grid system use a Unit not listed in
Formatter::formatValue cases. So it goes to default one “value.toString();”
(Formatter.cpp line 319 in master branch).
=> So I change the default to use formatNumber function. I do not know the
impacts… but works fine for me.
=> It looks like also that the grid value is not a QVariant double. So, I add a
dirty parameter (I did not find where I can change the type properly…)
With my usage of applets. Only load average and disk usage are affect by that.
diff --git a/formatter/Formatter.cpp b/formatter/Formatter.cpp
index 29ef6a6..17d8d6d 100644
--- a/formatter/Formatter.cpp
+++ b/formatter/Formatter.cpp
@@ -233,7 +233,7 @@ static Unit adjustedUnit(qreal value, Unit unit,
MetricPrefix prefix)
return Unit(prefix + baseUnit);
}
-static QString formatNumber(const QVariant &value, Unit unit, MetricPrefix
prefix, FormatOptions options)
+static QString formatNumber(const QVariant &value, Unit unit, MetricPrefix
prefix, FormatOptions options, bool forceDouble)
{
qreal amount = value.toDouble();
@@ -246,7 +246,7 @@ static QString formatNumber(const QVariant &value, Unit
unit, MetricPrefix prefi
amount /= std::pow(unitOrder(unit), adjusted - unit);
}
-const int precision = (value.type() != QVariant::Double && adjusted <=
unit) ? 0 : 1;
+const int precision = (value.type() != QVariant::Double && adjusted <=
unit && !forceDouble) ? 0 : 1;
const QString text = QLocale().toString(amount, 'f', precision);
return unitFormat(adjusted).subs(text).toString();
@@ -307,7 +307,7 @@ QString Formatter::formatValue(const QVariant &value, Unit
unit, MetricPrefix ta
case UnitVolt:
case UnitWatt:
case UnitSecond:
-return formatNumber(value, unit, targetPrefix, options);
+return formatNumber(value, unit, targetPrefix, options, false);
case UnitBootTimestamp:
qCWarning(FORMATTER) << "UnitBootTimestamp is deprecated and is not
formatted anymore";
@@ -316,7 +316,7 @@ QString Formatter::formatValue(const QVariant &value, Unit
unit, MetricPrefix ta
return formatTime(value);
default:
-return value.toString();
+return formatNumber(value, unit, targetPrefix, options, true);
}
}
--
You are receiving this mail because:
You are watching all bug changes.
[ksysguard] [Bug 427795] CPU Applet does not round Load average numbers
https://bugs.kde.org/show_bug.cgi?id=427795 --- Comment #1 from Sébastien P. --- Come from the new grid system? https://invent.kde.org/plasma/libksysguard/-/merge_requests/44 -- You are receiving this mail because: You are watching all bug changes.
[ksysguard] [Bug 427795] CPU Applet does not round Load average numbers
https://bugs.kde.org/show_bug.cgi?id=427795 Sébastien P. changed: What|Removed |Added CC||[email protected] -- You are receiving this mail because: You are watching all bug changes.
