| 44 | } |
| 45 | |
| 46 | QString joinArray(const QJsonArray& array, const QString& emptyText = "(none)") |
| 47 | { |
| 48 | QStringList values; |
| 49 | values.reserve(array.size()); |
| 50 | for (const QJsonValue& value : array) { |
| 51 | if (value.isString()) |
| 52 | values << value.toString(); |
| 53 | else if (value.isDouble()) |
| 54 | values << QString::number(value.toDouble()); |
| 55 | else if (value.isBool()) |
| 56 | values << (value.toBool() ? "true" : "false"); |
| 57 | } |
| 58 | return values.isEmpty() ? emptyText : values.join(", "); |
| 59 | } |
| 60 | |
| 61 | QString formatNumber(const QJsonValue& value, int decimals = 2, const QString& suffix = {}) |
| 62 | { |
no test coverage detected