MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / extractDeviceColors

Function extractDeviceColors

app/src/Misc/ThemeManager.cpp:79–94  ·  view source on GitHub ↗

* @brief Extracts device color gradient pairs from a JSON object. */

Source from the content-addressed store, hash-verified

77 * @brief Extracts device color gradient pairs from a JSON object.
78 */
79static QVector<QPair<QColor, QColor>> extractDeviceColors(const QJsonObject& colorsObject)
80{
81 QVector<QPair<QColor, QColor>> result;
82 const QJsonArray array = colorsObject.value("device_colors").toArray();
83 result.reserve(array.size());
84
85 for (const auto& val : array) {
86 if (!val.isObject())
87 continue;
88
89 const auto obj = val.toObject();
90 result.append({QColor(obj.value("top").toString()), QColor(obj.value("bottom").toString())});
91 }
92
93 return result;
94}
95
96//--------------------------------------------------------------------------------------------------
97// Constructor & singleton access

Callers 2

setThemeMethod · 0.85
loadSystemThemeMethod · 0.85

Calls 3

valueMethod · 0.45
sizeMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected