diff options
| author | 2020-03-20 18:54:27 +0100 | |
|---|---|---|
| committer | 2020-03-28 02:05:05 +0100 | |
| commit | dcdc81cb8e2ce41beab6042f8b5044773f5229d0 (patch) | |
| tree | e0209d6ce1d3601a73221ed01a0c9898c5d694fa /highlightdice.cpp | |
| parent | 653ba9395a36cc20ec1d68c9a9cae78973fa334c (diff) | |
| download | OneRoll-dcdc81cb8e2ce41beab6042f8b5044773f5229d0.tar.gz OneRoll-dcdc81cb8e2ce41beab6042f8b5044773f5229d0.zip | |
Show explode value in @ place holder.
Diffstat (limited to 'highlightdice.cpp')
| -rw-r--r-- | highlightdice.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/highlightdice.cpp b/highlightdice.cpp index 58d9eec..d180a8d 100644 --- a/highlightdice.cpp +++ b/highlightdice.cpp @@ -78,8 +78,17 @@ void HighLightDice::setFaces(const quint64& faces) QString HighLightDice::getResultString() const { - QStringList list; - std::transform(std::begin(m_result), std::end(m_result), std::back_inserter(list), - [](qint64 value) { return QString::number(value); }); - return list.join(","); + if(m_result.size() == 1) + { + return QString::number(m_result.first()); + } + else + { + QStringList list; + std::transform(std::begin(m_result), std::end(m_result), std::back_inserter(list), + [](qint64 value) { return QString::number(value); }); + + auto totalScore= std::accumulate(std::begin(m_result), std::end(m_result), 0); + return QStringLiteral("%2 [%1]").arg(list.join(",")).arg(totalScore); + } } |