diff src/converter.cpp @ 55:aaaf8cdbc85c

Make percent string formatting more flexible It now also responds to .94 or something like that and is prepared for multiple numbers after the dot.
author Andre Heinecke <andre.heinecke@intevation.de>
date Wed, 20 Jul 2016 16:57:52 +0200
parents f9a0b2b6832e
children 5410f9f279ea
line wrap: on
line diff
--- a/src/converter.cpp	Wed Jul 20 16:56:54 2016 +0200
+++ b/src/converter.cpp	Wed Jul 20 16:57:52 2016 +0200
@@ -242,8 +242,8 @@
                 xlsx.write(row, 2, percent == 0 ? QVariant() : percent);
                 const QString numStr = choiceMatch.captured("num");
                 const QString numVotesString = QString("%1% | %2 Number of votes").
-                           arg(percentStr.isNull() ? QStringLiteral("0") : percentStr).
-                           arg(numStr.isNull() ? QStringLiteral("0") : numStr);
+                           arg(percentStr.isEmpty() ? QStringLiteral("0") : percentStr).
+                           arg(numStr.isEmpty() ? QStringLiteral("0") : numStr);
                 html << mChoiceVotesStyle.arg(numVotesString.toHtmlEscaped());
                 xlsx.write(row, 3, numVotesString, mChoiceVotesFmt);
                 xlsx.setRowHeight(row, CHOICE_ROW_HEIGHT);
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)