Commit 50cfdbb7 authored by Christoph Feck's avatar Christoph Feck

Fix grouping display with negative numbers

BUG: 381418
FIXED-IN: 17.04.3

Differential Revision: https://phabricator.kde.org/D6326
parent de51bc0e
......@@ -582,11 +582,20 @@ QString KCalcDisplay::formatDecimalNumber(QString string)
}
}
// find first digit to not group leading spaces or signs
int firstDigitPos = 0;
for (int i = 0; i < string.length(); ++i) {
if (string.at(i).isDigit()) {
firstDigitPos = i;
break;
}
}
const QChar groupSeparator = locale.groupSeparator();
const int groupSize = 3;
string.reserve(string.length() + (pos - 1) / groupSize);
while ((pos -= groupSize) > 0) {
while ((pos -= groupSize) > firstDigitPos) {
string.insert(pos, groupSeparator);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment