* @brief Serializes an OutputWidget to a QJsonObject. */
| 347 | * @brief Serializes an OutputWidget to a QJsonObject. |
| 348 | */ |
| 349 | [[nodiscard]] inline QJsonObject serialize(const OutputWidget& w) |
| 350 | { |
| 351 | QJsonObject obj; |
| 352 | obj.insert(Keys::Icon, w.icon); |
| 353 | obj.insert(Keys::Title, w.title); |
| 354 | obj.insert(Keys::SourceId, w.sourceId); |
| 355 | obj.insert(Keys::OutputType, static_cast<int>(w.type)); |
| 356 | obj.insert(Keys::OutputMinValue, w.minValue); |
| 357 | obj.insert(Keys::OutputMaxValue, w.maxValue); |
| 358 | obj.insert(Keys::OutputStepSize, w.stepSize); |
| 359 | obj.insert(Keys::OutputInitialValue, w.initialValue); |
| 360 | if (w.monoIcon) |
| 361 | obj.insert(Keys::OutputMonoIcon, true); |
| 362 | |
| 363 | obj.insert(Keys::TransmitFunction, w.transmitFunction); |
| 364 | obj.insert(Keys::OutputTxEncoding, w.txEncoding); |
| 365 | return obj; |
| 366 | } |
| 367 | |
| 368 | /** |
| 369 | * @brief Deserializes an OutputWidget from a QJsonObject (Frame.cpp: uses SerialStudio::toDouble). |
no test coverage detected