* @brief Deserializes a TableDef from a QJsonObject. */
| 598 | * @brief Deserializes a TableDef from a QJsonObject. |
| 599 | */ |
| 600 | [[nodiscard]] inline bool read(TableDef& t, const QJsonObject& obj) |
| 601 | { |
| 602 | if (obj.isEmpty()) |
| 603 | return false; |
| 604 | |
| 605 | t.name = ss_jsr(obj, Keys::Name, "").toString().simplified(); |
| 606 | if (t.name.isEmpty()) |
| 607 | return false; |
| 608 | |
| 609 | t.parentFolderId = ss_jsr(obj, Keys::ParentFolderId, -1).toInt(); |
| 610 | |
| 611 | t.registers.clear(); |
| 612 | const auto regs = obj.value(Keys::Registers).toArray(); |
| 613 | t.registers.reserve(regs.count()); |
| 614 | for (const auto& val : regs) { |
| 615 | RegisterDef r; |
| 616 | if (read(r, val.toObject())) |
| 617 | t.registers.push_back(r); |
| 618 | } |
| 619 | |
| 620 | return true; |
| 621 | } |
| 622 | |
| 623 | /** |
| 624 | * @brief Reference to a specific widget in the dashboard, stable across group reorders. |
no test coverage detected