comparison 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
comparison
equal deleted inserted replaced
54:dcfb8e9d5ee9 55:aaaf8cdbc85c
240 } 240 }
241 makeBar(html, percent, doc); 241 makeBar(html, percent, doc);
242 xlsx.write(row, 2, percent == 0 ? QVariant() : percent); 242 xlsx.write(row, 2, percent == 0 ? QVariant() : percent);
243 const QString numStr = choiceMatch.captured("num"); 243 const QString numStr = choiceMatch.captured("num");
244 const QString numVotesString = QString("%1% | %2 Number of votes"). 244 const QString numVotesString = QString("%1% | %2 Number of votes").
245 arg(percentStr.isNull() ? QStringLiteral("0") : percentStr). 245 arg(percentStr.isEmpty() ? QStringLiteral("0") : percentStr).
246 arg(numStr.isNull() ? QStringLiteral("0") : numStr); 246 arg(numStr.isEmpty() ? QStringLiteral("0") : numStr);
247 html << mChoiceVotesStyle.arg(numVotesString.toHtmlEscaped()); 247 html << mChoiceVotesStyle.arg(numVotesString.toHtmlEscaped());
248 xlsx.write(row, 3, numVotesString, mChoiceVotesFmt); 248 xlsx.write(row, 3, numVotesString, mChoiceVotesFmt);
249 xlsx.setRowHeight(row, CHOICE_ROW_HEIGHT); 249 xlsx.setRowHeight(row, CHOICE_ROW_HEIGHT);
250 /* As long as we can match a choice which is either before the next question 250 /* As long as we can match a choice which is either before the next question
251 or before the end of the document */ 251 or before the end of the document */
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)